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

alternate row shading in tables

Explorer ,
Aug 20, 2014 Aug 20, 2014

Hi,

I am working in financial tables. the tables having alternate row colours.

I have applied cell styles to all table body rows. In additionally  i need alternate row colors in all tables, in table style alternate row option not working. but once i remove the cell styles in body rows it will working.

Can any one please give me a solution regarding this issue?

TOPICS
Scripting
1.1K
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

Explorer , Aug 22, 2014 Aug 22, 2014

Hi,

I am working in financial tables. i need script for the below requirement. any one suggest.

For all tables from second column onwards ""Tbody_rightalign" paragraph style. and all parenthesis values should be "Tbody_bracket" style, but these changes to be omitted in first rows because column head having separate style.

Picture 1.png

Translate
Enthusiast ,
Aug 20, 2014 Aug 20, 2014

Try this,

var doc = app.activeDocument,

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

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

{

        var _rows = _tables.rows;

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

        {

                _rows.fillColor = doc.colors.item("red");

            }

    }

Regards,

Chinna

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
Guru ,
Aug 21, 2014 Aug 21, 2014

I think this is what you want

var doc = app.documents.add(),

    tf = doc.pages[0].textFrames.add({

        geometricBounds: ["12.7mm", "12.7mm", "100mm", "197.3mm"],

        contents: "Head 1\tHead 2\tHead 3\r1a\t1b\t1c\r2a\t2b\t2c\r3a\t3b\t3c\r4a\t4b\t4c\r5a\t5b\t5c"

        }),

    myTable = tf.texts[0].convertToTable();

myTable.rows[0].rowType = RowTypes.headerRow;

myTable.alternatingFills = AlternatingFillsTypes.alternatingRows;

myTable.startRowFillColor = doc.colors.itemByName("Magenta");

myTable.startRowFillTint = 60;

myTable.endRowFillColor = doc.colors.itemByName("Cyan");

myTable.endRowFillTint = 50;

Trevor

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
Guru ,
Aug 21, 2014 Aug 21, 2014

P.s. for all the tables etc. use doc = app.activeDocument and myTable(s) = doc.stories.... as per China's example

I was just showing how to do the alternating bit in the snippet above

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 21, 2014 Aug 21, 2014

Guys, your scripts produces local overrides.

@VeluVK: I would think, that your cellstyle has a fill applied. In this case the alternating rows from the table style are overwritten by the cellstyle. In a normal world there is no need for a script in this case.

If your cellstyles have no fill, please provide an example file.

– Kai

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
Explorer ,
Aug 22, 2014 Aug 22, 2014

Hi Kai,

Many thanks for your reply.

Cell style fills having "None".  but it is not working. when I use the Ignore it will working fine.

Thanks & Regards,

Velu

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
Explorer ,
Aug 22, 2014 Aug 22, 2014

Hi,

I am working in financial tables. i need script for the below requirement. any one suggest.

For all tables from second column onwards ""Tbody_rightalign" paragraph style. and all parenthesis values should be "Tbody_bracket" style, but these changes to be omitted in first rows because column head having separate style.

Picture 1.png

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
Explorer ,
Aug 22, 2014 Aug 22, 2014
LATEST

I am working in financial tables. i need script for the below requirement. any one suggest.

For all tables from second column onwards ""Tbody_rightalign" paragraph style. and all parenthesis values should be "Tbody_bracket" style, but these changes to be omitted in first rows because column head having separate style.

Picture 1.png

Grey should be Tbody_rightalign style.

Pink color should be Tbody_bracket style.

Any one help me pls. i am having 150+ tables.

Thanks,

Velu

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