GetHeightOfValue returns a value too high

I have a report where the cells (startRowIndex = 7, endRowIndex = 26, startColumnIndex = 4, endColumnIndex = 6 are merged. In that merged area I am putting a big chunk of text.
I estimated that the number of characters that can fit in would be ~ 1650 so I am trying to keep it close and less than that. Now, still, occasionally the chunk of text gets cut off at the bottom (due to too many new line characters in the ext which increases the space occupied with less characters) so I need the height of the merged area to fit the height of the text in those fringe cases.

I used GetHeightOfValue examples to add to the last row some pixels. If for example GetHeightOfValue() returned 600px and the summed up total height of the rows of the merged area was 484, I added the difference 116 to the last row. However it always seems too much so I end up with huge gaps at the bottom of the merged cells.
Even pages where the chunk of text fits and still has room with no adjustments needed, GetHeightOfValue() says the height of the value is bigger than the height of the merged cell.
Do you have any hypothesis?
.
Thanks,
Mircea

@mircea-ion,

Thanks for providing us some details.

Well, GetHeightOfValue() might not give you correct height in a merged area/range of cells. It is better you use AutoFitRow(s) function specifying AutoFitterOptions’ relevant attribute to fit the text in a merged area, see the documents with examples for your reference:

Hope, this helps a bit.

I’ve seen one of the links in another post.
I tried the AutoFitterOptions class, passing an instance to that overload of the AutoFitRows and passing as a row the first row of the merged area. For the next two arguments I passed the index of the left and right border columns in my range.
I have only Aspose.Cells 18.x and the latest enumeration based AutoFitterOptions exists only in the latest versions. Nonetheless I tried both the boolean value based version and I tried the enumeration based one too.
For the first one it increased the height a lot for one of the rows but for no apparent reason except that it had a few bottom aligned cells to the right but outside the range. The documentation is lacking so most of the time I am not sure what should be specified. The lack of solid examples is another downside.

When using the enumeration based AutoFitter I chose to have the last row adjusted as it fitted better my requirements. This time it actually shrunk that last row in some occasions and the only reason was a value in a cell to the right which again not inside the range.

I could try to put something together as a sample but I thought picking your brain ahead of time and maybe not bother if this is work in progress.

Cheers.

@mircea-ion,

Thanks for providing further details.

We did include more enhancements on AutoFit Rows for Merged Cells in latest versions (e.g Aspose.Cells v19.3, Aspose.Cells v19.4). We appreciate if you could create a sample console demo application (runnable) using v19.4, zip the project and post us here to reproduce the issue on our end. We will check and try to figure it out soon. Also, attach your template files (input, output file(s) etc.).