Free Support Forum - aspose.com

Object Refernce Excption in chart.Calculate()

I am attaching an Excel sheet SheetToImage5.xls. After creating the chart and setting the legend entries, whne I try to set the legend position, I get an Object refernce exception at chart.Calculate().

And If I skip this exception, Later there is another Exception when I do a sheetToImage() of the datasheet after moving the chart from the chartsheet to the datasheet SheetToImage6.xls.

at xca8760282b42bbab.x9df292ba4ce0deb4.x6b954dbb3dc99d95(Graphics x4b101060f4767186, xa42a8eb21319f8e0 x5f12ae7e2f404c29, Boolean xc26589ea542f35ae, x25d8d5ee28751509 x602160082f842d31, Rectangle x26545669838eb36e)
at xca8760282b42bbab.x9df292ba4ce0deb4.x843efad547b0e28d(Graphics x4b101060f4767186, xa42a8eb21319f8e0 x5f12ae7e2f404c29, Double xdb117c7e5c899e75, Double x97edb4541d2ddc2e, ArrayList xd730cb4124bea950, x13c22d4630b556cf xbde1c5dae4a66939, Rectangle x26545669838eb36e, Boolean xc26589ea542f35ae, x25d8d5ee28751509 x602160082f842d31)
at xca8760282b42bbab.x9df292ba4ce0deb4.xb1de1ba20faeeff8(xadd4c32f6c1949e6 xe640ebcce83ddadc)
at xca8760282b42bbab.x9df292ba4ce0deb4.xe406325e56f74b46(xadd4c32f6c1949e6 xe640ebcce83ddadc)
at xca8760282b42bbab.x66d37b2f200606fd.xe406325e56f74b46(xadd4c32f6c1949e6 xe640ebcce83ddadc)
at xca8760282b42bbab.x66d37b2f200606fd.xe95b6e626432c388(String xafe2f3653ee64ebc, Stream xcf18e5243f8d5fd3, xadd4c32f6c1949e6 xe640ebcce83ddadc)
at xca8760282b42bbab.x66d37b2f200606fd.x0acd3c2012ea2ee8(Stream xcf18e5243f8d5fd3, ImageFormat x0d9146d51b0e6ca4, xadd4c32f6c1949e6 xe640ebcce83ddadc)
at xdbee2485dd320290.xadd4c32f6c1949e6.x0acd3c2012ea2ee8(Stream xcf18e5243f8d5fd3, ImageFormat x0d9146d51b0e6ca4)
at x9d2539cac3622db3.xe8b1095571de92b1.x83e84e1d3bc59160(Stream xcf18e5243f8d5fd3, ImageFormat x0d9146d51b0e6ca4, Chart xe640ebcce83ddadc)
at Aspose.Cells.Chart.ToImage(Stream stream, ImageFormat imageFormat)
at xd8ca772c9f198583.x658c13c9c9ee7e4d.x33b586adc018466f(x33b586adc018466f x88b868adf337f33b)
at xd8ca772c9f198583.x658c13c9c9ee7e4d.xf597a57dbb4543d0(Int32 x69e9b567129e96cb, String xb469c015ff0466a1)
at xd8ca772c9f198583.x658c13c9c9ee7e4d.x83e84e1d3bc59160(Boolean x6fb303b00fe33226, Int32 xc0c4c459c6ccbd00)
at Aspose.Cells.Worksheet.SheetToImage(Boolean isPaginate)
at Aspose.Cells.Worksheet.SheetToImage()
at OfficeExport.Services.Presentation.SlideBuilder.CreateSlide(OfficeSlide officeSlide, ApplicationInfo appInfo, String sourceURL, OfficeRenderedSheet renderedSheet)

Hi,

"I am attaching an Excel sheet SheetToImage5.xls. After creating the
chart and setting the legend entries, whne I try to set the legend
position, I get an Object refernce exception at chart.Calculate().

And If I skip this exception, Later there is another Exception when I do a sheetToImage() of the datasheet after moving the chart from the chartsheet to the datasheet SheetToImage6.xls."

I have tested both your scenarios and found both the issues as you mentioned. We will figure it out soon.


Your issue has been logged into our internal issue tracking system with an issue id: CELLSNET-11783.


Thank you.

Hi,

Thank you for considering Aspose.

Please try the attached latest version of Aspose.Cells. If you still find any issue, please provide us the sample code and we will check it soon.

Thank You & Best Regards,

I checked the new dll. The Legend Overlap issue and the chart.Calculate issue seemed to be fixed. But I see new issues. The complete chart is not visible. Sometimes the Axis lable is cut and at other times, the Axis itslef is not visible. Moreover not all the items of the legend are visible. In the attached chart there are 10 legend items, however only 7 are visible. Please suggest.

Without the chart displaying completely with the Axis and the Axis Labels, this fix has no meaning. This is quiet urgent for us to Fix. Request you to please look into the issue ASAP and suggest.

Hi,

Well, you must set the height of plot area at the same time.
e.g.

int y = chart.Legend.Y;

int height = chart.Legend.Height;

int originalY = chart.PlotArea.Y;

chart.PlotArea.Y = y + (int)(height * 4000f / chart.ChartObject.HeightPt) + 150;

//You may set other value too
chart.PlotArea.Height -= (chart.PlotArea.Y - originalY);


Thank you.

Thanks for the suggestion. With this the chart is perfect. Just one issue still exists. The Legend does not display all the members. The attached chart has 10 legend items, however only 7 are displayed.

Hi,

The items of legend not shown fully are actually caused by the height of legend box being small.

There are two way to fix it.

1) Add the height of legend.
int y = chart.Legend.Y;
//Adds height of legend
chart.Legend.Height += chart.Legend.Height / 4;
int height = chart.Legend.Height;

int originalY = chart.PlotArea.Y;

chart.PlotArea.Y = y + (int)(height * 4000f / chart.ChartObject.HeightPt) + 150;

chart.PlotArea.Height -= (chart.PlotArea.Y - originalY);

2) Make the legend display 2 items at 1 row
int y = chart.Legend.Y;
//Adds width of legend
chart.Legend.Height -= chart.Legend.Height / 4;
chart.Legend.Width += chart.Legend.Width;

int height = chart.Legend.Height;

int originalY = chart.PlotArea.Y;

chart.PlotArea.Y = y + (int)(height * 4000f / chart.ChartObject.HeightPt) + 150;

chart.PlotArea.Height -= (chart.PlotArea.Y - originalY);


Thank you.

The issues you have found earlier (filed as 11783) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.