The documentation is designed for a specific purpose to help you to apply the features on your side. ByteScout Data Extraction Suite can import from data table with spreadsheet sdk. It can be applied from C#. ByteScout Data Extraction Suite is the bundle that includes three SDK tools for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK.
This prolific sample source code in C# for ByteScout Data Extraction Suite contains various functions and other necessary options you should do calling the API to import from data table with spreadsheet sdk. Follow the instructions from scratch to work and copy the C# code. Check C# sample code samples to see if they respond to your needs and requirements for the project.
All these programming tutorials along with source code samples and ByteScout free trial version are available for download from our website.
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.Data;
using System.Diagnostics;
using System.IO;
namespace Bytescout.Spreadsheet.Demo.Csharp.ImportFromDataTable
{
class Program
{
static void Main(string[] args)
{
const string fileName = "CSharpImportFromDataTable.xls";
// Create a new spreadsheet
Spreadsheet spreadsheet = new Spreadsheet();
// Get the data from the datatable that we want to import
DataTable periodicTable = GetDataTable();
// Import data into spreadheet
spreadsheet.ImportFromDataTable(periodicTable);
// Insert row with column captions
Worksheet worksheet = spreadsheet.Worksheets[0];
worksheet.Rows.Insert(0);
for (int colIndex = 0; colIndex < periodicTable.Columns.Count; colIndex++)
{
worksheet.Cell(0, colIndex).Value = periodicTable.Columns[colIndex].Caption;
}
// Save the spreadsheet
if (File.Exists(fileName)) File.Delete(fileName);
spreadsheet.SaveAs(fileName);
// Close spreadsheet
spreadsheet.Close();
// Open the spreadsheet
Process.Start(fileName);
}
/// <summary>
/// Creates a data table of the periodic table of elements
/// </summary>
/// <returns>A data table of the periodic table of elements</returns>
private static DataTable GetDataTable()
{
DataTable periodicTable = new DataTable("PeriodicTable");
periodicTable.Columns.Add("Name", typeof(string));
periodicTable.Columns.Add("Symbol", typeof(string));
periodicTable.Columns.Add("AtomicNumber", typeof(int));
DataRow dr = periodicTable.Rows.Add();
dr[0] = "Hydrogen";
dr[1] = "H";
dr[2] = "1";
dr = periodicTable.Rows.Add();
dr[0] = "Helium";
dr[1] = "He";
dr[2] = "2";
dr = periodicTable.Rows.Add();
dr[0] = "Lithium";
dr[1] = "Li";
dr[2] = "3";
dr = periodicTable.Rows.Add();
dr[0] = "Beryllium";
dr[1] = "Be";
dr[2] = "4";
dr = periodicTable.Rows.Add();
dr[0] = "Boron";
dr[1] = "B";
dr[2] = "5";
dr = periodicTable.Rows.Add();
dr[0] = "Carbon";
dr[1] = "C";
dr[2] = "6";
return periodicTable;
}
}
}
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: