Using multiple paragraph styles in one table cell
hi,
i'm stuck @ using multiple paragraph styles inside cell. guess solution need start new paragraph, far haven't found way this. when in indesign directly, works fine, can't start new paragraph when using script.
here's 1 solution tried:
with( table){
rows[0].cells[0].insertionpoints.item(-1).properties = {
contents: 'string in format 1',
appliedparagraphstyle: styleformat1
};
rows[0].cells[0].insertionpoints.item(-1).properties = {
contents: '\rstring in format 2',
appliedparagraphstyle: styleformat2
};
}
but far didn't manage new paragraph. when @ idmls, can see 1 indesign adds new paragraph inside cell, while 1 code stays in same paragraph.
here's idml-result when in indesign:
<cell self="ue0ie4i0" name="0:0" rowspan="1" columnspan="1" appliedcellstyle="cellstyle/$id/[none]" appliedcellstylepriority="0">
<paragraphstylerange appliedparagraphstyle="paragraphstyle/format1">
<characterstylerange appliedcharacterstyle="characterstyle/$id/[no character style]">
<content>string in format 1</content>
<br/>
</characterstylerange>
</paragraphstylerange>
<paragraphstylerange appliedparagraphstyle="paragraphstyle/format2">
<characterstylerange appliedcharacterstyle="characterstyle/$id/[no character style]">
<content>string in format 2</content>
</characterstylerange>
</paragraphstylerange>
</cell>
and here's 1 when i'm using script:
<cell self="ue0ie4i0" name="0:0" rowspan="1" columnspan="1" appliedcellstyle="cellstyle/$id/[none]" appliedcellstylepriority="0">
<paragraphstylerange appliedparagraphstyle="paragraphstyle/format2">
<characterstylerange appliedcharacterstyle="characterstyle/$id/[no character style]">
<content>string in format 1</content>
<br/>
<content>string in format 2</content>
</characterstylerange>
</paragraphstylerange>
</cell>
so it's quite clear script not add new paragraph. ideas how new paragraph can use more 1 paragraph style?
i did not test nore debug code, suggest different method apply contents , 2 paragraph styles. not using with-statement.
what version of indesign?
example:
// add new document: var doc = app.documents.add(); // add 2 paragraph styles: var parastyle1 = doc.paragraphstyles.add({name : "parastyle-1" , pointsize : 20}); var parastyle2 = doc.paragraphstyles.add({name : "parastyle-2" , pointsize : 15}); // add new text frame (default on page 1): var newtextframe = doc.textframes.add(); newtextframe.geometricbounds = [0,0,"150mm","150mm"]; // add table text frame: var table = newtextframe.tables.add ( { bodyrowcount : 4 , columncount : 3 , width : "150mm" } ); // assign contents array: // fisrt , entry in array give first cell contents: table.contents = [ "paragraph 1"+"\r"+"paragraph 2" ] // assign formatting of 2 paragraphs: table.cells[0].paragraphs[0].appliedparagraphstyle = parastyle1; table.cells[0].paragraphs[1].appliedparagraphstyle = parastyle2;
result indesign cs6 v8.1.0 on mac osx 10.6.8:
hope, helps.
uwe
More discussions in InDesign Scripting
adobe
Comments
Post a Comment