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

How to add tag for applied paragraph style.

Contributor ,
Mar 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

Dear script kings,

I was workout the script for based on the table (xml workflow).

I was done the script automatically apply paragraph style in the table. below my coding.

allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();

for (aTable=0; aTable<allTables.length; aTable++)

{

           var myTable = allTables[aTable];

          

            if(myTable.rows.length >1)

            {

                  myTable.autoTag();

                  for (rw=0; rw<myTable.rows.length; rw++)

                  {

                      if(rw==0)

                      {

                        myTable.rows[rw].cells.everyItem().paragraphs[0].appliedParagraphStyle ="Table head";

                        }

                    else

                    {

                        myTable.rows[rw].cells.everyItem().paragraphs[0].appliedParagraphStyle ="Table Text";

                        }

                  }

             }

}

This working fine.

@ I needed; How to add xml tagging <p> in the paragraph styles for "Table head" and "Table Text"? This is possible to script. please help and suggest me dear friends.

Advance Thanks all.

TOPICS
Scripting

Views

517

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
People's Champ ,
Mar 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

Hi

You need to map styles to tags but first state the associations:

var doc = app.activeDocument;

var tag = doc.xmlTags.item("p");

var style = doc.paragraphStyles.item("Table head");

var map = doc.xmlImportMaps.add(tag,style);

doc.mapStylesToXMLTags();

HTH

Loic

ozalto.com

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 ,
Mar 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

Hi Loic.Aigon‌,

Thanks your response,

Your coding working with foot_note text and all tags creating with out of xml structure. But, i need to insert the tag for inside of tables (attached screenshot for your reference).

Screen Shot 2016-03-21 at 3.44.03 PM.png

@ just about: i think, here with problem for "xmlImportMaps"? please give other way (solution) friend.

One more thanks,

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
People's Champ ,
Mar 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

Just checked here. Also working inside tables. What InDesign version do you have ?

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 ,
Mar 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

Hi Loic.Aigon,

First, thanks for your help.

@ Here with i am using; Mac indesign CS6 version 8.0. also attached screenshot for your reference.

Screen Shot 2016-03-22 at 12.20.46 PM.png

Again try your above coding. But, not working properly totally my xml structure is change (sorry for saying). Please suggest me Loic.Aigon.

Advance thanks,

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 ,
Mar 22, 2016 Mar 22, 2016

Copy link to clipboard

Copied

There were several bug fix versions of InDesign CS6. Maybe that would explain the difference?
What is your exact version?

Hold down the cmd key and chose "About inDesign..." to see the exact version number.
My version of CS6 on Mac OSX is 8.1.0.419.

Uwe

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 ,
Mar 22, 2016 Mar 22, 2016

Copy link to clipboard

Copied

HI Laubender

I have attached screenshot based on the your comment friends. Please check and tell me one good solution.

DB File Version: 8.0

Screen Shot 2016-03-22 at 2.51.34 PM.png

Advance Thanks.

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
People's Champ ,
Mar 22, 2016 Mar 22, 2016

Copy link to clipboard

Copied

I would second Uwe's answer. Check any possible updates available for your InDesign CS6.

If still not working, you can still reach the text object inside cell, look at the applied style and append a tag to that text object.

Or do a GREP search with applied style option and look if found text parent is a cell and then append the tag to the text object.

please give other way (solution) friend

Open the manual ?

Loic

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 ,
Mar 22, 2016 Mar 22, 2016

Copy link to clipboard

Copied

LATEST

Hi Loic.Aigon,

OK, i will try your suggestion and get back to you.

Thanks

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