ByteScout Barcode Suite - C# - Set date formatting in cells with spreadsheet sdk - ByteScout

ByteScout Barcode Suite – C# – Set date formatting in cells with spreadsheet sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Suite – C# – Set date formatting in cells with spreadsheet sdk

How to set date formatting in cells with spreadsheet sdk in C# using ByteScout Barcode Suite

Learning is essential in computer world and the tutorial below will demonstrate how to set date formatting in cells with spreadsheet sdk in C#

These sample source codes on this page below are displaying how to set date formatting in cells with spreadsheet sdk in C#. ByteScout Barcode Suite can set date formatting in cells with spreadsheet sdk. It can be applied from C#. ByteScout Barcode Suite is the bundle that privides 3 SDK products to generate barcodes (Barcode SDK), read barcodes (Barcode Reaer SDK) and read and write spreadsheets (Spreadsheet SDK).

The following code snippet for ByteScout Barcode 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. If you want to use these C# sample examples in one or many applications then they can be used easily.

If you want to try other source code samples then the free trial version of ByteScout Barcode Suite is available for download from our website. Just try other source code samples for C#.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
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"); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next