Free Support Forum - aspose.com

Plotting chart in excel template

Hi

I am using excel 2003 and i want to know whether Aspose.cells is providing the below features:

1) In the template excel file (excel file with client logo etc), i need to draw chart. Multiple charts need to be plotted on different sheet with the logo on each sheet.

2) Chart sheet and datasheet need to be in the same sheet. Chart at the top and datasheet at the bottom. On changing the datasheet, chart need to be changed

3) In a seperate sheet without chart, whether data can be formatted. Like merging of header cells, coloring the header etc.

I could add a chart only on the sheettype.chart like in the sample code below. But in the samples, i could find the charts has been added to ordinary worksheet. Is there any restrictions on the same.

int chartSheetIdx = wb.Worksheets.Add(SheetType.Chart);
Worksheet chartSheet = wb.Worksheets[chartSheetIdx];
chartSheet.Name = "ChartSheet";

//Add a chart in ChartSheet with data series from DataSheet
int chartIdx = chartSheet.Charts.Add(ChartType.LineWithDataMarkers, 200, chartRows, 700, chartCols);

Also, it would be great if i could get details of license and purchase cost for Aspose.Cells

--
Thanks & Regards
Sridevi

Hi Sriravi,

Thanks for your inquiry.


Well, Aspose.Cells for .NET does support to create MS Excel charts from the scratch or manipulate existing charts in the template excel files with ease.

Sriravi:

1) In the template excel file (excel file with client logo etc), i need to draw chart. Multiple charts need to be plotted on different sheet with the logo on each sheet.

Yes, you can do it. You may add/copy or move worksheets in a workbook or in b/w workbooks: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/copying-and-moving-worksheets.html You can set images in headers/footers of the sheet pages: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/setting-headers-and-footers.html , also, you can set the background image for the sheet using the API: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/set-background-picture-for-a-worksheet.html

For creating/manipulating charts see the documents in the section:

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/creating-charts.html


Sriravi:

2) Chart sheet and datasheet need to be in the same sheet. Chart at the top and datasheet at the bottom. On changing the datasheet, chart need to be changed

Yes, you may do it with ease, see the sample code

e.g

//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Workbook object
int sheetIndex = workbook.Worksheets.Add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[sheetIndex];
//Adding a sample value to "A21" cell
worksheet.Cells["A21"].PutValue(50);
//Adding a sample value to "A22" cell
worksheet.Cells["A22"].PutValue(100);
//Adding a sample value to "A23" cell
worksheet.Cells["A23"].PutValue(150);
//Adding a sample value to "A24" cell
worksheet.Cells["A24"].PutValue(200);
//Adding a sample value to "B21" cell
worksheet.Cells["B21"].PutValue(60);
//Adding a sample value to "B22" cell
worksheet.Cells["B22"].PutValue(32);
//Adding a sample value to "B23" cell
worksheet.Cells["B23"].PutValue(50);
//Adding a sample value to "B24" cell
worksheet.Cells["B24"].PutValue(40);
//Adding a chart to the common worksheet
int chartIndex = worksheet.Charts.Add(ChartType.Scatter, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
Chart chart = worksheet.Charts[chartIndex];
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
chart.NSeries.Add("A21:B24", true);

//Saving the Excel file
workbook.Save("e:\\test\\outScatter_Test.xls", FileFormatType.Default);

Sriravi:

3) In a seperate sheet without chart, whether data can be formatted. Like merging of header cells, coloring the header etc.

I could add a chart only on the sheettype.chart like in the sample code below. But in the samples, i could find the charts has been added to ordinary worksheet. Is there any restrictions on the same.

Yes, you may implement data formatting in other worksheets for your need. See some documents for reference:

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/merging-unmerging-cells-in-the-worksheet.html

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/dealing-with-font-settings.html

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/setting-display-formats-of-numbers-dates.html

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/approaches-to-format-data-in-cells.html


Moreover, you may add common sheets or chart sheets for your need.

e.g.

//To add a chart in the common/ordinary sheet.

int chartSheetIdx = wb.Worksheets.Add();
Worksheet sheet = wb.Worksheets[chartSheetIdx];
sheet.Name = "ChartSheet";

//Add a chart in Sheet with data series from DataSheet
int chartIdx = sheet.Charts.Add(ChartType.LineWithDataMarkers, 200, chartRows, 700, chartCols);

Also, it would be great if i could get details of license and purchase cost for Aspose.Cells



Also, check some live demos for Charts for your reference:
http://www.aspose.com/demos/.net-components/aspose.cells/csharp/chart-types/default.aspx


Hi,

"Also, it would be great if i could get details of license and purchase cost for Aspose.Cells"

For sales/purchase inquires, please contact or post a query in Aspose.Purchase forum: http://www.aspose.com/community/forums/aspose.purchase/220/showforum.aspx

and one of our sales representative would reply you shortly.

Thank you and have a good day!