• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Change row height limits

New Here ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Nov 18, 2015 Nov 18, 2015

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;

Votes

Translate

Translate
Enthusiast ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

Hi Chris,

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

Hi Klaus,

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

Thanks

Chris

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

I just copied and pasted this out and tried it over one of the tables in my document and it does'nt do anything. I get "Result: 371542" in the console and thats all. Could it be something to do with the formatting of the table?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

Just try it first with an empty new table to make sure it works in general.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

It works perfectly with new doc and new table. It must be something further back in the script that’s messing it up.

But if it was something further back then the delete command wouldn’t work in the first instance, but it does!

Would it help to see more of the script?

Thanks

Chris

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

LATEST

That's done it!

Thanks a lot

Chris

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines