Skip to main content
Known Participant
November 18, 2015
Answered

Change row height limits

  • November 18, 2015
  • 1 reply
  • 2730 views

This is currently the final function in a script I have that finds empty rows in a document and deletes them. But in this instance, I don't want to delete them. I want to change the max and min row height limits of these empty rows.

function deleteEmptyRows (rows) {

  

var i, count = rows.length, row;

  

    for (i = 0; i < count; i += 1) {

        row = rows;

        if (rowIsEmpty (row) === true) {

              row.Delete ();

                        

        }

    }

          

}

I've got the cell dimension that I want to apply by running the below which gave me "371542". I thought I could just replace row.Delete (): with  row.RowMaxHeight="371542"; but this doesn't do anything. Could anyone point me in the right direction please?

var doc = app.ActiveDoc;

var pgf = doc.TextSelection.beg.obj;

var cell = pgf.InTextObj;

var row = cell.CellRow;

alert (row.RowMinHeight);



Cheers


Chris

This topic has been closed for replies.
Correct answer Klaus Göbel

Hi Chris ,

I've just extended the script. Just compare it with your script.

var gDoc = app.ActiveDoc ;

var oTabSelected = gDoc.SelectedTbl;

var AllRows = [];

var myRow = oTabSelected.FirstRowInTbl;

while (myRow.ObjectValid())

        {

            AllRows.push(myRow);

            myRow = myRow.NextRowInTbl;

           

        }

   

    MinimizeRows(AllRows);

function MinimizeRows(fRows)

{

    for (var i = 0; i < fRows.length; i++)

        {

        fRows.RowMaxHeight=371542;

        }

}

I guess, it has something to do with your document.

Is there a chance, that you send parts of your document to me via PN so I can test that?


Thanks for sending me the doc.

I found the problem:

RowMinHeight was higher than RowMaxHeight :760213

So you just have to add in my example above:

fRows.RowMinHeight=371542;

fRows.RowMaxHeight=371542;

1 reply

Klaus Göbel
Legend
November 18, 2015

Hi Chris,

this should work, but without quotation marks: row.RowMaxHeight=371542

Known Participant
November 18, 2015

Hi Klaus,

Unfortunately not, I've tried with and without quotation marks and still nothing.

Thanks

Chris

Klaus Göbel
Legend
November 18, 2015

Hi Chris,

I've just tested this and it works:

I have created a table, selected it and started this little script:

var gDoc = app.ActiveDoc ;

var oTabSelected = gDoc.SelectedTbl;

var myRow = oTabSelected.FirstRowInTbl;

myRow.RowMaxHeight=371542;