Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

apply object style

Explorer ,
Dec 17, 2019 Dec 17, 2019

Hi,

I have an Indesign document that contains anchored text frames within a number of linked text frames.
I run an extendscript that adjusts the width of the anchored text frame to the width of the frame where it is embedded and applies an object style to it.
This is the code:

for (var i = 0; i < doc.allPageItems.length; i++) {  
    tf = doc.allPageItems[i];
    if( tf.constructor.name == 'TextFrame') {
        var hasBorder =  tf.extractLabel("hasBorder"); 
        if( hasBorder == 'true' ) {   
            tf.appliedObjectStyle = doc.objectStyles.itemByName("rahmen");
             if( tf.parent.constructor.name == "Character" )
            {
                var parentFrameWidth = getTextFrameWidth(tf.parent.parentTextFrames[0]) ;
                var borderedFrameWidthInmm  = parentFrameWidth + 'mm';  
                setWidthHeight( tf, borderedFrameWidthInmm, '10mm' );
                tf.appliedObjectStyle = doc.objectStyles.itemByName("rahmen");
            }                  
        }
    }
}

After executing the extendscript, the document looks like this:

2019-12-17 10_17_46-after_script.png
 When I select the frame I can see, that the correct object style is applied.
But the anchored text frame is too long and should be shifted to the next linked text frame, like this:

2019-12-17 10_36_06-after_manual.png

 

I get this result, when I manually apply the object style to the frame, but not when I do it using extendscript.
Any ideas, what could be the problem ?

TOPICS
Scripting
397
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 17, 2019 Dec 17, 2019

Hi Mike,

you could recompose the story.

http://jongware.mit.edu/idcs6js/pc_Story.html#recompose

 

Regards,
Uwe Laubender

( ACP )

 

Translate
Community Expert ,
Dec 17, 2019 Dec 17, 2019
LATEST

Hi Mike,

you could recompose the story.

http://jongware.mit.edu/idcs6js/pc_Story.html#recompose

 

Regards,
Uwe Laubender

( ACP )

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines