Skip to main content
Known Participant
May 13, 2013
Question

How to apply paragraph styles to xml tag?

  • May 13, 2013
  • 1 reply
  • 541 views

Hi All,

How to apply paragraph style to xml tag?

This topic has been closed for replies.

1 reply

csm_phil
Legend
May 13, 2013

Hi Learner,

Try the below js code.

var myDoc = app.activeDocument;
try{
    mySel=app.selection[0];
    myDoc.xmlElements[0].xmlElements.add({markupTag:"TEST", xmlContent:mySel});
    }catch(e){
        alert(e);
        }

var myDocument = app.activeDocument;

app.findGrepPreferences.appliedParagraphStyle = "test";

app.findGrepPreferences.findWhat = ".+(?=\\r)"

var mySearch = myDocument.findGrep(false);

for (a=0; a<mySearch.length; a++){

    myDocument.xmlElements[0].xmlElements.add({markupTag:"TEST", xmlContent:mySearch});

    }

thx,

csm_phil