none
How to return the Table Tools => Layout => Table Row Height property to VB in Word 2010 RRS feed

  • Question

  • I have a large table in a Word 2010 document that had rows of various heights.  The default is to not allow the rows to break across pages.  However, in some cases, the rows are so big that they need to break across the page.  I can select the rows individually, and select Table Tools => Layout to display the current row height.  In Visual Basic, a call to Rows.Height does not return the displayed value.  How can I return this displayed value to Visual Basic so that I know when to enable "allow to break across pages" for the large rows?
    Thursday, July 19, 2012 4:54 PM

Answers

  • Hi Jagtattoo

    Which version of Word are you using?

    If I look at this dialog box I only see a row height if it has been set "exactly" or "at least". And if it's set to "At least" then it only gives that value, not the actual height.

    Things that Word recalculates steadily and dynamically are almost impossible to measure because Word is constantly laying out the page, so the value could change at any moment. This includes line breaks, the content of the page and... the height of a table row.

    You can get an approximate value using Range.Information(wdVerticalPositionRelativeToPage). You get the value for the top of the cell and the bottom of the cell. The information will be in Points. To that you need to add any cell padding as well as any SpaceBefore or SpaceAfter for the paragraphs. You also need to allow for the width of any borders.


    Cindy Meister, VSTO/Word MVP

    Friday, July 20, 2012 2:12 PM
    Moderator

All replies

  • The Height property only returns the actual height of a row if you have specified a fixed row height.

    Stefan Blom, Microsoft Word MVP
    Thursday, July 19, 2012 6:14 PM
  • Hi Jagtattoo

    Which version of Word are you using?

    If I look at this dialog box I only see a row height if it has been set "exactly" or "at least". And if it's set to "At least" then it only gives that value, not the actual height.

    Things that Word recalculates steadily and dynamically are almost impossible to measure because Word is constantly laying out the page, so the value could change at any moment. This includes line breaks, the content of the page and... the height of a table row.

    You can get an approximate value using Range.Information(wdVerticalPositionRelativeToPage). You get the value for the top of the cell and the bottom of the cell. The information will be in Points. To that you need to add any cell padding as well as any SpaceBefore or SpaceAfter for the paragraphs. You also need to allow for the width of any borders.


    Cindy Meister, VSTO/Word MVP

    Friday, July 20, 2012 2:12 PM
    Moderator