3 Replies Latest reply on Jul 28, 2015 3:08 AM by mani@pixel

    how to remove or delete empty line space between paragraphs

    mani@pixel

      i want to remove or delete empty line space between paragraphs.

      and in each page contents should be end in same line at the bottom..

      like books...

        • 1. Re: how to remove or delete empty line space between paragraphs
          mani@pixel Level 1

          this is my code... but its not working ..

           

           

           

          pagefoot();

           

           

          function pagefoot()

          {

             var doc = app.activeDocument;

             var allpage = doc.pages.everyItem();

             var i;

             //alert(allpage);

            

             doc.pages.everyItem().marginPreferences.bottom = "3";

             doc.pages.everyItem().marginPreferences.top = "3";

             doc.pages.everyItem().marginPreferences.left = "3";

             doc.pages.everyItem().marginPreferences.right = "3";

            

             const height = doc.documentPreferences.pageHeight; 

               //alert(height);    

             var custheight = 66.5;

           

             if(height != custheight)

             {

            

             doc.documentPreferences.pageHeight = custheight;

             }

            

             var allpara = doc.textFrames.everyItem().paragraphs;

             //alert(allpara.length);

           

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

             {  

                 //alert(allpara[i].contents);

                 try

                 {

                 if(allpara[i].contents == "\r")

                 {

                     //alert("null");

                    allpara[i].remove();

                     }

                 }

             catch(e)

             {

                

                 }

            

                 }

            

               

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

             {

                 try

                 {

                 if(allpara[i].contents == " ")

                 {

                     //alert("hello");

                     allpara[i].remove();

                     }

                else

                 {

                     allpara[i].spaceBefore = 0;

                     }

                 }

             catch(e)

             {

                 }

                 }

            

             //doc.documentPreferences.pageWidth = "51";

            

             //doc.documentPreferences.documentBleedBottomOffset ="3" ;

             // doc.documentPreferences.documentBleedLeftOffset ="3" ;

               

            

          }

          • 2. Re: how to remove or delete empty line space between paragraphs
            Level 1

            #target indesign

            app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

            clean_up (app.activeDocument, true);

            var myDocument = app.activeDocument;

            //var inddFile = new File ( myDocument.filePath + "/Gardner.indd" ); 

            app.activeDocument.save(); 

            alert ("Clean_up Completed !!!!!!!!!!!!!")

            //exit();

             

             

            function clean_up (scope, caps)

            {

            app.findGrepPreferences = app.changeGrepPreferences = null;

            app.findChangeGrepOptions.includeFootnotes = true;

            app.findChangeGrepOptions.includeHiddenLayers = true;

            app.findChangeGrepOptions.includeLockedLayersForFind = true;   

            app.findChangeGrepOptions.includeLockedStoriesForFind = true;

            app.findChangeGrepOptions.includeMasterPages = true;

            //app.documents.everyItem().xmlElements.item(0).xmlElements.everyItem().untag();

             

             

            // series of tabs

            change_grep (scope, '\\t\\t+', '\\t');

            // series of returns

            change_grep (scope, '~b~b+', '~b');

            // series of spaces

            change_grep (scope, '\\x{20}\\x{20}+', '\\x{20}');

            // trailing spaces and tabs

            change_grep (scope, '\\s+$', "");

            // leading spaces/tabs

            change_grep (scope, '^\\s+', "");

            change_grep (scope, '~e+', '.~S.~S.');

            change_grep (scope, ' . . .', ' .~S.~S.~S.');

             

             

             

             

            }

            function change_grep (obj, f, r)

            {

            app.findGrepPreferences.findWhat = f;

            app.changeGrepPreferences.changeTo = r;

            obj.changeGrep()

            }

            • 3. Re: how to remove or delete empty line space between paragraphs
              mani@pixel Level 1

              above code is working fine . but i want , each page contents should be end in same line at the bottom..