Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Feb 12, 2019 1:22 pm

Hello im Back again... :lol:

Im searching for any ways to Create Charts without writing this Data into datasources...

i want to create an chart and write data direct into this chart

a little bit like in OpenXML

Code: Select all
BarChartSeries barChartSeries = barChart.AppendChild(new BarChartSeries(
                        new Index() { Val = (uint)i },
                        new Order() { Val = (uint)i },
                        new SeriesText(new NumericValue() { Text = students[i].Name })
                    ));

Semjasa
 
Posts: 36
Joined: Wed Dec 19, 2018 11:50 am

Wed Feb 13, 2019 7:07 am

Hello Semjasa,

Thanks for your post.
Please refer to the following sample code to achieve your requirement. If there is any question, just feel free to contact us.
Code: Select all
Workbook wb = new Workbook();
wb.LoadFromFile(@"sample.xlsx");
//Get the first worksheet
Worksheet sheet = wb.Worksheets[0];
//Add a chart to the worksheet
Chart chart = sheet.Charts.Add();
//Add a serie for the chart
var serie = chart.Series.Add();
//Add datas
serie.EnteredDirectlyValues = new object[] { 10, 20, 30};
wb.SaveToFile("result.xlsx",ExcelVersion.Version2013);

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Thu Feb 14, 2019 7:17 am

:shock:
THX, I'm blind.

im so sorry

nice support!

Semjasa
 
Posts: 36
Joined: Wed Dec 19, 2018 11:50 am

Thu Feb 14, 2019 8:23 am

Dear Semjasa,

Thanks for your feedback. If you have other questions, please do not hesitate to contact us. Wish you all the best!

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.XLS