Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Importing or copying Excel list into listbox?

Community Beginner ,
Feb 14, 2018 Feb 14, 2018

Hello,

Anyone out there knows how to Importing or copying Excel list into listbox? The Adobe API/UI does not support this.

Only found http://acroscript.net/pdf/demos/comboPopulateTest.pdf

But no code displaies.

Thanks

George

TOPICS
PDF forms
2.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Beginner ,
Feb 15, 2018 Feb 15, 2018

Finally, I got the solution myself!.

There is not any API or instrruction in Adoba API doc.

The approaching is:

(1) Create a text control, one button and one listbox.

(2) Copy and past the excel sheet columns on the text field.

(3) Using Java script to load the text to the listbox.

(4) Copy the loaded listbox to any PDF form you like.

Here is the code to load the test to listbox:

(function () {

// Get the contents of the multi-line text field

// where the list values have presumably been pasted or otherwise entered

    var sItems = getField("items").valueAsString;

// Alert the user if the field is empty

    if (!sItems) {

        app.alert("Please enter a list of items in the text field below.", 3);

        return; 

    }

// Create the array of items by splitting the string from the field

    var aItems = sItems.split(/\r/);

    //

getField("Yourlistbox").setItems(aItems);

})();

I hope that this can help others.

George

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 14, 2018 Feb 14, 2018

You can use this tool I've developed to do it (you would need to first save the Excel file as a plain-text file, though): Custom-made Adobe Scripts: Acrobat -- Import Items from a Text File to a Combo-Box or List Field

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 15, 2018 Feb 15, 2018

Finally, I got the solution myself!.

There is not any API or instrruction in Adoba API doc.

The approaching is:

(1) Create a text control, one button and one listbox.

(2) Copy and past the excel sheet columns on the text field.

(3) Using Java script to load the text to the listbox.

(4) Copy the loaded listbox to any PDF form you like.

Here is the code to load the test to listbox:

(function () {

// Get the contents of the multi-line text field

// where the list values have presumably been pasted or otherwise entered

    var sItems = getField("items").valueAsString;

// Alert the user if the field is empty

    if (!sItems) {

        app.alert("Please enter a list of items in the text field below.", 3);

        return; 

    }

// Create the array of items by splitting the string from the field

    var aItems = sItems.split(/\r/);

    //

getField("Yourlistbox").setItems(aItems);

})();

I hope that this can help others.

George

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 15, 2018 Feb 15, 2018
LATEST

well you know, there are a couple of free downloads for this.  George Johnson has one and I've got one here:

Free Sample PDF Files with scripts

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines