Selection of parts and columns, or entire lines and apply the character style

I am trying to apply character styles to certain parts/whole rows and columns.

I can change individual cells with the following code...

table = app.selection[0];
if (table.hasOwnProperty("baseline")) table = table.parent;
if (table instanceof Cell) table = table.parent;
if (table instanceof Column) table = table.parent;
if (table instanceof Row) table = table.parent;
if (table instanceof Table)

{
 table.rows[0].cells[6].texts[0].appliedCharacterStyle = "none report";
 }

... but when I try to select an entire line, I get the error 'Object does not support property or method' texts. "" "When I try one of the following two codes.

{
 table.rows[0].cells.texts.appliedCharacterStyle = "none report";
 }

{
 table.rows[0].cells.appliedCharacterStyle = "none report";
 }

Anyone know how I can do the following?

1. Select any row (or column) and apply the character style

2. Select the last line (regardless of the number of rows in the table) and apply the character style

3. apply the character style to specific columns (with theexception of the cells of two albums)

Thank you!

Hello

Change this line:

table.columns[a].cells.itemByRange(2,-1).texts.everyItem().appliedCharacterStyle = "chart orange";

for the first 2 rows in each column

Jarek

Tags: InDesign

Similar Questions

  • Is it possible to add text to the cells and apply the character style in the cell

    I work in InDesign on Mac 5.

    I have two tables of formatting with information that will be eventually combined. I implemented the scripts I found on these forums to add the columns needed, merge lines and fill the cells merged with the appropriate color, but can't two remaining tasks.

    1. is it possible to add text to a cell of some?

    2 and it is possible to apply a character style to cells? (different cells than those that I need to add some text)

    I played with this code but do not know if it is even close...

    {

    table. Rows [0]. Cells [0]. InsertText (' CS/PS");

    }

    {

    table. Rows [0]. Cells [0] .appliedCharacterStyle ("bold");

    }

    Here are the scripts that I have combined so far for the table...

    Add column

    myTable = app.selection [0];

    MyColumn = myTable.columns [1];

    for (a = 0; < 1; a ++)

    {

    myTable.columns.add (LocationOptions.AFTER, myColumn);

    }

    Merge lines

    table = app.selection [0];

    If (table.hasOwnProperty ("baseline") table) = table.parent;

    If (instanceof cell table) table = table.parent;

    If (instanceof column table) table = table.parent;

    If (instanceof row table) table = table.parent;

    If (instanceof Table table)

    {

    table. Rows [0]. Cells [0]. Merge (table.rows [0] .cells [1]);

    }

    {

    colours alternating in merged lines

    r = table.rows [1];

    n = app.activeDocument.swatches.item ("orange");

    b = app.activeDocument.swatches.item ("PANTONE 3005 C");

    for (c = 0; c < r.cells.length; c ++)

    {

    If (c & 1)

    r.Cells [c]. Properties = {fillColor:b};

    on the other

    r.Cells [c]. FillColor = n;

    }

    }

    Hello

    1. If you want to add the text, go further in:

    table. Rows [0]. Cells [0] .insertionPoints [0] .silence = ' CS/PS;

    2 similar with application of styles:

    table. Rows [0]. Cells [0] .texts [0] .appliedCharacterStyle = "bold" / / If this style is present in your doc

    Jarek

  • Help with a script that detects the content in a cell and apply the cell style to line

    Hello


    I am trying to add an article to my table formatting script that is a cell with the word 'Budget' (but this can be written as ' Budget:' or ' Budget: (E) "- but without the speech marks) and apply the cell Style - SponsorCells - to all the cells of the whole line. I currently have on what it will, but it does not work:


    function checkWhichTable()
    {
    // ensure the user made a selection
    if (app.selection.length != 1)
    return null;
    var currentTable = app.selection[0];
    if (currentTable.hasOwnProperty("baseline"))
    {
    currentTable = app.selection[0].parent;
    }
    while (currentTable instanceof Cell || currentTable instanceof Row || currentTable instanceof Column)
    currentTable = currentTable.parent;
    if (!(currentTable instanceof Table))
    {
    // No table selected
    return null;
    }
    return currentTable;
    }
    app.doScript(checkUserSelection, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Process Table");
    
    
    function checkUserSelection ()
    {
    var a_table = checkWhichTable();
    if (a_table == null)
    {
    if (confirm("No table selected. Do you want to process *all* tables?") == false)
    return;
    allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    for (aTable=0; aTable<allTables.length; aTable++)
    {
    processTable (allTables[aTable]);
    }
    } else
    {
    processTable (a_table);
    }
    }
    function processTable(table)
    {
    // do something here!
    
    
    //Set 1st Row Height
    table.rows[0].height = "30mm";
    
    
    //Find Text in Cell and apply Cell Style to Row 
    var  
      myCellText=['Budget', 'Budget:', 'Budget: (E)'];  
     var myRegEx = new RegExp("^("+myCellText.join("|")+")$");
      for (i=0; i<table.cells.length; i++)
      {
        if (table.cells[i].texts[0].contents.match(myRegEx))
          table.cell[i].appliedCellStyle = "SponsorCells";
      }
    
    
    //end - do something here!
    }  
    


    I can get the script to apply the cell style to "SponsorCells" for each cell that contain the word 'Budget' etc, but I need cell ever on this line to have the cell style applied. I tried to re-write line 56 which applies the style to a cell, but I can't seem to make it work. Any help would be great.


    Separate on this issue, I would like to have a line of code similar to the 46 line, which sets the 1st height of lines, but I would like to say "If a cell has 'A cell Style' and then applies the value height 10 mm". If someone could result as a help of bonuses, things would be great double.


    Thanks in advance!

    But that could be painfully slow. To speed things up, follow these steps:

    var cells = table.cells.everyItem().getElements();
    for (var i=0; i
    

    It is faster, because it creates an array of cells with a call to table.cells, which is several times faster than calling table.cells. And before assigning to line 12mm height is useful to check if it is already 12 mm. checking things in InDesign and do things only when it is necessary is much more effective than simply doing things even if they are not necessary.

  • Apply the character style to the part of the paragraph

    I am inserting text in a block of text with the following code:

    story.insertionPoints [-1] .silence += pgfStr;

    story.insertionPoints [-1] .silence += "\t";

    story.insertionPoints [-1] .silence += refStr;

    story.insertionPoints [-1] .silence += "\r";

    I want to apply the character style to all of the text in refStr (only the part of this paragraph). I know how the syling paragraph applies to the entire paragraph, but not a character style. I should be grateful if you would help. Thank you!

    Hello

    Dan - BTP says:

    ... the size in points and attack can be different on each page...

    You are able to find a rule of these differences?

    ...

    What do depends on what type of rule could be defined

    ...

    The size of reference point that is 1.5 PT lower than the point size of the paragraph, whatever.

    Close to the end of the script, you can code for example:

         //     Your target is "reference" which is a text inbetween tabulator and end of story (or other criteria).
         //     So you could define:
    app.findGrepPreferences = null;      // just for clear it
    app.findGrepPreferences.findWhat = "(?<=\\t).+\\s\\Z";     //     to catch text following tab in last para of story
         //     and after:
    mFound = app.activeDocument.findGrep();
         //     so all desired text objects are in an array "mFound".
         //     you could iterate (backward) through it:
    len = mFound.length;
    while (len-->0)      //     ">0" in case of nothing found
         mFound[len].pointSize -= 1.5;
    
         //     whatever that is - is 1.5 smaller
    

    Jarek

  • Need to search and apply a character style sheet

    I have a directory with the name and address of the student. I need to find 2 returns and replace with 2 returns, apply the character style, back. Here is a screenshot so you can see what I mean screen.

    [Picture with private information removed by Moderator]

    Allen, Davis must be condensed ital "BOLD" like Ahmed, Ehsan is above. Any help appreciated.

    Post edited by: Peter Spier

    Right. I have the impression that there is. As always... may be wrong.

  • Help with a script to search for text in a table cell and apply the cell style

    Hello

    I build the script which Jongware wrote in his post here http://indesignsecrets.com/tackling-tables-through-scripting.php - I am trying to create a variable in which I can add a number of different parts of the text, in this case it's different parts of the United Kingdom i.e. 'London', 'East', 'Scotland' etc. I just need the script to apply the cell Style - 'District Cell' - to any cell that contains text in the variable. Here's the script, if anyone can help I would be grateful.

    function checkWhichTable()
    {
    // ensure the user made a selection
    if (app.selection.length != 1)
    return null;
    var currentTable = app.selection[0];
    if (currentTable.hasOwnProperty("baseline"))
    {
    currentTable = app.selection[0].parent;
    }
    while (currentTable instanceof Cell || currentTable instanceof Row || currentTable instanceof Column)
    currentTable = currentTable.parent;
    if (!(currentTable instanceof Table))
    {
    // No table selected
    return null;
    }
    return currentTable;
    }
    app.doScript(checkUserSelection, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Process Table");
    
    
    function checkUserSelection ()
    {
    var a_table = checkWhichTable();
    if (a_table == null)
    {
    if (confirm("No table selected. Do you want to process *all* tables?") == false)
    return;
    allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    for (aTable=0; aTable<allTables.length; aTable++)
    {
    processTable (allTables[aTable]);
    }
    } else
    {
    processTable (a_table);
    }
    }
    function processTable(table)
    {
    // do something here!
    
    
    //Find Text in Cell and apply Cell Style
    var textInCell=['London', 'Scotland', 'South West'];
    for (i=0; i<table.cells.length; i++)
    {
    if (table.cells[i].texts[0].contents==textInCell)
    table.cells[i].appliedCellStyle = "District Cell";
    }
    
    
    
    
    }
    

    Hello

    Change this feature:

    function processTable(table)
    {
    //Find Text (exactly as it is) in Cell and apply Cell Style
    var
      textInCell=['London', 'Scotland', 'South West'],
      mFound, cFound;
    
    app.findGrepPreferences = null;
    app.findGrepPreferences.findWhat = "^(" + cities.join("|") + ")$";
    mFound = table.findGrep();
    while( cFound = mFound.pop() )
      cFound.parent.appliedCellStyle = "District Cell";
    }
    

    Jarek

  • How to use GREP to apply the character style just for the first and the second line of the paragraph?

    as the title, I just want to ask how to apply the style of character just for the 1st and 2nd line of the paragraph. Help me pls, tks!

    Can you show the screen shot with the invisible market, looks like you feedback after each line.

    So, something like this would work where I have a return forced for the linebreak (shift + return). The example on the right does not work because the line break is a return:

  • Create Styles... and then the nesting styles

    Seems simple enough:

    say application "Adobe InDesign CS5.5.

    say active document

    put myCharacterStyle to do style of characters with properties {name: 'Year', size: 26.0, fill color: 'Paper', race color: 'Black', race weight: 0.75, fonts: "Helvetica" font style: "Black"}

    put myCharacterStyle to do style of characters with properties {name: "Years", size: 18.0, fill color: 'Black', line color:nothing, weight:race nothing, horizontal scale: 80.0, vertical scale: 80.0, fonts: "Helvetica", font style: "Black"}

    put myParagraphStyle to do paragraph style with property {name: 'Year'}

    put nested styles of myParagraphStyle to {{applied the character style: 'Year', rehearsal: 1, false inclusive: delimiter:any word}, {applied the character style: "Years", rehearsal: 2, inclusive true: delimiter:any word}}

    end tell

    end tell

    The police and the point size do not come through when the style is created. Nested styles are not as through.

    I tried the applied policies: "Helvetica" to get "font family is not available. Also: font 'Helvetica '...

    What I get just now I is no defined font or size. The rest works.

    So what I'm doing wrong here?


    Hi lithodora.

    as Mary Posner wrote a character style has the property 'do', but 'applied police' and 'make-style ".

    «... specified as font family name or an object are.»

    just look it up in the dictionary...

    Always try to work with references.

    Tell application "Adobe InDesign CS5.5"

    -You need to myHelvetica your needs!

    Set myHelveticas to (font family of each font whose name contains "Helvetica") - returns the helvetica font family names

    myHelvetica defined in article 1 of the myHelveticas - just choose randomly one for my example, in the hope there is a 'black' style ;-)...

    tell the active document

    myCharacterStyle01 to style character with the properties the value {name: 'test', size: 26.0, fill color: 'Paper', race color: 'Black', accident stroke weight: 0.75, applied the police: myHelvetica, font style: "Black"}

    myCharacterStyle02 to style character with the property value {name: 'tests', size: 18.0, fill color: 'Black', race color: nothing, stroke cerebral weight: nothing, horizontal scale: 80.0 vertical scale: 80.0, applied the police: myHelvetica, font style: "Black"}

    myParagraphStyle to style of paragraph with the properties the value {name: 'nextTest'}

    say myParagraphStyle

    do new style nested with properties {applied the character style: myCharacterStyle01, repetition: 1, included: false, delimiter: any word}

    do new style nested with properties {applied the character style: myCharacterStyle02, repeat: 2, inclusively: true, delimiter: any word}

    tell the end

    tell the end

    tell the end


  • How can I connect my Mac to a network server? As in windows yo go to my computer / connection to a network drive, and then you select a letter and write the name of the server that you want to be logged

    I'm trying to adapt Windows to my new MacBook Pro with OS El Capitan.

    I work remotely for a company and I want to connect my Mac to the server of the company.

    My question is how to connect a MAc to a network drive with the permanently available connection.  For example, in my old HP I went to my computer / connection to a network drive. I've selected a letter and note the name of the server that I wanted to be connected to. The connection was then shown with my other drive hard 'sections '; I want to say C:, D: (for recovery), e: (for tools) and then connecting to the external server has been shown with the selected letter.

    There is no "letter" under OS X. It's a hangover very old of BACK, devices of mapping and volumes labeled mailbox.

    If you are connected to your corporate network, you should see the available network volumes listed in the Finder, in ' my computer > network ", or with the command K to connect to a server.

    You can create an alias for the volume and put it in the Dock, or leave on the desktop or put it somewhere else, and the next time you want to connect to this subject, simply double-click on it. You can also add the server address to your "favourites" in the connect to Server dialog box.

  • My paragraph styles have disappeared and are now appearing as the character styles

    Working on a new site because my old site muse become buggy...

    and now, my paragraph styles have disappeared and are now appearing as the character styles

    Screen Shot 2015-10-13 at 5.07.55 PM.png

    Thank you for sending the files. One of the files does not contain any character or paragraph Styles. In the other, I see the character styles named as paragraph styles. All indications from within the file are that they were created as character styles. The file format includes indications of the type of the style as well on everything that they are applied and in the list displayed in the palette. All of these styles are indicated by styles of characters in both places. The attributes that are in the styles are limited to what is allowed in a character style.

    In some places where the styles are applied, they are applied to the blocks of text or widget and replacements parts for paragraph-level attributes (i.e. h1 tag, space before and after, etc.). This leads me to suspect that they have can be created from blocks of text pointer tool selections (or other elements of text in widgets) and it was perhaps accidental that they have created using character Styles where paragraph Styles Panel rather than the Panel?

  • Search for characters, nested and apply the Cstyle

    I have

    you want to find the nested applied characters and apply the Cstyle, but my capture of code all the text in a document. Can you please guide me,

    nestedreport();

    function nestedreport() {}

    myDoc var = app.activeDocument;

    var myDocPath = myDoc.filePath;

    var myDocName = myDoc.name;

    try {}

    app.findGrepPreferences = app.changeTextPreferences = null;

    app.findGrepPreferences.findWhat = "^.» + » ;

    myFind = myDoc.findGrep (false);

    var ntexts = new Array;

    for (i = myFind.length - 1; i > = 0; i--)

    {

    if(myFind[i].contents.nestedStyles==null)

    {

    ntexts.push (myFind [i]. Happy)

    ntexts.appliedCharacterStyle = "Nested";

    }

    }

    }

    {catch (e)}

    }

    Screen shot 2015-07-21 at 2.26.33 PM.png

    Hello

    I'm still somewhat struggled with the final goal, however to make a small step:

    To detect a string that is formatted using nestedStyle (part of the content of the paragraph), you can use this:

    assuming that ==> text is selected - say a paragraph

    var
      cCharStyle,
      charStyles = app.selection[0].characters.everyItem().appliedNestedStyles,
      step = charStyles.length,
      resString = "";
    
      while ( (cCharStyle = charStyles.pop() ) && step--)
           if ( cCharStyle.length )
                resString = app.selection[0].characters[step].contents + resString;
    
    alert ( resString );
    

    Jarek

  • How can I leave second column applied to the character style "ITALIC".

    Hello world

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

    Like this:

    UI035.jpg

    Thank you

    John

    Select the table and run the script below:

    App.Selection [0]. Columns [1]. Select();

    App.Selection [0].texts.everyItem () .appliedCharacterStyle = "ITALIC".

    Vandy

  • link to an interactive report AND apply the filter for 2 items.

    Hi can you help me out here on how to create a link to an interactive report AND apply the filter for 2 items.

    Here is my code

    I have a list of table, clicking the selected item should link to interactive report and create the filter. Below the code does not work for a filter. can you help me what to do with 2 filters.

    A filter = > works very well

    sys. HTP.p ("< ul class =" uChartList"> ');

    sys. HTP.p ("< class li =" uNumber uGrid col_2 col_sart"> ');

    sys. HTP.p ("< a href =" "|") sys. HTF.escape_sc ('f? p ='|: APP_ID |': 0 0 :'||: APP_SESSION |':00:P00_XXX:000, RIR:IREQ_XXX:Test :') |) » » >') ;

    sys. HTP.p ("< class =" uValue"> ' | l_tester |) ("< / big >");

    sys. HTP.p ("< small class =" uLabel"> < /small > Tester ');

    sys. HTP.p ("< /a > '");

    sys. HTP.p ("< /li >" ");

    Scenario 2:

    Two filters = > does not

    sys. HTP.p ("< ul class =" uChartList"> ');

    sys. HTP.p ("< class li =" uNumber uGrid col_2 col_sart"> ');

    sys. HTP.p ("< a href =" "|") sys. HTF.escape_sc ('f? p ='|: APP_ID |': 0 0 :'||: APP_SESSION |':00:P00_XXX:000, RIR:IREQ_XXX:Test:P00_YYY:001:IRC_YYY:test2 :') |) » » >') ;

    sys. HTP.p ("< class =" uValue"> ' | l_tester |) ("< / big >");

    sys. HTP.p ("< small class =" uLabel"> < /small > Tester ');

    sys. HTP.p ("< /a > '");

    sys. HTP.p ("< /li >" ");

    Thanks in advance

    actually the syntax wrong values in the syntax of the passes to several elements.

    is

    f? p = 6000:6004: & APP_SESSION. : NO:6003:MY_ITEM1, MY_ITEM2, MY_ITEM3:1234, 5678

    Use above scenario and verification.

    Go

  • Unable to apply the class style to the line of the table?

    created a class style with pad of 10px on only right & vertical alignment at the top.

    I want to apply this class to a table row - but when I do - I get the correct vertical alignment - but none touch.

    If I apply the same class style to each td cell - then the alignment and buffer work.

    I have a stupid mistake? There are 40 cells of td in the rank - so it would be more quickly just to apply the class to the whole line. any ideas what I am doing wrong? much thanks in advance.

    And by the way, the best way to proceed would be next, using a
    descendant selector-

    .padThis td {vertical-align: top; padding: 10px ;}}

    ...


    Now, all thetags thatwill be filling and alignment
    you want.

    --
    Murray - ICQ 71997575
    Adobe Community Expert
    (If you * MUST * write me, don't don't LAUGH when you do!)
    ==================
    http://www.projectseven.com/go - DW FAQs, tutorials & resources
    http://www.dwfaq.com - DW FAQs, tutorials & resources
    ==================

    "dextre manika" wrote in message
    News:gnauf0$NKT$1@forums. Macromedia.com...
    > created a class style with pad of 10px side right only & vertical
    > alignment to
    > top.
    >
    > I want to apply this class to a table row - but when I do - I get correct
    > vertical alignment - but no key.
    >
    > If I apply the same style of class to each td cell - then the two alignment and
    > pad
    > work.
    >
    > I have a stupid mistake? There are 40 cells of td in the row - so he
    > would be more quickly just to apply the class to the whole line. any ideas what I am
    > making
    > evil? much thanks in advance.
    >

  • What computer privileges must install and apply the updates for Creative Apps clouds using Windows 7?

    What computer privileges are required to install and apply the updates for Creative Apps clouds using Windows 7?

    When you work for a company that controls the software installed on your computer, it is important to know if IT supports is necessary to install and apply the updates when updates are available.

    It is important to know this information before you buy.

    Thank you for your support.

    ~ Paul Miller

    admin command is required for installation or any changes made to the software from your computer.

Maybe you are looking for

  • Satellite Pro A120 battery problem

    Hi all I have a portable Satellite Pro A120 and is a battery problem a month ago.The battery is not new, but recently changed, 6 months ago.Until a few weeks ago, it lasted about 2 hours when full load, until this timesuddenly dropped 30-40 minutes.I

  • the pointer to int as a parameter in the dll, but the value of parameter variation doesnot

    Hello, I have a function in the dll as void set(int * a) {(* a) = 99 ;}} And I connect an int32 to the dll. But when I run the vi, the Int32 value does not change. As the picture below:

  • event data for the asynchronous timer

    My application uses an asynchronous timer to read analog and digital signals that are then loaded in a thread safe queue. The main part of the application unloads the queue, displays values and updates the locations of graph and also writes data to a

  • I am unable to run Disk Defragmenter.

    When I try to defragment I get an error message that says: "cannot run because Disk Defragmenter scheduled Chkdsk /f..  If please run Chkdsk and try again. "I tried to run Chkdsk, nothing helps.  Can anyone help?

  • HP Pavilion dv6-6c35dx: CD player does not

    My cd player does not work and this is the message I get from Device Manager. Windows cannot start this hardware device because its information of configuration (in the registry) is incomplete or damaged. (Code 19)