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

How can I let second column applied to character style “ITALIC”

Contributor ,
Aug 07, 2014 Aug 07, 2014

Hi every one

Can you make a script for applied second column of text applied to to character style ITALIC

Like this:

UI035.jpg

Thanks

John

TOPICS
Scripting
736
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

Enthusiast , Aug 07, 2014 Aug 07, 2014

Select the table and run the below script:

app.selection[0].columns[1].select(); 

app.selection[0].texts.everyItem().appliedCharacterStyle = "ITALIC" 

Vandy

Translate
Enthusiast ,
Aug 07, 2014 Aug 07, 2014

Try this,

for (s=0; s<app.activeDocument.stories.length; s++)

{

    for (t=0; t<app.activeDocument.stories.tables.length; t++)

    {

        app.activeDocument.stories.tables.columns[1].select();

        app.selection[0].texts.everyItem().appliedCharacterStyle = "ITALIC"

    }

}

Vandy

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
Contributor ,
Aug 07, 2014 Aug 07, 2014

THANK YOU VANDY

Thank you so much

John

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
Contributor ,
Aug 07, 2014 Aug 07, 2014

Hi, Vandy

why this script function in all the table?

I only want it function in my selected table

Regard

John

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
Enthusiast ,
Aug 07, 2014 Aug 07, 2014

Select the table and run the below script:

app.selection[0].columns[1].select(); 

app.selection[0].texts.everyItem().appliedCharacterStyle = "ITALIC" 

Vandy

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
Contributor ,
Aug 07, 2014 Aug 07, 2014

Hi Vandy

got an error

John

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
Enthusiast ,
Aug 07, 2014 Aug 07, 2014

Working fine at my end.

Select the entire table and run the script...

What error ? screenshot pls....

Vandy

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
Enthusiast ,
Aug 08, 2014 Aug 08, 2014

John, I got an error is no description!

Vandys lines work here too. But I think, this isn’t really flexible and it is always a good idea to avoid the select-function.

I would do it in this way. The script assumes, that either the insertionPoint is in a cell, one or more cells are selected or the whole table.

var myTable = getTable();

formatTable( myTable );

// check selection

function getTable() {

    if( app.selection.length > 0 ) {

        mySel = app.selection[0];  

        if( mySel.parent.constructor.name == 'Table' )

        return mySel.parent;  

        else if( mySel.parent.parent.constructor.name == 'Table' )

        return mySel.parent.parent;

        else if ( mySel.constructor.name == 'Table' )

        return mySel;

    }

    alert( 'Error!\rWrong selection or nothing selected.' );

    exit();

}

// some styling

function formatTable( tbl ) {

    tbl.columns[1].cells.everyItem().texts[0].appliedCharacterStyle = 'italic';

}

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
Contributor ,
Aug 08, 2014 Aug 08, 2014
LATEST

Thank you  Kai Rübsamen

thank you so much

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
Contributor ,
Aug 08, 2014 Aug 08, 2014

sorry I don't select entire table

John

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