6 Replies Latest reply on Jun 25, 2016 5:18 PM by Oriup

    vertical cell alignment in table

    johnBking78

      Can someone help with a simple question (I think) I want to change the cell alignment on a selected table to "vertical justification to alignment Bottom" in JS but just can't work out how?

       

       

      Please any help would be great!

       

       

      Cheers.

        • 1. Re: vertical cell alignment in table
          johnBking78 Level 1

          To clarify I want to change the vertical justification to alignment Bottom I know the name of the cell that I want to change, but don't want to get rid of some overrides, so want to force the alignment but not affect the text style? is this making sense?

          • 2. Re: vertical cell alignment in table
            [Jongware] Most Valuable Participant

            "Name"? The cell has a label?

             

            In any case, this Cell property is what you want:

             

            verticalJustificationVerticalJustification:
            VerticalJustification.TOP_ALIGN
            VerticalJustification.CENTER_ALIGN
            VerticalJustification.BOTTOM_ALIGN
            VerticalJustification.JUSTIFY_ALIGN
            r/wThe vertical alignment of cell.

             

            and you don't have to worry about anything re: text styles or other formatting. When done properly, changing this setting does not change anything else.

            • 3. Re: vertical cell alignment in table
              johnBking78 Level 1

              Many thanks!!!!

               

              I'm a bit thick on this one, how would I apply in the code below? I wish I was better at this!

               

               

              try {     
              
                first = 1;
                last = myTable.rows.length - 2;
                  for (a = first; a <= last; ++a)      
                    myTable.rows[a].cells.everyItem().appliedCellStyle = "table text";
              
              
              textFramePreferences : {  
                        verticalJustification : VerticalJustification.BOTTOM_ALIGN 
                   }     
              
              }  catch(err){} 
              

               

               

              Thank you [Jongware]

              • 4. Re: vertical cell alignment in table
                [Jongware] Most Valuable Participant

                That contains more than one syntax error

                 

                Try this instead:

                 

                myTable.cells.everyItem().verticalJustification = VerticalJustification.BOTTOM_ALIGN;
                

                 

                This applys the vertical justification to all cells of myTable. If you only want to apply it to the cells you also set the style for, put the line inside the for .. loop, with the same syntax as the line above, like this:

                 

                for (a = first; a <= last; ++a)
                {
                      myTable.rows[a].cells.everyItem().appliedCellStyle = "table text";
                      myTable.rows[a].cells.everyItem().verticalJustification = VerticalJustification.BOTTOM_ALIGN;
                }
                
                • 5. Re: vertical cell alignment in table
                  johnBking78 Level 1

                  [Jongware]

                   

                  Thank you so MUCH! fantastic!!

                   

                   

                  your a star!

                  • 6. Re: vertical cell alignment in table
                    Oriup Level 1

                    Dear Jongware,

                     

                    I have 110 pages a file there is 330 tables without table and cell style.

                     

                    I want to apply VerticalJustification.CENTER_ALIGN without creating style.

                     

                    Please help as soon as possible