Sample source code below will display you how to manage a complex task like set date formatting in cells with spreadsheet sdk in 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 and you can use it to set date formatting in cells with spreadsheet sdk with C#.
The following code snippet for ByteScout Data Extraction Suite works best when you need to quickly set date formatting in cells with spreadsheet sdk in your C# application. 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.
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.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Bytescout.Spreadsheet;
using System.IO;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
// Create new Spreadsheet
Spreadsheet document = new Spreadsheet();
// Get worksheet by name
Worksheet worksheet = document.Workbook.Worksheets.Add("Sample");
// Set captions
worksheet.Cell(0, 0).Value = "#";
worksheet.Cell(0, 1).Value = "Date";
for (int i = 1; i < 8; i++)
{
// Set number
worksheet.Cell(i, 0).Value = i;
// Set current cell
Cell currentCell = worksheet.Cell(i, 1);
// Set date
currentCell.ValueAsDateTime = DateTime.Now;
// Set date format
currentCell.NumberFormatString = "dd.mm.yyyy";
}
// delete output file if exists already
if (File.Exists("Sample.xls")){
File.Delete("Sample.xls");
}
// Save document
document.SaveAs("Sample.xls");
// Close document
document.Close();
// open generated XLS document in default program
Process.Start("Sample.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: