Free Support Forum - aspose.com

RowFormat.Height not returning current value

Sorry guys, me again :slight_smile:
Don’t wanna waste your weekend, but having another little issue here. It seems that
RowFormat.Height is not returning the updated value. I have a document with a table and I fill that table with the Mail Merge function. Some rows then have 3 lines and some 4 or 5. To calculate the right line break, I tried to record the REAL height of every column, but unfortunatly RowFormat.Height always seems to return the same number.

public class CollectRowHeightsInTable : DocumentVisitor
{

public override VisitorAction VisitRowEnd(Aspose.Words.Tables.Row row)
{
double height = row.RowFormat.Height;

return VisitorAction.Continue;
}
}

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Unfortunately, there is no way to get Row height using Aspose.Words. If you try setting fixed row height you will get this height using the code from you previous post.

Height of row in MS Word depends on content inside and calculates on the fly.

Best regards,

So there is no way to figure out how high the actual row is? I don’t need to set the height, just calculate how much space is already used up to place the page break at the right row.

I saw there is a post that asks how many lines of text a row contains, but it didn’t really solve the issue either. But if I know how many lines are used, I could somewhat calculate the page break too.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Unfortunately, there is no way to achieve this. This is actually rendering task, and it is not so easily to achieve this as it sounds.

Best regards,

Ok, I understand :slight_smile:

Do you have some good alternative idea how to achive that?

Hi

Thanks for your inquiry. Unfortunately, it is difficult to suggest you any good way to achieve this. As Andrey already mentioned, this is rendering task and it is quite complex. To calculate height of Row, you should first layout text in each cell of row into lines. For this you should know widht of each cell and width of each character, which can vary depending on font size and formating.

Best regards.