Skip to main content
Participant
October 31, 2012
Question

How to apply two paragraph Style to Table??

  • October 31, 2012
  • 2 replies
  • 712 views
Header 1Header 2Header 3Header 4
parastyle1parastyle2parastyle1parastyle2
parastyle1parastyle2parastyle1parastyle2
parastyle1parastyle2parastyle1parastyle2
parastyle1parastyle2parastyle1parastyle2

Hello,anyGod of the JS, i have two paragraphstyle, i want to apply to table.

Now i can only apply style to the table. but i dot't know how to apply columns i want to chosse.

pls help me      thankyou very mush^^

var myDoc=app.activeDocument;

   

    var    myParagraphStyle = myDoc.paragraphStyles.item("parastyle1");

var myTable = app.selection[0].convertToTable("\t","\r");

    myTable.rows.item(0).rowType = RowTypes.headerRow;

myTable.columns.item(0).width = "30 mm";

myTable.columns.item(1).width = "30 mm";

myTable.columns.item(2).width = "30 mm";

myTable.columns.item(0).width = "30 mm";

var celltable = myDoc.cellStyleGroups.item('Cell').cellStyles.item('Table');

myTable.cells.everyItem().appliedCellStyle = celltable;

    app.selection[0].applyParagraphStyle(myParagraphStyle, true);

This topic has been closed for replies.

2 replies

AlienLaiAuthor
Participant
November 1, 2012

Thank a lot^^ it is Great!!!!

Jump_Over
Legend
November 1, 2012

Hi,

myTable.columns[0].cells.itemByRange(1,-1).texts.everyItem().appliedParagraphStyle = myParagraphStyle;

should do it in first column (from 2nd row to the bottom)

enjoy