Why am I not able to draw charts using Aspose?

Hi , I was trying to draw charts in my workbook using the code

Chart chartVolumeByModelClass = sheet1.Charts[sheet1.Charts.Add(ChartType.Pie3DExploded, 87, 2, 102, 5)];

chartVolumeByModelClass.NSeries.Add("Present_Data!C13:C24",true);

chartVolumeByModelClass.NSeries.CategoryData = "Present_Data!B13:B24";

chartVolumeByModelClass.NSeries.IsColorVaried = true;

First I got a message Box with the following message

"Excel Found unreadable content in 'Recommendation Report.Xlsx'.Do you want to recover the contents of this workbook?If you trust the source of
this workbook, click Yes"

when I clicked Yes I got another box which asked me to click on the link to view logfile. The logfile Contained following message

"<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- http://schemas.openxmlformats.org/spreadsheetml/2006/main">
error007640_02.xml

Errors were detected in file 'C:\Documents and Settings\rambala\Desktop\sot\1.0 (2008)\SiteOptimizationTool\bin\Debug\Recommendation Report.xlsx'
-
Removed Part: /xl/drawings/drawing1.xml part. (Drawing shape)

"


can anyone please help me out with this.? Thanks

Hi,

Sorry, chart is not supported for Excel 2007 xlsx files yet. We are still working on this feature.

In some previous versions, charts info is also exported when saved in .xlsx file format, and they may be inaccuracy and may cause file error. We fixed the issue in the latest release. Chart info will no longer been export to .xlsx file until this feature is accomplished.

Please try the attached fix, it will not export chart info to .xlsx file format.

Thank you.


Karen.huang
Developer
Aspose Nanjing Team
About Us
Contact Us

Can you tell me by what time will you include the feature of charts in Aspose that support 2007 Excel. If there is any estimated time frame please let me know, because I have wrote lot of code using Aspose for 2007 Excel, and now if it doesnt support 2007 excel for charts, I have to rewrite entire code again in some other alternate way, and it approximately takes 10 days for me to rewrite the code.

Thanks.

Hi,

Thanks for considering Aspose.

We will update you soon.

Thank you.

Hi,

Hopefully we can support importing and exporting the following chart type for .xlsx file format before the end of next month:

Bar,

BarStacked,

Bar100PercentStacked,

Column,

ColumnStacked,

Column100PercentStacked,

Line,

LineStacked,

Line100PercentStacked,

LineWithDataMarkers,

LineStackedWithDataMarkers,

Line100PercentStackedWithDataMarkers,

Pie

Thank you.


Karen.huang
Developer
Aspose Nanjing Team
About Us
Contact Us

Hi, I have changed to Excel 2003, and I tried to generate pieExploded charts from the data ,

I have wrote the following code , but the chart is not generated, instead I only get a vertical line in place of the chart. I'm attaching my output file, please look at it for reference. Please tell me where am I doing wrong.

Thanks.

Chart volumeByModelClassCurrentChart = sheet1.Charts[sheet1.Charts.Add(ChartType.PieExploded,87,3,102,7)];

volumeByModelClassCurrentChart.Title.Text = "Volume by Model Class";

volumeByModelClassCurrentChart.Title.TextFont.IsBold = true;

volumeByModelClassCurrentChart.NSeries.Add("Present_Data!C13:C24",true);

volumeByModelClassCurrentChart.NSeries.CategoryData = "Present_Data!B13:B24";

volumeByModelClassCurrentChart.NSeries.IsColorVaried = true;

volumeByModelClassCurrentChart.Legend.Position = LegendPositionType.Bottom;

volumeByModelClassCurrentChart.Legend.TextFont.Size = 6;

volumeByModelClassCurrentChart.Legend.Border.IsVisible = false;

Hi,

I tested creating pie exploded chart with the following sample code and it works fine, the output file (attached) has the perfect chart.

Code:

//Create a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet.
Worksheet sheet = workbook.Worksheets[0];
//Set the name of worksheet
sheet.Name = "Data";
//Get the cells collection in the sheet.
Cells cells = workbook.Worksheets[0].Cells;
//Put some values into a cells of the Data sheet.
cells["A1"].PutValue("Region");
cells["A2"].PutValue("France");
cells["A3"].PutValue("Germany");
cells["A4"].PutValue("England");
cells["A5"].PutValue("Sweden");
cells["A6"].PutValue("Italy");
cells["A7"].PutValue("Spain");
cells["A8"].PutValue("Portugal");
cells["B1"].PutValue("Sale");
cells["B2"].PutValue(70000);
cells["B3"].PutValue(55000);
cells["B4"].PutValue(30000);
cells["B5"].PutValue(40000);
cells["B6"].PutValue(35000);
cells["B7"].PutValue(32000);
cells["B8"].PutValue(10000);

//Create chart
int chartIndex = 0;
chartIndex = sheet.Charts.Add(ChartType.Pie3DExploded,15,1,40,10);
Chart chart = sheet.Charts[chartIndex];

//Set properties of chart title
chart.Title.Text = "Sales By Region";
chart.Title.TextFont.Name = "Tahoma";
chart.Title.TextFont.Color = Color.Blue;
chart.Title.TextFont.IsBold = true;
chart.Title.TextFont.Size = 12;
//Set properties of nseries
chart.NSeries.Add("Data!B2:B8", true);
chart.NSeries.CategoryData = "Data!A2:A8";
chart.NSeries.IsColorVaried = true;
//Set the DataLabels in the chart
DataLabels datalabels;
for ( int i = 0; i < chart.NSeries.Count ;i ++ )
{
datalabels = chart.NSeries[i].DataLabels;
//datalabels.Postion = LabelPositionType.InsideBase;
datalabels.IsCategoryNameShown = false;
datalabels.IsValueShown = false;
//datalabels.TextFont.IsBold = true;
//datalabels.TextFont.Size = 13;
//datalabels.NumberFormat = "0.0%";
datalabels.IsPercentageShown = true;
datalabels.IsLegendKeyShown = false;

}


//Set the Legend.
Legend legend = chart.Legend;
legend.Position = LegendPositionType.Left;
legend.Height = 100;
legend.Width = 130;
legend.Y= 1500;
legend.TextFont.IsBold= true;
legend.Border.Color = Color.Blue;
legend.Area.Formatting = FormattingType.Custom;
//Set FillFormat.
FillFormat fillformat = legend.Area.FillFormat;
fillformat.Texture = TextureType.Bouquet;
//Save the excel file
workbook.Save("d:\\test\\pie_explodedchart.xls");
The part of code you pasted seems to me fine. But could you create a sample test code similar to mine to show the issue. And are you using some template file. If so could you paste your code and attach the template file.
Thank you.

I'm using excel template file, I have attached it. The code I'm using to open the file is

protected override void OnLoad(EventArgs e)

{

_presenter.OnViewReady();

string fileName = "Recommendation Report2.xls";

this.RecommendationReport(fileName);

Process.Start(fileName);

base.OnLoad(e);

}

public void RecommendationReport(string fileName)

{

Workbook workbook = new Workbook();

string designerFile = ConfigurationSettings.AppSettings["RecommendationReportTemplatePath"];

workbook.Open(designerFile,FileFormatType.Excel2003);

---

---

}

I dont understand why its not working for me. I'm using excel 2003, this shouldn't create problem working with charts I guess.

Thanks.

sorry, I got the output. The mistake I was doing is Cells[ ].putValue( intvalue.toString()); I was converting integer values to string. that's the reason I didnt get the charts. Now its working superbly.

sorry for troubling you people. Thanks

yes it's an improvement for us, and we need the distributable version of the file. Can you tell me how to get the distributable version of aspose.dll file?

Thanks.

Hi,

We will get back to you soon.

Thanks for being patient!