1 Reply Latest reply on May 31, 2008 9:46 AM by Peter Kahrel

    [js] [cs3] hint needed: row height

      good afternoon (or what is it, whatever?!) there !

      help to solve that plz,

      i have an insertion point in a cell / a cell selected in a big green table.
      i need to set the height of the row, that hosts that cell to a certain value.
      When it's done, i need to keep the initial state: a cursor in the same ins. point or a cell selected.

      digin' through the night i've found a part that distinguished is it a cell selected or an insertion point in a cell or something else:

      if(app.documents.length != 0){
      if(app.selection.length != 0){
      switch(app.selection[0].constructor.name){
      //When a row, a column, or a range of cells is selected,
      //the type returned is "Cell"
      case "Cell":
      alert("A cell is selected.");
      break;
      case "Table":
      alert("A table is selected.");
      break;
      case "InsertionPoint":
      case "Character":
      case "Word":
      case "TextStyleRange":
      case "Line":
      case "Paragraph":
      case "TextColumn":
      case "Text":
      if(app.selection[0].parent.constructor.name == "Cell"){
      alert("The selection is inside a table cell.");
      }
      break;
      }
      }

      so i need to set the autogrow = off in order to set the fixed heght (reagrding that post: http://www.adobeforums.com/webx/.3c061241 ), set the row fixed height, and then return it to the sellection mode/isertion mode.

      is it going to be:
      set myCell.autoGrow = true;
      set myRow.cell.width = 10 mm;

      correct me, please !

      Thanks,
      Sam.
        • 1. Re: [js] [cs3] hint needed: row height
          Peter Kahrel Adobe Community Professional & MVP
          First you need a handle on a cell. Once you have that cell, set the height of its parent row and the width of its parent column.

          Peter

          c = get_cell();
          
          c.parentRow.height = "24pt";
          c.parentColumn.width = "24pt";

          // return a cell if you can
          function get_cell()
             {
             if (app.selection.length > 0)
                {
                if (app.selection[0].parent instanceof Cell)
                   return app.selection[0].parent;
                else if (app.selection[0] instanceof Cell )
                   return app.selection[0];
                }
             }