Copy link to clipboard
Copied
Hi,
How to apply objects styles for a xml element using script. Please do guide me.
Thanks in advance,
Revathi
Copy link to clipboard
Copied
Have you tried anything we can look at ?
Copy link to clipboard
Copied
Hi,
I tried the below code in my script,
function MapCellSylesToObjectStyles()
{
for(var i=1;i<myDocument.cellStyles.count();i++)
{
var myCellStyle = myDocument.cellStyles.item(i);
var myObjectStyle = myDocument.objectStyles.item(myCellStyle.name);
if(myObjectStyle==null)
{
myObjectStyle = myDocument.objectStyles.add({name:myCellStyle.name});
}
if(myObjectStyle!=null)
{
myCellStyle.appliedObjectStyle = myObjectStyle;
}
}
}
But it showing an error which i have mentioned below.
Thanks in advance,
Revathi
Copy link to clipboard
Copied
Hi,
You main issue indeed is that you can't associate an Object Style to a Cell Style. You can do this with paragraph styles however.
Copy link to clipboard
Copied
Hi,
How to do this with paragraph style. please do guide me.
Thanks in advance,
Revathi
Copy link to clipboard
Copied
Hi,
I tried to apply character style using "characters.appliedCharacterStyle = stylame; ".
And then tried to apply paragraph style using "characters.appliedParagraphStyle = stylame; ",
Both worked for me. But when I tried to apply object style "characters.appliedObjectStyle = stylame; ".
I am getting an error,
How shall I apply object styles using script.
Thanks in advance,
Revathi
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi Loic,
I could not find object style mapping. Is object style mapping possible in indesign?
Thanks in advance,
Revathi
Copy link to clipboard
Copied
I think I answered to that one already.