ByteScout Barcode Suite - C# - Read number format in cell with spreadsheet sdk - ByteScout

ByteScout Barcode Suite – C# – Read number format in cell with spreadsheet sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Suite – C# – Read number format in cell with spreadsheet sdk

How to read number format in cell with spreadsheet sdk in C# using ByteScout Barcode Suite

Learn to read number format in cell with spreadsheet sdk in C#

This sample source code below will display you how to read number format in cell with spreadsheet sdk in C#. Want to read number format in cell with spreadsheet sdk in your C# app? ByteScout Barcode Suite is designed for it. 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 SDK samples given below describe how to quickly make your application do read number format in cell with spreadsheet sdk in C# with the help of ByteScout Barcode Suite. Just copy and paste the code into your C# application’s code and follow the instructions. 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)

Program.cs
      
using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using Bytescout.Spreadsheet; using Bytescout.Spreadsheet.Constants; using System.IO; namespace HelloWorld { class Program { static void Main(string[] args) { // Create new Spreadsheet Spreadsheet document = new Spreadsheet(); document.LoadFromFile("Data.xls"); // Get worksheet by name Worksheet worksheet = document.Workbook.Worksheets.ByName("Sample"); // Check dates for (int i = 0; i < 8; i++) { for (int j = 0; j < 2; j++) { // Set current cell Cell currentCell = worksheet.Cell(i, j); // Get format type NumberFormatType formatType = currentCell.ValueDataTypeByNumberFormatString; // Write line Console.Write("Cell({0}:{1}) type is {2}. Value : ", i, j, formatType.ToString()); switch (formatType) { case NumberFormatType.DateTime: { // Read datetime DateTime date = currentCell.ValueAsDateTime; // Write date to console output Console.Write(date.ToString()); } break; case NumberFormatType.General: { // Write value to console output Console.Write(currentCell.Value); } break; } Console.WriteLine(); } } // Close document document.Close(); Console.ReadKey(); } } }

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