'Import Object Format with applied Paragraph Styles

I am importing styles from a separate .indd and applying them with the function newTextFrame.appliedObjectStyle The Object Style has the "Apply next Paragraph Style" Option enabled, but when i execute my script, only the first paragraph style is applied. When i reapply the object style after my script has finished, it is working.

Object Style Preferences

enter image description here

I tried adding .applyNextParagraphStyleor .enableParagraphStyle but it didn't work ( I know these are ususally used for creating object styles)



Solution 1:[1]

Okay, I found the solution.

It had something to do with the order of my code. Basically i was applying the object style before loading the content. Now, that the content is already placed in the text frame and THEN applied with the object style, it works fine!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 niklasberlec