Skip to main content
Inspiring
May 30, 2013
Answered

Script for Indesign find paragraph style change to table with table style

  • May 30, 2013
  • 1 reply
  • 7554 views

Hello,

I hope somebody could help me with a script.

I have tab tekst with a paragraph style and I want to convert that to a table with a table style.

Kind Regards,

Patrick

This topic has been closed for replies.
Correct answer patrickbcm

sure.. just add water.. err.. i mean the line:

myT.width=45mm


Yessss

My problem is solved

Thanks a lot.

Patrick

1 reply

Vamitul
Legend
May 31, 2013

function main() {

          app.findTextPreferences = app.changeTextPreferences = null;

          app.findTextPreferences.appliedParagraphStyle = "name_of_your_style" //won't work it it's in a style group

          var myF = app.activeDocument.selection[0].parentStory.findText(true); //make sure you are inside a text frame when running the script

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

                    var myTable = myF.convertToTable();

                    myT.appliedTableStyle = "Name_of_your_Table_style";

                    myT.clearTableStyleOverrides(); //this line might need to be commented out, see how it works with or without it

          }

          alert("All done!\nYou can go outside and play now!");

}

app.doScript('main()', undefined, undefined, UndoModes.entireScript, 'AllToTables');

Inspiring
May 31, 2013

Thank you very much

Its working.

I changed tis line:

var myTable = myF.convertToTable();

to

var myT = myF.convertToTable();

Vamitul
Legend
May 31, 2013

yep.. sorry about the misstype.