Comment Shape X / Y doesn't appear exact

We are trying to render a Spreadsheet in a browser from information that we have extracted using Aspose.Cells (17.11 for .NET). I’m running into issues where the X / Y for a Comment shape does NOT appear to match up exactly with how/where we see the Comment shape in Excel. I’m using the X & Y Property on the Comment Shape (Shape.X | Aspose.Cells for .NET API Reference & Shape.Y | Aspose.Cells for .NET API Reference) - which should give us the correct offset, in pixels, from the worksheet left border and top border.

The weirdness comes when we place the comment shape (using X & Y) in conjunction with the rows and columns. I use the methods GetColumnWidthPixel (Cells.GetColumnWidthPixel | Aspose.Cells for .NET API Reference) and GetRowHeightPixel (Cells.GetRowHeightPixel | Aspose.Cells for .NET API Reference) to figure out the row height and column width in pixels. So, when I look at X & Y on the comment shape, it should be pretty close to adding up all the row heights in pixel above the start of that comment shape and adding up all the column widths in pixel to the left of the start of the comment shape. (Then, of course, there’s the amount of pixels within the cell before the top left corner of the comment shape)

But, in some of our worksheets, it’s not matching up. The Y can be 100 pixels off and the X can be 50. Is my math faulty? Do the X / Y of comment shapes correlate to the Row Height and Column Width - in pixels?

Thank you so much for your help!

Regards,
Jamie

@caramanica

Thanks for using Aspose APIs.

For precise measurement, you will also have to include upper and lower delta values in calculation. The following properties should help you fix your issue.

Shape.X
Shape.Y
-------------------------
Shape.LeftToCorner
Shape.TopToCorner
-------------------------
Shape.UpperDeltaX
Shape.UpperDeltaY
Shape.LowerDeltaX
Shape.LowerDeltaY
-------------------------
Shape.UpperLeftColumn
Shape.UpperLeftRow
Shape.LowerRightColumn
Shape.LowerRightRow