The sample source codes on this page shows how to add doughnut chart with spreadsheet sdk in C#. ByteScout Data Extraction Suite can add doughnut chart with spreadsheet sdk. It can be applied from C#. ByteScout Data Extraction Suite is the set that includes 3 SDK products for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK.
These C# code samples for C# guide developers to speed up coding of the application when using ByteScout Data Extraction Suite. IF you want to implement the functionality, just copy and paste this code for C# below into your code editor with your app, compile and run your application. Use of ByteScout Data Extraction Suite in C# is also described in the documentation included along with the product.
Our website gives trial version of ByteScout Data Extraction Suite for free. It also includes documentation and source code samples.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
using System;
using System.Diagnostics;
using Bytescout.Spreadsheet;
using Bytescout.Spreadsheet.Charts;
namespace CSharp
{
class Program
{
static void Main(string[] args)
{
// Create new Spreadsheet object
Spreadsheet spreadsheet = new Spreadsheet();
spreadsheet.RegistrationName = "demo";
spreadsheet.RegistrationKey = "demo";
// Add new worksheet
Worksheet sheet = spreadsheet.Workbook.Worksheets.Add("Sample");
// Add few random numbers
int length = 10;
Random rnd = new Random();
for (int i = 0; i < length; i++)
{
sheet.Cell(i, 0).Value = rnd.Next(10);
sheet.Cell(i, 1).Value = rnd.Next(10);
}
// Add charts to worksheet
Chart doughnutChart = sheet.Charts.AddChartAndFitInto(12, 1, 35, 9, ChartType.Doughnut);
doughnutChart.SeriesCollection.Add(new Series(sheet.Range(0, 0, length - 1, 0)));
doughnutChart.SeriesCollection.Add(new Series(sheet.Range(0, 1, length - 1, 1)));
doughnutChart = sheet.Charts.AddChartAndFitInto(12, 10, 35, 18, ChartType.DoughnutExploded);
doughnutChart.SeriesCollection.Add(new Series(sheet.Range(0, 0, length - 1, 0)));
doughnutChart.SeriesCollection.Add(new Series(sheet.Range(0, 1, length - 1, 1)));
// Save it as XLS
spreadsheet.SaveAs("Output.xls");
// Close the document
spreadsheet.Close();
// Cleanup
spreadsheet.Dispose();
// Open generated XLS file in default associated application
Process.Start("Output.xls");
}
}
}
60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page
Explore ByteScout Data Extraction Suite Documentation
Explore Samples
Sign Up for ByteScout Data Extraction Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page
Explore ByteScout Data Extraction Suite Documentation
Explore Samples
Sign Up for ByteScout Data Extraction Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: