We have been trying to create a chart on a webworksheet but with no success. We managed to do this on a normal Workbook - Worksheet but since we use a web platform for our applications we need this to work on the WebGrid for reports.
Hi,
We have supported to import chart and shape images from excel files in Aspose.Cells.GridWeb v2.6.0.2002.
Please update the dll and acwmain.js files.
Hi,
- Generate a Chart from the code behind and put it onto a Webgrid next to the data.
- Or even better have a Chart generated dynamically from existing data on the Webgrid.
Hi,
You are right, both should work fine.
Did you see our offlines demos of GridWeb? You can run them in Visual Studio 2005 or 2008 or 2010, whatever is available to you.
I will highly recommend you to use our offline demos, it will help you increase your knowledge and skill of Aspose.Cells gridweb manifold.
Please visit this link and download: Aspose.Cells.GridWeb C# Demos
http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/category1129.aspx
Please do readme.txt file before running the demos.
Hi,
Any updates on the above please?
Hi,
Sorry for late update. We will look into this issue and provide you a code example. We need more time and we will get back to you asap.
Thanks for your patience.
Thanks!
Hi,
Please see the code below and the sample. It first creates a chart using Aspose.Cells for .NET then it imports the output excel file into GridWeb using Aspose.Cells for GridWeb
Please see the screenshot. For your more help, I have attached the complete project.
C#
//Create a workbook with a chart using Aspose.Cells
//and then import it into GridWeb using Aspose.Cells.GridWeb
Workbook workbook = new Workbook();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Aspose.Cells.Worksheet worksheet = workbook.Worksheets[0];
//Adding a sample value to “A1” cell
worksheet.Cells[“A1”].PutValue(50);
//Adding a sample value to “A2” cell
worksheet.Cells[“A2”].PutValue(100);
//Adding a sample value to “A3” cell
worksheet.Cells[“A3”].PutValue(150);
//Adding a sample value to “B1” cell
worksheet.Cells[“B1”].PutValue(4);
//Adding a sample value to “B2” cell
worksheet.Cells[“B2”].PutValue(20);
//Adding a sample value to “B3” cell
worksheet.Cells[“B3”].PutValue(50);
//Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Column3D, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];
//Adding SeriesCollection (chart data source) to the chart ranging from “A1” cell to “B3”
chart.NSeries.Add(“A1:B3”, true);
//Save the workbook into memory stream
MemoryStream ms = new MemoryStream();
workbook.Save(ms, SaveFormat.Xlsx);
ms.Position = 0;
//Import the excel file with chart into gridweb
GridWeb1.WebWorksheets.ImportExcelFile(ms);
Thank you for your help, unfortunately it seems that it is still not working.
Hi,
Thanks for your feedback. We will look into your project soon and update you asap.
Hi,
Please don’t forget to update the dll and acwmain.js files in the zipped archive too.
Hi,
Please copy “acw_client” folder with files (according to Aspose.Cells.GridWeb v2.6.0.2002) into your project, and add these configurations into appSettings section in your web.config:
<add key=“aspose.cells.gridweb.acw_client_path” value=“~/acw_client/”/>
<add key=“aspose.cells.gridweb.force_script_path” value=“true”/>
<add key=“aspose.cells.gridweb.forcepath” value=“true”/>
Your project works fine now.