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

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

Explorer ,
May 30, 2013 May 30, 2013

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

7.0K

Translate

Translate

Report

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 , May 31, 2013 May 31, 2013

Yessss

My problem is solved

Thanks a lot.

Patrick

Votes

Translate

Translate
Advisor ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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 ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

Thank you very much

Its working.

I changed tis line:

var myTable = myF.convertToTable();

to

var myT = myF.convertToTable();

Votes

Translate

Translate

Report

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
Advisor ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

yep.. sorry about the misstype.

Votes

Translate

Translate

Report

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 ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

Is it also possible to make the width of the total tabel 45mm? in the same script?

So yes what do i have to do.

Votes

Translate

Translate

Report

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
Advisor ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

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

myT.width=45mm

Votes

Translate

Translate

Report

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 ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

Yessss

My problem is solved

Thanks a lot.

Patrick

Votes

Translate

Translate

Report

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
Advisor ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

you are welcome.. but next time please mark the correct answer as correct...

Votes

Translate

Translate

Report

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
New Here ,
Apr 29, 2024 Apr 29, 2024

Copy link to clipboard

Copied

Hi, 
I tried this script, not work in v2024.
Please help. 

Thank you.

Votes

Translate

Translate

Report

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
Contributor ,
Jun 21, 2013 Jun 21, 2013

Copy link to clipboard

Copied

I tried to get myT.width to work.   It errored out.  I just cut & paste and even adjusted for syntax with space before and after the = sign.

Votes

Translate

Translate

Report

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
Community Expert ,
Jun 21, 2013 Jun 21, 2013

Copy link to clipboard

Copied

Did you add the semicolon (;) at the end of the line?

Votes

Translate

Translate

Report

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
Contributor ,
Jun 21, 2013 Jun 21, 2013

Copy link to clipboard

Copied

I did add the semicolon.  Maybe it doesn't like that line at the end.  ??

script.png

Votes

Translate

Translate

Report

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
Community Expert ,
Jun 21, 2013 Jun 21, 2013

Copy link to clipboard

Copied

Did you try commenting out the line

myT.clearTableStyleOverrides();

as suggested by Vamitul?

Votes

Translate

Translate

Report

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
Contributor ,
Jun 21, 2013 Jun 21, 2013

Copy link to clipboard

Copied

Got it to work.  

myT.width = "20p0";

Thanks for all your persistent help — and my 17 yr old for the quotation marks.   

Votes

Translate

Translate

Report

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
Community Expert ,
Jun 21, 2013 Jun 21, 2013

Copy link to clipboard

Copied

Good to know. Aren't teenagers great?

Votes

Translate

Translate

Report

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
Contributor ,
Jun 21, 2013 Jun 21, 2013

Copy link to clipboard

Copied

On this level, yeah !

Votes

Translate

Translate

Report

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 ,
May 29, 2015 May 29, 2015

Copy link to clipboard

Copied

Ok, I have a similar problem except that the paragraph styles I am looking for and wish to apply ARE both within Style Groups that are up to 3 levels deep. What has to change in this script so it will find & replace with whichever paragraph styles are pass to the function regardless of their Style Group depths? Additionally, it's possible that certain documents may not have all the styles and/or groups that I am looking for so how do I prevent the script from failing if it encounters such?

Votes

Translate

Translate

Report

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
New Here ,
Apr 29, 2024 Apr 29, 2024

Copy link to clipboard

Copied

Hi Vamitul,

This script after the update of the line "var myT = myF.convertToTable();" is not working.

Thank you.

Votes

Translate

Translate

Report

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
New Here ,
Apr 29, 2024 Apr 29, 2024

Copy link to clipboard

Copied

Hi,

Finally, this script is working but very slow in a 350-page document. 

Thank you.

Votes

Translate

Translate

Report

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
Community Beginner ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

Hi,

How did you get it to work? I get the error 

 

Error string: myF.convertToTable is not a function.

 

Thank you.

Votes

Translate

Translate

Report

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
Community Beginner ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Community Expert ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

LATEST

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-...

-Manan

Votes

Translate

Translate

Report

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