5 Replies Latest reply on Sep 25, 2014 6:56 AM by Arihant Jain Mg

    Pagewise export of all text

    Arihant Jain Mg

      Hi,

       

      How to export all text as .txt or .rtf based on pagewise?

       

      Regards

        • 1. Re: Pagewise export of all text
          Sajeev Sridharan Level 4

          Hi,

           

          1) Run "SplitStory.jsx" javascript file (javascript files will be available in "Scripts Panel\Samples\JavaScript" location)

          2) Run "ExportAllStories.jsx"

          3) Each an every page will be exported as a separate word document

           

          Note: If each page have multiple stories then it will also exported as a separate word document.

           

          Vandy

          • 2. Re: Pagewise export of all text
            Arihant Jain Mg Level 1

            Hi,

             

            I tried your solution but it exports a lot of extra files. I even tried running Merge_Textframes_ID.jsx before exporting. And the file order is not according to the page.

             

            Is there a way to save text only from the current page?

             

            Regards

            • 3. Re: Re: Pagewise export of all text
              Sajeev Sridharan Level 4

              Try this,

               

              var myWindow = new Window ("dialog", "Export DOC");
              myWindow.orientation = "row";
              var myInputGroup = myWindow.add ("group");
              myInputGroup.add ("statictext", undefined, "Enter your Page Number:");
              var myPage = myInputGroup.add ("edittext", undefined, "");
              myPage.characters = 10;
              myPage.active = true;
              var myButtonGroup = myWindow.add ("group");
              myButtonGroup.orientation = "column";
              myButtonGroup.add ("button", undefined, "OK");
              myButtonGroup.add ("button", undefined, "Cancel");
              var myResult = myWindow.show ();
              
              
              if (myResult == 1)
              {
                  for(i = 0; i < app.activeDocument.pages[Number(myPage.text)-1].textFrames.length; i++)   
                  {
                      myFileName = "Page_" + myPage.text + "_"  + i + ".rtf";
                      myFilePath = "/d/word_files/" + myFileName;
                      myFile = new File(myFilePath);
                      app.activeDocument.pages[Number(myPage.text)-1].textFrames[i].texts[0].exportFile(ExportFormat.RTF, myFile);
                  }
              }
              
              

               

               

              Vandy

              • 4. Re: Pagewise export of all text
                Arihant Jain Mg Level 1

                Hi,

                 

                Works perfectly. Thank you so much.

                However I m facing an issue, I am trying to export unicode (hindi) content & after exporting the content goes missing. English characters are exported properly but unicode characters are not exported. Is there any solution to the unicode issue?

                 

                Sample text

                अरिहंत

                 

                Thanks for all the help

                 

                Regards

                • 5. Re: Pagewise export of all text
                  Arihant Jain Mg Level 1

                  Just append at the bottom

                   

                  with(app.textExportPreferences){

                      //Options for characterSet: TextExportCharacterSet

                      characterSet = TextExportCharacterSet.UTF8;

                      }