1 Reply Latest reply on Feb 19, 2010 5:53 AM by ipaw

    Select Text file for ImportTextData

    Olyster2

      Hi !

       

      I'd like to provide users with the ability to pick a text file and use it with ImportTextData method. If I don't supply a parameter, the correct open box is displayed and the filter is on *.txt but I can't retrieve the path and filename of the text file after this.

       

      I need to import around 500 lines of Text Data.

       

      I was able to do it using browsefordoc and a for loop but the filter is set on *.pdf thus the user doesn't see the text files but he can type it and it'll work.

       

      If it's not possible then I'll stick with my first method but I'm looking for something more ... "fluid" !

       

      Thanks !

        • 1. Re: Select Text file for ImportTextData
          ipaw Level 1

          I've done this same thing. I created a drop-down list that will filled on "docReady" with a tabbed

          delimited text file containing the descriptive name of my list and the file name of the tabbed delimited file I want loaded.

           

          var oDoc = event.target;
          var cPath = "dropdownlist.txt";
          var nRow = 0;
          var sListItem = "";
          var sListValue = "";

           

          while (sListItem != "EOF") {
              TrustedImportTextData( oDoc, cPath, nRow ); // located in C:\Program Files\Adobe\Acrobat 8.0\Acrobat\Javascripts

           

              sListItem = xfa.resolveNode("MyForm.frmHidden.importDesc").rawValue;
              sListValue = xfa.resolveNode("MyForm.frmHidden.importFile").rawValue;

           

              if (sListItem != "EOF" && sListItem != "") {
                  MyForm.Header.lstDropDown.addItem(sListItem);
                  MyForm.variables.globalScript.AddItem(nRow, sListItem, sListValue); // load the corresponding text file into an array
                  nRow++;
              }
          }