9 Replies Latest reply on Apr 14, 2016 12:25 AM by Klaus Göbel

    overflow text in tables

    Suzan.V Level 1

      Hello all,

       

      kindly i need some help that i can't see or figure overflow (overset) text in table cells in FrameMaker, also i got a code to say if there is overset text or no in document but it doesn't go to the page or select that text frame

       

      my 1st priority to find overflow in table cells

       

      Thanks all in advance

        • 1. Re: overflow text in tables
          Klaus Göbel Level 3

          Hi Suzan.V

           

          here some lines of code that may help you:

          It finds overflowed cells and puts the cursor there.

          var oDoc = app.ActiveDoc
          
          var locFlow = oDoc.MainFlowInDoc;
          var OverflowFound = false;
          
          var oTables = locFlow.GetText(Constants.FTI_TblAnchor);
          
           for (var i = 0; i < oTables.length; i++)
                  {
                   var oRow = oTables[i].obj.FirstRowInTbl; // Zeile 2
                   var oCell = oRow.FirstCellInRow;  
                     
                  while (oRow.ObjectValid ( ) ) 
                      {
                          var oCell = oRow.FirstCellInRow;  
                           while (oCell.ObjectValid ( ) ) 
                              {
                               if (oCell.Overflowed == 1)
                                  {
                                  var oPgf = oCell.FirstPgf;
                                  var tloc = new TextLoc(oPgf, 0)
                                  var locTextRange = new TextRange (tloc, tloc);
                                  oDoc.ScrollToText (locTextRange);
                                  alert ("Overflow");
                                  OverflowFound = true;
                                  break;
                                  }
                              
                              oCell = oCell.NextCellInRow;
                              }   //  while (oCell.ObjectValid ( ) ) 
                      
                          if (OverflowFound) break;
                           oRow = oRow.NextRowInTbl;
                      }   //  while (oRow.ObjectValid ( ) ) 
                        if (OverflowFound) break;
              }   // for
          
          • 2. Re: overflow text in tables
            Suzan.V Level 1

            Dear Klaus,

             

             

            Thanks for your reply and i hope you can help me at this case, but your code seems not working to me

             

            you find a sample file uploaded at below link

             

            http://www.megafileupload.com/rsYN/Sample_file.zip

             

             

            first i want the code to tell me that there is overflow text on page (1) as shown  and select both those text frames one by one

             

            2.png

             

             

            then ( and that is more important) there are overflow text on three cells as shown but i can't know that until i resize the row format from 5 to 7 or read the text and guess if the context is missing

             

            1.png

            so if you can't find those overflow text, can you create a script to to resize all tables row format and give them maximum value for ex = 100

             

            Thanks in advance for your help

            • 3. Re: overflow text in tables
              Klaus Göbel Level 3

              Hi Suzan,

               

              sorry for my late response, but I'm on a business trip for the rest of the week.

               

              Did you get any error messages?

               

              I've just  tested the script again: it works.

               

              I'm using FrameMaker 2015 and FrameMaker 12.

               

              Which version do you use?

               

              Of course, you need an active document with a table.

              And then this ExtendScript runs.

               

              When I download your file I get a virus warning.

              • 4. Re: overflow text in tables
                Suzan.V Level 1

                Dear Klaus,

                 

                actually i don't get any error, but i don't see the cursor goes to the overflowed cell, so please can you attach a sample file you tested on and tell me how to post my file without seeing this virus alert

                 

                I'm using FM 10,12,15

                 

                Thanks a lot for your help and have a nice trip

                • 5. Re: overflow text in tables
                  Klaus Göbel Level 3

                  The cursor is at the beginning of the cell. (ScrollToText )

                   

                  I could offer you a solution, but it's only in German at the moment.

                   

                  BTW: is there a reason why you don't increase the minimum height of all cells?

                  • 6. Re: overflow text in tables
                    Suzan.V Level 1

                    OK no problem to post German solution,

                     

                    and BTW i don't have a script or automation way to resize all table cells (row format) to be for ex. = 100 to figure all text flowed, so if you have please post it.

                     

                    many thanks for your generous help

                    • 7. Re: overflow text in tables
                      Klaus Göbel Level 3

                      Hi Suzan,

                       

                      this little script should solve your problems.

                       

                      It sets maximum height of all tablerows to 35,56 cm which is the value when you create a new table.

                       

                      var oDoc = app.ActiveDoc
                      
                      var locFlow = oDoc.MainFlowInDoc;
                      
                      var cMillimeter = 2.83464 * 65536;
                      
                      var NewRowHeight = 355.6;   // standard value when creating a new table in mm
                      
                      var oTables = locFlow.GetText(Constants.FTI_TblAnchor);
                      
                      for (var i = 0; i < oTables.length; i++)
                          {
                          var oRow = oTables[i].obj.FirstRowInTbl;
                             
                          while (oRow.ObjectValid ())
                              {
                              oRow.RowMinHeight = 0
                              oRow.RowMaxHeight = NewRowHeight * cMillimeter;
                             
                              oRow = oRow.NextRowInTbl;
                              }
                          }   // for
                      
                      • 8. Re: overflow text in tables
                        Suzan.V Level 1

                        Dear Klaus,

                         

                        I'm sorry fir disturbing you again and again, but i tried your code without editting but no thing changed over my table cells

                         

                        this code should edit this value as shown, right?

                         

                        5.png

                        • 9. Re: overflow text in tables
                          Klaus Göbel Level 3

                          Hi Suzan,

                           

                          that's right. It changes this maximum.

                           

                          I've tested it several times and it worked for me.

                           

                          I have to leave now to visit a fair. When I'm back I'll have a closer look.