Cell Styles with a script

Is there anyway to style table cells with a script, I can't fine any answers, all I'm after is to add a one cell style to the header row, then a different cell style to the rest of the table?
is it even possible, any pointer would be great?
Many thanks!

Hi Harbs
Thanks for your reply, I am new to this, and am finding it hard, if you have any example scripts I can have a look at that would be great.
Many thanks,
jamb

Similar Messages

  • Maintaining Cell Style with data update

    Having a difficult time trying to maintaining the styles and characteristics (built in ID) of a table from Excel when we update the link to refresh the data.  I have read old threads and went through the proper process of creating; Character, then Paragraph, then Cell Styles, then a Table style but no luck with the Table style. (Like the example in the video; which I agree don't believe it fully works)  But even just using Cell Styles, the data, when updated, is reverted back to it's original plain input and you manually have to apply the Cell Styles.
    How can I prevent having to manually do that process/ get the Table Style to work?  Is there a setting or check box that need to be checked when importing the data or relinking/updating the file?  Please help....using CS3.
    thanks,
    Ed

    What options are you using when Placing the file? From Help http://help.adobe.com/en_US/InDesign/6.0/WSa285fff53dea4f8617383751001ea8cb3f-6f41a.html:
    Formatted Table
    InDesign tries to preserve the same formatting used in Excel, although the formatting of text within each cell may not be preserved. If the spreadsheet is linked rather than embedded, updating the link will override any formatting applied to the table in InDesign.
    Unformatted Table
    The table is imported without any formatting from the spreadsheet. When this option is selected, you can apply a table style to the imported table. If you format text using paragraph and characters styles, the formatting is preserved even if you update the link to the spreadsheet.
    Unformatted Tabbed Text
    The table is imported as tab-delimited text, which you can then convert to a table in InDesign or InCopy.
    Formatted Only Once
    InDesign preserves the same formatting used in Excel during the initial import. If the spreadsheet is linked rather than embedded, formatting changes made to the spreadsheet are ignored in the linked table when you update the link. This option isn’t available in InCopy.
    I never use linked Excel files, but it looks to me like you should be using the second option: Unformatted Table.
    Ken

  • How to apply style with grep script to finding question mark

    app.findGrepPreferences = app.changeGrepPreferences = null;      
    app.findGrepPreferences.findWhat = "\?";
    //app.findGrepPreferences.SpecialCharacters = SpecialCharacters.QUESTION_MARK;
    app.findGrepPreferences.appliedParagraphStyle = "myParS";
    app.activeDocument.changeGrep(); 
    app.findGrepPreferences = app.changeGrepPreferences = null;

    Put one more "\" in front of "?".
    and to appy "myParS" style,
    app.findGrepPreferences.appliedParagraphStyle = "myParS"; this line should be changed to app.changeGrepPreferences.appliedParagraphStyle = "myParS";

  • Cell style script not working in CS6

    I picked up the following script from the forum that is supposed to apply cell styles that I created to various cells.
    01.var myTable = app.activeDocument.stories.everyItem().tables;
    02. for (var n=0; n < myTable.length; n++){
    03.//~ myTable[n].appliedTableStyle = “NewTable”;
    04.//~ myTable[n].cells.everyItem().appliedCellStyle = app.activeDocument.cellStyles.item(“[None]“);
    05.//~ myTable[n].cells.everyItem().clearCellStyleOverrides (true);
    06.
    07.// Please check the table cell styles name is correct or not?
    08. var myActiveTable = myTable[n];
    09. myActiveTable.rows.itemByRange(0,-2).cells.everyItem().appliedCellStyle = “TTable_AA_Tint”;
    10. myActiveTable.rows[0].cells.everyItem().appliedCellStyle = “Table_Title”;//First Row
    11. myActiveTable.rows.itemByRange(-2,-1).cells.everyItem().appliedCellStyle = “Table_AA_Tint”;//Last Row
    12. }
    Whenever I run the script, I get the following message. Can someone please tell me what I need to change or fix? Any feedback would be highly appreciated
    JavaScript Error!
    Error Numnber:25
    Error String: Expected:;
    Engine:main
    File C:\Program Files (x86)\Adobe\Adobe InDesign CS6\Scripts\Scripts Panel\AutoFormatTablesWithCellStyles.jsx
    Line:2
    Source: 01.var myTable=
    app.activeDocument.stories.everyItem().tables;
    Offending Text:myTable

    Laubender, I am hoping you can help me with another question. How do I specify a specific cell to apply a specific cell style to. If I have a table with 3 columns and 3 rows and need to apply a different cell style to EACH of the 9 cells, what numbers do I change? I was able to figure out how to style various rows but want to apply to a specific cell. Thanks in advance.

  • Issue with cell styles in Smart View 11.1.2.1

    Hi,
    I've got a strange issue in Smartview 11.1.2.1 : when I open a data form (Hyperion Planning connection), my data form does not have colors. All the entire sheet is in Black&White, so I can not see Locked/Read-Only/Writable (...) cells !
    When I go to Options => Cell Styles, I do not see all the color-coding that is normally purposed by default with Hyperion Planning connection.
    Something strange : when I connect to Smartview on other computer, it works ! For information, we use Citrix to connect to Smartview.
    Do you have an idea ?
    Thanks.
    Virgile.

    Hello
    I have played around and found the following
    1. if you untick 'Use Excel Formatting' in the Formatting tab - cell styles work
    2. If you tick Use Excel Formatting- cell styles have no effect
    You cannot use Cell Styels and use excel formatting together - either the one or the other
    By ticking 'Retain Numeric Formatting' under Formatting combined with Cell Styles is a workable option
    Thanx
    Berndt

  • Script to apply cell style after search for paragraph

    Hello,
    can somebody help my do a script to search for all occurences of a paragraph format in tables and then apply a cell style to the enclosing cell for a document.
    Thanks in advance.
    Peter
    BTW Mac InDesign CS 6

    Hi,
    use this:
    var mDoc = app.activeDocument,
    pST = mDoc.paragraphStyles.item("paraStyleName"),
    cST = mDoc.cellStyles.item("cellStyleName"),
    mFound, mParent, count;
    app.findTextPreferences = null;
    app.findTextPreferences.appliedParagraphStyle = pST;
    mFound = mDoc.findText();
    count = mFound.length;
    while (count--) {
         mParent = mFound[count].parent;
         if (mParent.constructor.name == "Cell")
              mParent.appliedCellStyle = cST;
    app.findTextPreferences = null;
    edit paraStyleName and cellStyleName
    Jarek

  • Bug in formatting Tables with cel styles + toolbox

    We continue to have major problems with the cel styles. Lines disappear due to adjacent cells.
    Let me ellaborate:
    I have a cel style that has no background and only a .5 line at the bottom.
    Underneith I have a cel style that has NO lines. What happens is that when I link that style, the line from the cel above disappears. Then I reselect the top cel and link the correct style again, the line appears.
    This is obviously a totally unworkable situation.
    What helps 80% of the time, is to go in the options menu for the style. Then give all lines 1pt, black and a style. And then, in exactly this order, delete the linethickness, set the color to ignore and then set the style to ignore (ignore is a translation from Dutch, I do not know the exact term used in the US version). After this I save the style and usually it works.
    This bug has been a part of InDesign since the introduction of celstyles.
    And while I am ranting, another thing that has been irritating us since the early days. Quite often multiple styles in the panels seem selected. This happens in all panes (paragraph, type, cell and table styles)
    It seems to us that Adobe is only paying attention to adding new features, instead of fixing well known bugs.
    Does anyone have a solution to my issues?
    Any help is well appreciated.

    My original post wasn't too clear (sorry). The bug is with TR.
    The following code should write the numbers 1 to 10 with four spaces separating each value. But no spaces are written.
    program tst2
    integer :: i
    do i=1,10
    write(10,'(I4)',advance='no')i
    write(10,'(TR4)',advance='no')
    end do
    close(10)
    end program tst2
    In fact the file fort.10 which is produced contains
    12345678910
    Whereas, with gfortran, open64, ifort, nag Fortran compilers I get (there are four spaces, this forum just doesn't show them all):
    1 2 3 4 5 6 7 8 9 10
    Edited by: davidb on 16-Oct-2011 15:07

  • A script to apply cell style to entire rows containing a specific text

    Hi,
    I am using InDesign CC 2014
    Does anyone know how to apply a cellstyle based on text contents found in a cell in javascript?
    I need to search the document and change cell style in entire row to "cellStyle01" if the text "someText" appear in cell.
    I've found similar script here in forum which apply table style, but don't know how to change it to apply 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"); 
    Thanks!

    Hi,
    Try this,
    var doc = app.activeDocument, 
        _tables = doc.stories.everyItem().textStyleRanges.everyItem().getElements(), 
        i, j, k, l, a, _rows,_cells, rowlen; 
    for(i =0;i<_tables.length;i++) 
        for(j =0;j<_tables[i].tables.length;j++) 
            _rows = _tables[i].tables[j].rows; 
            for(k =0;k<_rows.length;k++) 
                _cells = _rows[k].cells; 
                for(l =0;l<_cells.length;l++) 
                    if(_cells[l].contents == "someText") 
                        rowlen = _cells[l].parent.cells.length; 
                        while(rowlen--) 
                              _cells[rowlen].appliedCellStyle = doc.cellStyles.item("cellStyle01"); 
    Regards,
    Chinna

  • How to get the name of a cell style

    Hi, All,
    I have a question about how to get the cell style name used by each cell in a table.
    I looked at all the fonctions provides by: ICellStylesFacade and ITableStylesFacade, but I did not find the fonction I need.
    Can someone give me some advises?
    Thanks in advance!!

    String myFileName = request.getRequestURL().substring(request.getRequestURL().lastIndexOf("/")+1);
    or with javascript
    <H1><script>document.write(document.location.href.substring(document.location.href.lastIndexOf("/")+1))</script></H1>
    bye! :)

  • How to apply a table cell style based on grep search?

    Anyone that know how to make a script that searches in an Indesign table for
    -> All cells where the text starts with "Banana"
    -> And apply cell style "Yellow" to these cells?
    I have been searching on forums for somedays and got this tip: https://github.com/seuzo/regex_cellstyle/blob/master/regex_cellstyle.jsx
    -> But that script is in japanese and also use dialogs.
    All help most appriciated!

    Hi Frankeman,
    Please try the below code, may it should be helpful:
    var myDoc = app.activeDocument
    app.findTextPreferences = app.changeTextPreferences = null
    app.findTextPreferences.findWhat = "Banana"
    var myFound = myDoc.findText()
    for(i=0; i<myFound.length; i++)
        if(myFound[i].parent.constructor.name == "Cell")
       myFound[i].parent.appliedCellStyle = "Yellow"
    Suppose the code is working fine for you, then please click correct answers.
    thanks
    Beginner_X

  • Find a specific paragraph style within a table and apply a specific cell style?

    I'm a total beginner when it comes to scripting, but I would like to create a script that finds the paragraph style "resultsUL" within a large table and applies the cell style "female". Sure wish the find/replace was able to account for cell styles as well as paragraph and character styles. Is anyone willing to help me with this? Thank you!

    Hi,
    I do it quickly defining a simple research on the "resultsUL" para style and using a loop with QuicKeys as:
    Cmd-0 is a shortcut associated to the "female" cell style.
    So, What I do: search the para style (Cmd-option-F) and apply the cell style, then search again…
    As easy to do with QuicKeys, I think that can be easily done with a [JS] (faster process!).

  • How do I add cell-style wireless to my iPad 2?

    When I bought my iPad 2 it was set up for wifi, but not for the same kind of wireless iteret connection I get with my cell phone? Now I want to add that, but when I called the phone company, they said my iPad 2 didn't have an "IMEI" number. Can I add whatever it takes to my iPad 2 to get cell-style wireless connections to the interet? Thank you.

    You do not connect it to the device at all. It is free standing. My MIFI2200 is about the size of a deck of playing cards. It's just like having a "non-wired" mobile router at your disposal. I just keep mine in my shirt pocket, or place it on the table next to me.
    There are rechargeable as well, or you can even charge in a wall socket them while using them if you like.
    Take a look at some of these.
    https://www.google.com/search?q=MIFI2200#hl=en&spell=1&q=MIFI+2200&sa=X&ei=-jWQU Mm9CIeB0QHQ8YHoDA&ved=0CB4QBSgA&bav=on.2,or.r_gc.r_pw.r_qf.&fp=f2e38c1d654cf6c9& bpcl=36601534&biw=981&bih=603

  • How do you have the bottom stroke of a table show up using Table Styles and Cell Styles only?

    I am using InDesign CS6, and I want to create a Table Style that has the bottom stroke show up, but does not have a table border, such as:
    However, whenever I try to change the Table or Cell strokes so that the last stroke shows up, I get the entire table border, or some strange combination of borders:
    Does anyone have any insight on how I can get the bottom stroke to show up while preserving my other stroke properties? Since I work with long documents, it's necessary to be able to control all of my tables through Table Styles and Cell Styles, and not by manually changing each and every table with the Stroke palette.
    For reference, here are the my current Table Style properties and the resulting table:

    Michael Murphy is the InDesign style-meister. He wrote "Adobe InDesign Styles" for Adobe Press, and did a great Lynda.com title on InDesign styling. Here's what he says in the book:
    "As mentioned at the beginning of this chapter, with all the power of table and cell styles, it is important to understand not only how they work and what they can do for you, but also to understand their limitations.
    "Two formatting features missing in table and cell styles have already been discussed: You will always have to set the column width and row height of cells when applying a table style for the first time, and you will always have to convert body rows to header and/or footer rows every time you apply a table style for first time or update the table's data....
    "But there's another kind of limitation that's important to keep in mind as you are designing tables: It is very easy to design a table that cannot be completely defined by a table style. In many cases, you'll need to define an extra cell style or two that lets you complete for formatting. [my emphasis]."
    So I think that's what you have to do: Apply another cell style on top of the cells at the bottom of the table after applying the table style.

  • How can I insert a new table whose cells are linked to Cell Styles?

    How can I define a Table Style so that cells in new tables are automatically linked to my Cell Styles? (Not sure if "linked" is exactly the appropriate word....I'm going for "connected in such a way that when the Style is changed, the character/paragraph/cell/table/object updates to reflect the change.")
    I thought the whole point of using Cell Styles in Table Styles would be so the cells can be automatically linked to the desired Cell Styles when the table is created -- but that isn't happening for me. I don't know if I'm just confused or if this is a bug:
    When I insert a new table of a Table Style I have defined, it seems all cells in the new table are simply linked to Cell Style [None], with overrides for each cell that are consistent with the applicable Cell Style as it was defined when the table was inserted. So although the appearance of each cell is consistent with the Cell Style I defined for for that region of the table, the cells don't update if I later make changes to the Cell Styles I defined.
    (If, after inserting a new table, I manually select each cell and apply the desired Cell Style, then the cells do (of course) update when I change the Cell Styles.)
    Is it possible to have cells be actually linked to Cell Styles when a new table is inserted, instead of cells being simply linked to style [None] with overrides?
    (I'm using the up-do-date 2014 release of InDesign CC, in case that's relevant.)

    there is a example on Page 1149 of book Graphic Java 2 mastering the JFC
    by David M. Geary. ISBN: 0-L3-079667-0, Try to take a look the code. It will help.

  • Allow XML export of cell style information

    The XML formatting using namespace attributes for tables is extremely cool. For importing anyway.
    Today I've got a bunch of fairly complex, manually created tables that I'm creating an XML structure for. I need to export the resulting XML as an example for a programmer, who will create a script that will allow me to take external data and wrap it in the 'aid5' namespace table tags. I can then import tons of data and have it autoflow into my document in a format that matches the tables that I've developed manually.
    Unfortunately my table structure and data display relies on a bunch of specific cell styles. The XML export works beautifully in providing the overall structure and table dimensions. It can even output the paragraph styles for the data, which is sort of helpful. But it totally omits the crucial cell style data that is necessary for strokes, padding backgrounds, etc. I'm still not sure how I'm going to get that in there.
    Hopefully this is not too unusual an application to warrant the option to export cell and table style data.
    I'm still using CS3, so pardon me if this has already been addressed. If not though, please consider it, thanks!

    David,
    Are you trying to export user (SYS and SYSTEM) as well into an XML file? or are you trying to get all of one schema into a XML file?
    One possibility:
    You could create an interim table which contains the tablenames.
    create table interim as select table_name from dba_tables where owner = 'OWNERNAME';
    Then in your program read this interimtable into a cursor and loop through it using the variable in place of your hardcoded 'select * from table1' in the DBMS_XMLQuery.newContext
    You would then need to append result1 to result1 plus new query context for the clob.

Maybe you are looking for