Wrong Row Height being provided

Hello,

We noticed an issue recently with Aspose providing the wrong row height for certain rows.

Please paste the following code into a console app of some sort while replacing the empty string in the first line with the filepath of the test file attached below:

        var workbook = new Aspose.Cells.Workbook(@"");
        var driversworksheet = workbook.Worksheets["Drivers"];
        var firstRow = driversworksheet.Cells.GetRowHeight(1);
        var secondRow = driversworksheet.Cells.GetRowHeight(2);

        Console.WriteLine("Height of first row is: " + firstRow);
        Console.WriteLine("Height of second row is: " + secondRow);
        Console.ReadKey();

In the attached zip file, you will find a test workbook. When you run the program above, you’ll see that it outputs what Aspose thinks is the height of the first two rows. However, if you open up the test model and look at the actual rows, you’ll find that the first row’s row height was not read properly.

Please let me know if you have any questions, thank you!

TestModel.zip (42.5 KB)

@jasonleecanalyst,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-47793 - Wrong Row Height being provided

@jasonleecanalyst,

Your code is not right. Please note row indices are zero based, so you need to change the lines of code:
i.e.,

var firstRow = driversworksheet.Cells.GetRowHeight(1);
var secondRow = driversworksheet.Cells.GetRowHeight(2);

to:

var firstRow = driversworksheet.Cells.GetRowHeight(0);
var secondRow = driversworksheet.Cells.GetRowHeight(1); 

to get correct results.

Let us know if you still find any issue.

Hi, sorry for that mistake, but the issue can still be observed in this workbook here even after correcting the code:
TestModel.zip (554.8 KB)

@jasonleecanalyst,

Which worksheet and for which rows, you are getting issue? Could you also share your code segment to reproduce the issue, we will check it soon.

    var workbook = new Aspose.Cells.Workbook(@"");
    var driversworksheet = workbook.Worksheets["Drivers"];
    var firstRow = driversworksheet.Cells.GetRowHeight(0);
    var secondRow = driversworksheet.Cells.GetRowHeight(1);

    Console.WriteLine("Height of first row is: " + firstRow);
    Console.WriteLine("Height of second row is: " + secondRow);
    Console.ReadKey();

Using the same code above (now with fixed 0-based indexing), you still see the issue in the worksheet titled “Drivers” and in row 1.

@jasonleecanalyst,

You are right. Using your newly attached file with your code segment, we can reproduce the issue now. We got 12.75 for both rows (first and second). We have reopened your ticket (logged earlier as “CELLSNET-47793”) and we will look into it soon.

@jasonleecanalyst,

This is not an issue with the APIs as we found the cached row height in your provided file. Please unzip the XLSX file and check sheet2.xml, you can see:
<row r="1" spans="1:55" ht="12.75">
Please auto-fit row height when loading the file as the following codes:
e.g
Sample code:

LoadOptions options = new LoadOptions();
options.AutoFitterOptions = new AutoFitterOptions();
options.AutoFitterOptions.OnlyAuto = true;
var workbook = new Aspose.Cells.Workbook(dir + "TestModel.xlsx", options);
var driversworksheet = workbook.Worksheets["Drivers"];
var firstRow = driversworksheet.Cells.GetRowHeight(0);
var secondRow = driversworksheet.Cells.GetRowHeight(1);

```
Console.WriteLine("Height of first row is: " + firstRow);
Console.WriteLine("Height of second row is: " + secondRow);
```