These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Populating PDF form fields from a CSV (or XLS) file

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766

Hi,

I need to fill hundreds rows of PDF form fields with datas contained in an spreadsheet.
(because this form needs some fields to be pre-filled : end-users just have to add or complete datas in other fields)

After searching in the forum I find and use the "importTextData" JavaScript function but I can fill only one row at a time…

And since form fields'names needs to be exactly the same as in the spreasheet I can figure how to use the Adobe naming convention (fieldname.0, fieldname.1, fieldname.2, and so on) to populate all rows.

Can someone help me ?
Please…

[i](Using Acrobat will be better for me, since I'm not familiar with Designer)[/i]

;-)

(Please, be lenient since english isn't my native langage...)

My Product Information:
Acrobat Pro 9.1
Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Can someone help me ?
Please…
efos
Registered: Jan 8 2009
Posts: 63
Convert your xls to xml data (NOT, and I repeat NOT, and XML Spreadsheet. Those have a nightmarish structure). Create a simple structure like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><root><datafield name=""><data1/><data2/><data3/></datafield><datafield name=""><data1/><data2/><data3/></datafield></root>

and apply it as an XML Map in Excel (Data->XML). Excel will see the two identical children and deduce that you want it repeated. Figure the rest out from there. Its easy to figure out, and laborious to explain.Then add the XML doc as an attachment and use the set/getXML method here:
http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=20124

Read up on [url=http://www.w3.org/TR/xpath#location-paths]xPath[/url] and the [url=http://www.adobe.com/devnet/acrobat/pdfs/js_developer_guide.pdf]XFA methods[/url] (page 101) and properties to manipulate your data.

Then you can just attach the document, and run a script that populates everything based on your needs.
Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Thanks !
I'll test that.