0

Please any body can help me with below code

var myDocument = app.documents.add();  
var myTextFrame = myDocument.pages.item(0).textFrames.add({geometricBounds:["6p", "6p", "10p", "10p"]});  
var myTable = myTextFrame.insertionPoints[0].tables.add({columnCount:3,bodyRowCount:3});

the above code is for creating table in Adobe inDesign. With this I am able to get table onto the document of inDesign. Now I am struggling with putting/tagging data from XML into the above table. Please anybody could help me with the same.

yatinbc
  • 605
  • 3
  • 16
  • 37

1 Answers1

0

How your XML looks like? Can you modify it? You dont need to create empty table ==> if XML structure is built well - Indesign will draw it while importing.

Mark empty textFrame as "Root" and import this XML example:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/">
<Frame>
<Test aid:table="table" aid:trows="2" aid:tcols="1" aid5:tablestyle="TableTestStyle">
<TestTable aid5:cellstyle="CellTestStyle1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="114">
<stCell>Text in cell 1</stCell>
</TestTable>
<TestTable aid5:cellstyle="CellTestStyle2" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="114">
<ndCell>Text in cell 2</ndCell>
</TestTable>
</Test>
</Frame>
</Root>
Cashmirek
  • 269
  • 1
  • 9