We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Bug in the computation of shape Height and Top properties

Thread ID:

Created:

Updated:

Platform:

Replies:

53406 Dec 13,2006 11:44 AM UTC Dec 14,2006 09:06 AM UTC Windows Forms 2
loading
Tags: XlsIO
Bill Seddon
Asked On December 13, 2006 11:44 AM UTC

XlsIO is report the wrong height for a shape when the shape lies over a hidden row.

XlsIO assembly: 4.4.401.50

How to reproduce:

1. Create a chart and arrange that it lies over, say, 4 columns and 10 rows. It doesn't have to line up with column/row edges. Create a second chart and arrange for it to be directly below (but not overlapping) the first chart.

2. Measure the dimensions of both charts(for example by using a Paint tool) and make a note of their top and left positions as well.

3. In code grab the shape from both IChart objects (IShape shape = chart as IShape) and confirm that the IShape.Top, IShape.Left, IShape.Height and IShape.Width match the measurements taken using the graphics tool.

4. Now hide one of the columns and one of the rows that are covered by the first (uppermost) chart. The column/row selected should not be only partially covered by the chart.

5. Now repeat step 3. to obtain the dimensions of the chart once again.

While the chart has visibly changed size of height for the first (uppermost) chart reported by XlsIO is unchanged while the width has changed by the width of the hidden column.

The value of the Top property of the second (lower) chart has not changed while it should have decreased by the height of the hidden row.

Of course you might argue that these are the values they are supposed to have. However there are two arguements against this position. The first is that columns behave correctly. The width of the chart is changed by the width of the hidden column and the left position of any charts place to the right are adjusted as you'd expect. The second is that VBA code reporting on the dimensions of the shapes agrees with the column and disagrees with the row dimensions of the chart after hiding rows and columns.

Part of the explanation maybe the IWorksheet.GetRowHeightInPixels() value of a hidden row is reported to have a non-zero value whereas a hidden column reports a IWorksheet.GetColumnWidthInPixels() of zero. I believe that the mechanism underlying the erroneous reporting of a non-zero row height value for hidden rows is affecting the calculation of the image height.

Bill Seddon

Bill Seddon
Replied On December 13, 2006 07:31 PM UTC

I think that the solution to this problem is to change line 191 of RowRecord.cs from:

return m_usHeigth;

to:

return (m_bZeroHeight ? (ushort)0 : m_usHeigth);

This has the effect of returning a height of zero if the row record indicates that the row should have no height but does so in a way that does not destroy the height of the row in case the row is restored.

With this fix in place, the ShapeImpl.GetHeight() method returns a correct height for shapes.

Melba Winshia [Syncfusion]
Replied On December 14, 2006 09:06 AM UTC

Hi Bill,

Thank you for your valuable suggestion. I will forward this to the development team. Please let me know if you have any other questions.

Thanks,
Melba

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;