ByteScout Spreadsheet SDK - C# - Read Number Format In Cell - ByteScout

ByteScout Spreadsheet SDK – C# – Read Number Format In Cell

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Read Number Format In Cell

How to read number format in cell in C# using ByteScout Spreadsheet SDK

The tutorial shows how to read number format in cell in C#

ByteScout tutorials are designed to explain the code for both C# beginners and advanced programmers. ByteScout Spreadsheet SDK is the SDK component for writing, reading, modifying and calculating Excel and CSV spreadsheets. Can calculate and reculculate formulas with Excel installed. You may import or export data to and from CSV, XML, JSON. Supports export to databases, arrays, streams and you can use it to read number format in cell with C#.

C# code samples for C# developers help to speed up coding of your application when using ByteScout Spreadsheet SDK. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Use of ByteScout Spreadsheet SDK in C# is also explained in the documentation included along with the product.

Free trial version of ByteScout Spreadsheet SDK is available on our website. Documentation and source code samples are included.

Try ByteScout Spreadsheet SDK today: Get 60 Day Free Trial or sign up for Web API

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(); } } }

Try ByteScout Spreadsheet SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

VIDEO

ON-PREMISE VERSION

Get 60 Day Free Trial or Visit ByteScout Spreadsheet SDK page

Explore ByteScout Spreadsheet SDK documentation

WEB API

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next