The other style of cell lines

I need to apply the cell style for an alternative line for all tables. But the code below does not correctly how to solve this problem

var doc = app.activeDocument,

_tables = doc.stories.everyItem ().tables.everyItem () .getElements ();

for (var i = 0; i < _tables.length; i ++)

{

var _rows is _tables [i] Rows;.

for (var j = 2; j < _rows.length; j += 2)

{

_rows [j].cells.everyItem () .appliedCellStyle = "TableBody1";

}

}

Table.PNG

Hello

If code should target a specific range of rows in the table.

Through the cells in column 1

==> from the selected line

==> select as many rows as many current . cell rowSpan property says

==> apply cellStyle on this range of cells.

That is like this:

var
  mDoc = app.activeDocument,
  mTables = mDoc.stories.everyItem().tables.everyItem().getElements(),
  rowsToOmit = 1,     //     how many rows to exclude
  rowIndexToStart = 1,     //     which row is the starting one to apply a style
  mStart, mEnd, step,
  mTables, cTable,
  cCell, cSpan, cRange,
  mCellStyle = mDoc.cellStyles.item("TableBody1");

  while ( cTable = mTables.pop() ) {
       mCells = cTable.columns[0].cells.itemByRange(rowsToOmit,-1).cells.everyItem().getElements(),
       for (step = rowIndexToStart; step < mCells.length; step +=2) {
            cCell = mCells[step];
            cSpan = cCell.rowSpan - 1;
            mStart = cCell.parentRow.index;
            mEnd = mStart + cSpan;
            cRange = cTable.rows.itemByRange(mStart,mEnd).cells.everyItem();
            cRange.appliedCellStyle = mCellStyle;
            }
       }

Jarek

Tags: InDesign

Similar Questions

  • V10.2 has 2 of the same clip hit the other with a green line in the middle. Help!

    Hello

    My flash drive was working fine then all of a sudden on any browser, I tried Google Chrome, IE, Firefox and Opera, he plays the clip but has 2 of the same clip crushed on the other (so that you try to watch a movie on a 4:3 ratio 16:9 aspect ratio) & he has a brilliant green stripe between the 2 collars to... I tried to uninstall and reinstall but it still it! It does on any website I tried to watch the clips on & it's driving crazy me!

    PLEASE HELP IF YOU CAN, I WILL BE ETERNALLY GRATEFUL!

    First thing to try: disable hardware acceleration (Flash Player settings).

    If this does not resolve the problem, provide more information, i.e. your OS & version.

  • Try to give the other a ListField coloring line

    I want to substitute a ListField coloring online.

    I've implemented a ListField and the drawListRow ListFieldCallback, I have the following:

          public void drawListRow(ListField list, Graphics g,                                    int index, int y, int w) {           if(index % 2 != 0)          {               g.setColor(0xB2FFED);               g.fillRect(0, y, w, list.getRowHeight());               g.setColor(0x000000);               list.invalidate(index);         }                       String text = (String)listElements.elementAt(index);            g.drawText(text, 0, y, 0, w);           }
    

    It works, but he also painted the selected item with the color I put.  I want to continue to paint the selected item with the system-defined color.  I tried to add a check for list.getSelectedItem! = index, but that doesn't seem to work very well.

    Is there an example of what I want to do?

    Hi rgelb1,

    I think this KB Article How To - create a ListField color is what you're looking for, he explains how to draw some fields with color while keeping separate highlighting. I hope this helps, if not I will help you with the necessary code.

    Concerning

    André

  • 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

  • change the line style for cell None

    Hi expert,

    How to change the line style for cell to zero.

    Respect of

    John

    my_cell.topEdgeStrokeColor = app.activeDocument.swatches.item("None");
    my_cell.leftEdgeStrokeColor = app.activeDocument.swatches.item("None");
    my_cell.bottomEdgeStrokeColor = app.activeDocument.swatches.item("None");
    my_cell.rightEdgeStrokeColor = app.activeDocument.swatches.item("None");
    

    Do not test, but should work.

  • A script to apply the style of cell to whole lines containing specific text

    Hello

    I use InDesign CC 2014

    Does anyone know how apply a cellstyle based on the content of text found in a cell in javascript?

    I need to find the document and change cell style in the entire line to 'cellStyle01' If the 'etc' text appears in the cell.

    I found a similar script here to the forum which apply the table style, but do not know how to change it to apply the cell style!

    var curDoc = app.activeDocument;
    var allTables = curDoc.stories.everyItem().tables.everyItem();
      
    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.findWhat = "someText";
    var allFounds = allTables.findText();
    app.findTextPreferences = app.changeTextPreferences = null;
      
    for ( var i = 0; i < allFounds.length; i++ ) {
    var curFound = allFounds[i];
    if ( curFound.length == 1 ) {
    var curFoundParent = curFound[0].parent;  
    // curFoundParent.parent.appliedTableStyle = curDoc.tableStyles.itemByName( "tableStyle" );  
    curFoundParent.parent.appliedCellStyle = curDoc.cellStyles.itemByName("cellStyle01");  
    }
    }
    
    

    Thank you!

    Hello

    in this new case, you can't just change the last line, because yo I want to find not the entire table and lines and cells.

    Try this modified version:

    var curDoc = app.activeDocument;
    var allTables = curDoc.stories.everyItem().tables.everyItem(); 
    
    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.findWhat = "some Text";
    var allFounds = allTables.findText();
    app.findTextPreferences = app.changeTextPreferences = null;
    
    for ( var i = 0; i < allFounds.length; i++ ) {
        var tableFound = allFounds[i];
        if ( tableFound.length > 0 ) {
            for ( var j = 0; j < tableFound.length; j++ ) {
                var curFound = tableFound[j];
                var cellsInRow = curFound.parent.parentRow.cells.everyItem();
                cellsInRow.appliedCellStyle = curDoc.cellStyles.itemByName( "cellStyle01" );
                cellsInRow.clearCellStyleOverrides( true );
            } // end for
        } // end if
    } // end for
    
  • an alphabet by typing in a cell gives drop down suggestions from previous hits on the same column. But how the drop down to choose the suggestions of the other columns and other sheets.

    an alphabet by typing in a cell gives drop down suggestions from previous hits on the same column. But how the drop down to choose the suggestions of the other columns and other sheets.

    Hi mdsavol,

    Your observations are accurate. The 'suggestions' are previous entries in the same column that correspond to what has been entered so far in the active cell. The only direct user control is to activate the function turn on or off in numbers preferences > general.

    There are other ways to include or exclude items of suggestions:

    • To remove typos in the suggestions list, the user must correct the typos in the cell above the active cell. If they are more in the list, they won't be presented as suggestions.
    • To include selections added to the list, the user must enter these suggestions in the individual cells above the active cell and column where they are wanted as suggestions.

    There was a request here a while there is a list of suggestion 'live' similar to those of some websites, which offers a descending list of possible entries as a type in an input box.

    The only way I see to reach a solution similar to what you have asked is to use as many lines at the top of the non-en-tete of the table section to list the items likely to repeat in your table, and then hide the lines. You'll need a list for each column where you want to use this feature with a list previously planted. Existing items will then require a likely hit up to three, then a click to choose from a list small enough to enter a value into a cell. News he will need to enter in full the first time, but after that it will be put on the list and answer the same thing as the terms preseeded.

    While your setting upward (or decide not to do), consider going on the menu of number (in numbers), choosing to provide feedback from numbers and writing a feature in Apple request. Describe what you want. Explain how he could help the average user numbers, and then hope for the best.

    Kind regards

    Barry

  • I want to create a 2 cells in demand for numbers, the 1st cell is a dropdown menu with items of text, when choosing an item, that it would be represented by a numeric value in the other cell. How can I do?

    I want to create a 2 cells in demand for numbers, the 1st cell is a dropdown menu with items of text, when choosing an item, that it would be represented by a numeric value in the other cell. How can I do?

    You can use vlookup() like this:

    (1) crate a table like this:

    the first line is a heading row

    the first column contains the same list of items in the context menu

    the second column contains the corresponding values

    name of the table 'value '.

    In another table (where the pop-up menu), you can use the table of choice of 'Value' like this:

    create a drop-down list in cell B1

    Select cell C1 and type (or copy and paste) the formula:

    = VLOOKUP (B1, Value::A:B, 2, 0)

    short hand for this is:

    C1 = VLOOKUP (B1, Value::A:B, 2, 0)

    now change the pop-up to display the value in the change of cell C1

  • How can I move pages from one document to the other without merger of paragraph styles?

    I want to create a singular indesign file of 2 separate documents, which allows me to make an interactive PDF of it.

    However, when you move pages from one to the other, it seems that when each document has a paragraph style with the same name, they merge. The problem is that text is then adjusted if the styles do not match completely.

    Is there a way to merge the documents without any formatting changes?

    Create a Style group in each document and move all styles in this file. Give each document a different name. Do it with all kinds of styles: paragraph, character, objects, tables and Cell Styles. Then you can sort them later in the merged document what you do with these styles.

  • Cell styles missing cell styles in the palette

    Last Friday, I have created a table style and a certain number of cell styles & part of my starting indesign setting initial and included as part of a document and a document template.

    This morning (Monday) when I open Indesign, I noticed my cell styles palette was empty - there is nothing listed here or selectable somehow. Yet the range of styles of table shows the table that I created and when I look at that I noticed that all cell styles, that I created. More later if I try to edit a cell style in the style of table the list and I would select all cell styles that I created last week even though they do not appear in the palette cell styles.

    I tried to delete Indesign Defaults and AppPrefs.xml nothing works. I tried to create new cell styles, but they disappear immediately after creation - the palette remains empty cell styles. I tried to import the model & document styles that I created last week - nothing. I tried to export my model to IDML & reopening; still no go. I checked all paragraph and character styles used by the cell styles and they are present. Nothing seems to work.

    Has anyone else encountered and/or solved this problem?

    Hi again Peter.

    Not sure if it will work or not because I discovered a solution to the problem just before reading your response. When I clicked on the dual turns up and down the arrow on the tab name range to force the palette to expand & contract cell styles suddenly reappeared. As an additional measure, I just went and deleted the file SavedData so just in case where it was corrupted and would create other problems. Problem seems to have been resolved

  • 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

  • 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.
    >

  • Why Apple can't do two systems? First of all, we are protected, and the other is free just like android, but in the style of the iOS and Apple needs a request so we can manage and see new products from an application and do not go on this site!

    Why Apple can't do two systems? First of all, we are protected, and the other is free just like android, but in the style of the iOS and Apple needs a request so we can manage and see new products from an application and do not go on this site!

    and I don't know that if Apple make a system more freely, there no need for any device on Earth but iPhone.

    http://www.Apple.com/feedback/

  • NB100: Line-In/Mic-In - how to pass from one to the other?

    Hi everyone - lists of specifications more list entry on the NB100 as an audio Mic-In/Line-In, but I can't find an option to go to the line.
    I would like to be able to record audio with an external preamplifier, therefore the Line-In input, would be really useful.

    Is it just the input that is activated when enabling/disabling gain/sensitivity between Mic-In/Line-In?

    The Mic-In volume would be the same as the change of Line-In?

    Any ideas?

    Thanks in advance :)

    Hello

    In your case you should take a look in the user manual.
    The user manual says that this laptop supports and taken headphone and Microphone jack.

    The mic jack is a standard 3.5 mm jack, and it allows the connection of a microphone or the other device to an audio input.
    This means that you do not need to change anything. Simply plug the connector of right to take.

    Good bye

  • get a dotted line around .swf files in my flash site now. This is new from Firefox 3. With the help of 4 on a MacBookPro. tried the fix "style no outline. does not work. any help?

    Question
    get a dotted line around .swf files in my flash site now. This is new from Firefox 3. With the help of 4 on a MacBookPro. tried the fix "style no outline. does not work. any help?

    Ah, quite understand now that I added to my doc html

    < style type = "text/css" >
    {body
    background-color: #FFF;
    }
    "'object {outline: none ;}"} '

    < / style >

Maybe you are looking for

  • Lightning iPhone headphone 7 drop connection

    I have a new iPhone 7 (128GB, model MNAJ2LL/A - Verizon), and I have questions with the help of headphones of lightning. At this point, I tried: the Atria of lightning accompanying Bose QC20i with the dongle of helmet Bose SIE2i with headphone dongle

  • Compaq Presario: Card mother SR5050NX update using SP37378.exe

    Help, I need an exe file to return the BIOS on my Compaq Presario, model SR5050NX, product number RX897AA-ABA, build software 72NAv3PrA2 to the specification of the manufacturer. The BIOs vendor is Phoeniz, release date: 20/04/2007, version of BIOs 5

  • sit adobe zinsou

    Make program paymentsBut the program can't be downloadedHotline hours are notI have now this program is needed now

  • Failure of the Adobe Pixel Bender Toolkit 2.5 update

    HelloMy hard drive is dead and I must reinstall completely, including the suite Adobe CS5 Extended. Before the accident, everything worked fine, but now I get a message from MAO that Adobe Pixel Bender Toolkit 2.5 update failed because 'there was an

  • It cannot process payment!

    I just spent 7 days with adobe "customer support".  And can not get my cc to be charged via credit card or Paypal.My subscription has expired due to don't find them how to process a payment, even if my credit card and pay pal accounts to make payment