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
  • 7560 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');

Participant
June 11, 2024

Dear Vamitul,

 

I am trying to get this script to work on InDesign 18.5.2, but so far no luck. Do you know what should be updated to get this to work?

 

Thank you, Peter

Community Expert
June 12, 2024

Hi @pjgjpg,

I think you have got response on this in the other thread. For anyone looking for answers to this please see https://community.adobe.com/t5/indesign-discussions/indesign-script-for-paragraph-style-to-tables/m-p/14676309#M577259

-Manan

-Manan