ByteScout Spreadsheet SDK - C# - Use Special Cells - ByteScout

ByteScout Spreadsheet SDK – C# – Use Special Cells

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Use Special Cells

How to use special cells in C# and ByteScout Spreadsheet SDK

This tutorial will show how to use special cells in C#

This sample source code below will demonstrate you how to use special cells in C#. What is ByteScout Spreadsheet SDK? It is the SDK that can write and read, modify and calculate Excel and CSV spreadsheets. Most popular formulas are supported. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays. It can help you to use special cells in your C# application.

The SDK samples like this one below explain how to quickly make your application do use special cells in C# with the help of ByteScout Spreadsheet SDK. Just copy and paste the code into your C# application’s code and follow the instruction. This basic programming language sample code for C# will do the whole work for you to use special cells.

ByteScout Spreadsheet SDK free trial version is available on our website. C# and other programming languages are supported.

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

using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.IO; using Bytescout.Spreadsheet; using Bytescout.Spreadsheet.Charts; using Bytescout.Spreadsheet.Constants; using System.Drawing; namespace CSharp { class Program { static void Main(string[] args) { try { // create new Spreadsheet object Spreadsheet spreadsheet = new Spreadsheet(); // add new worksheet Worksheet sheet = spreadsheet.Workbook.Worksheets.Add("Sample"); // add a constants for (int i = 1; i < 8; i++) { sheet[i, 1].Value = i; } // add a formulas sheet.Range("D2:D8").Formula = "=RAND()*10"; //Select the cells containing constants Range range1 = sheet.Range("A1:E9").SpecialCells(XlCellType.Constants, null); range1.FillPattern = PatternStyle.Solid; range1.FillPatternForeColor = Color.Yellow; //Select the cells containing formulas Range range2 = sheet.Range("A1:E9").SpecialCells(XlCellType.Formulas, null); range2.FillPattern = PatternStyle.Solid; range2.FillPatternForeColor = Color.Cyan; if (File.Exists("Output.xls")) { File.Delete("Output.xls"); } // Save it as XLS spreadsheet.SaveAs("Output.xls"); // close the document spreadsheet.Close(); // open output XLS Process.Start("Output.xls"); } catch (Exception e) { Console.WriteLine("CAN NOT EXECUTE: " + e.ToString()); Console.WriteLine("\nPress any key to exit"); Console.ReadKey(); } } } }

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



Get 60 Day Free Trial or Visit ByteScout Spreadsheet SDK page

Explore ByteScout Spreadsheet SDK documentation


Sign Up for free Web API key

Explore Web API Documentation