ByteScout Barcode Suite - C# - Set number format in cells with spreadsheet sdk - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Barcode Suite – C# – Set number format in cells with spreadsheet sdk

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

How to set number format in cells with spreadsheet sdk in C# with ByteScout Barcode Suite

Learn to set number format in cells with spreadsheet sdk in C#

The sample source code below will teach you how to set number format in cells with spreadsheet sdk in C#. What is ByteScout Barcode Suite? It is the set that includes three different SDK products to generate barcodes, read barcodes and read and write spreadsheets: Barcode SDK, Barcode Reader SDK and Spreadsheet SDK. It can help you to set number format in cells with spreadsheet sdk in your C# application.

Want to save time? You will save a lot of time on writing and testing code as you may just take the C# code from ByteScout Barcode Suite for set number format in cells with spreadsheet sdk below and use it in your application. Simply copy and paste in your C# project or application you and then run your app! Applying C# application mostly includes various stages of the software development so even if the functionality works please test it with your data and the production environment.

Our website gives trial version of ByteScout Barcode 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)

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 header worksheet.Cell(0, 0).Value = "Value (Number)"; worksheet.Cell(0, 1).Value = "Formatting String"; // Set variables double plan = 3000; double result = 3100; // Fill cells for (int i = 1; i < 6; i++) { worksheet.Cell(i, 0).Value = result / plan; } // Set cells format worksheet.Cell(1, 0).NumberFormatString = "0.00"; worksheet.Cell(2, 0).NumberFormatString = "0.00%"; worksheet.Cell(3, 0).NumberFormatString = "mm:ss"; worksheet.Cell(4, 0).NumberFormatString = "hh:mm:ss"; worksheet.Cell(5, 0).NumberFormatString = "##0,0E+0"; // Set captions worksheet.Cell(1, 1).Value = "0.00"; worksheet.Cell(2, 1).Value = "0.00%"; worksheet.Cell(3, 1).Value = "mm:ss"; worksheet.Cell(4, 1).Value = "hh:mm:ss"; worksheet.Cell(5, 1).Value = "##0,0E+0"; // 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