4 Replies Latest reply on Jul 26, 2013 2:14 AM by virender_CTS

    Export table present in indesign file as PNG?

    virender_CTS Level 1

      Dear all,

       

      I have 10 indd files and each file has one page and a table is only item present on page. So few indd files has table present in one textbox and few files has table in two text boxes because table has many rows so spiltted in two linked text boxes.

      I somehow able to select both text boxes but while exporting them only one text box table get exported as png because of improper code.

      Pls help.

      app.selection[0].exportFile(ExportFormat.PNG_FORMAT, destFile, false);        // here i need to correct code.

       

       

      #target Indesign

      var sourceFolder = new Folder ("/Users/admin4/Desktop/INS");

      var myFiles = sourceFolder.getFiles();

       

      //alert (myFiles.length);

      var destFolder = new Folder ("/Users/admin4/Desktop/folder3");

       

      for (i=0; i < myFiles.length; i++)

      {

           if (myFiles[i].name !=".DS_Store")

           {

           var sourceDoc = app.open(myFiles[i]);

          

           app.activeDocument.pageItems.everyItem().select();

       

           //app.activeDocument.stories[0].tables[0].parent.select();

       

           var destFile = File(destFolder + "/" + myFiles[i].name + ".png");

       

           app.selection[0].exportFile(ExportFormat.PNG_FORMAT, destFile, false);  

           // here i need to correct code.

       

           sourceDoc.close(SaveOptions.NO);

       

          }

      }

        • 1. Re: Export table present in indesign file as PNG?
          virender_CTS Level 1

          Dear All,

           

          Please help, I have to use this script tomorrow. I want to avoid manual boring method.

           

          regards
          Virender

          • 2. Re: Export table present in indesign file as PNG?
            virender_CTS Level 1

            Dear all,

             

            Does any one got the chance to look the script?

             

            Virender

            • 3. Re: Export table present in indesign file as PNG?
              Jump_Over Level 5

              Hi,

               

              group pageItems and export group selected:

               

              var sourceFolder = new Folder ("/Users/admin4/Desktop/INS"),
              destFolder = new Folder ("/Users/admin4/Desktop/folder3"),
              myFiles = sourceFolder.getFiles(/.indd$/),
              sourceDoc, i, destFile, mPItems, mTarget;
              
              for (i=0; i < myFiles.length; i++)
              {
                   sourceDoc = app.open(myFiles[i]);
                   if(sourceDoc) {
                        mPItems = sourceDoc.spreads[0].pageItems.everyItem().getElements();
                        switch (mPItems.length) {
                             case 0: alert("Empty file: " + sourceDoc.name); exit(0); break;
                             case 1: mTarget = sourceDoc.pageItems[0]; break;
                             default: mTarget = sourceDoc.groups.add(mPItems); break; 
                             }
                        mTarget.select();
                        destFile = File(destFolder + "/" + sourceDoc.name + ".png");
                        app.selection[0].exportFile(ExportFormat.PNG_FORMAT, destFile, false);  
                        }
                   else alert("Can't open a file: " + sourceDoc.name);
              
                   if(sourceDoc.spreads.length > 1) 
                        alert ("More than 1 spread in file: " + sourceDoc.name);
              
                   sourceDoc.close(SaveOptions.NO);
              }
              

               

              Jarek

              • 4. Re: Export table present in indesign file as PNG?
                virender_CTS Level 1

                Hi,

                 

                for (i=1; i < world_population; i++)
                {
                alert ("Thank U very much");
                }

                 

                 

                Virender