Last Row in Table

Last Row in Table

Forum member · Oct 12, 2009
Hi, I am using a table object with unknown number of rows. My table size is 1800. How do I find the last row in the table and the height of the last row? So that I can shrink the text to fit in the last row. Thanks, Sai.

Re: Last Row in Table

Support · Oct 12, 2009
Hello Sai, You can access the last row without any problem by using the Row collection. By specifying the last row index you can do this. You can get the last row index by using the count property on the row collection. Below is a sample line to get the actual height of the last row. table.Rows[table.Rows.Count - 1].ActualRowHeight; If you are having any problem then please be more specific about the requirement you are having so that we can help you further. Thanks, ceTe Software Support Team.

Re: Last Row in Table

Forum member · Oct 12, 2009
Hi, Thanks for your reply. I am using GetOverflowRows to display the overflow rows on new page. If the text is too big in the last row it moves the entire row to next page. I don't want that to be happened. I want to find out the last row and the remaining height left in the table and want to manually split the text into rows. So that I will display some text on first page and the remaining text on the next page. Thanks, Sai.

Re: Last Row in Table

Support · Oct 12, 2009
Hello Sai, When the row has more text than it can fit in the available space then it will take the total row to the next page without splitting the row. It is not possible to split the row when using the GetOverflowRows method. You will have to keep track of the available height on the page by using a variable to check if the last row fits in that or not. You can get the text of the cell by using the below line of code. string text = table.Rows[table.Rows.Count - 1].Cells[cellIndex].Text; You will have to split this text depending on your conditions so that it should fit the available space and then reset the cells text to the new text. table.Rows[table.Rows.Count - 1].Cells[cellIndex].Text = "changed to new text"; You will have to add the remaining text in another page by using the Label or Text Area page elements. This work around may work for you. Thanks, ceTe Software Support Team.

Re: Last Row in Table

Forum member · Oct 12, 2009
Hi, How do I keep track of the available table height on the page? I am new to this tool please bear with my quesitons. Thanks, Sai.

Re: Last Row in Table

Support · Oct 13, 2009
Hello Sai, Using the table properties you can get the table height, required height for the table by using the Height property and GetRequiredHeight method respectively. You can refer to the Table Class Members on our help documentation. By comparing the table's required height and the height available on the page you can reset the height of the table and take the overflow. The GetVisibleHeight method returns the visible height of the table on page. You will be able to track the position on the page currently where you are working by comparing the table and page heights. To know the Y position on the page you will have to consider the height of the other elements also if you are having any. If this does not help you then please be more specific about the requirement you have and send a mail to our [^a|mailto:support@cete.com|Support Team^] so that they can help you further. Thanks, ceTe Software Support Team.