ByteScout Spreadsheet SDK - C# - Validate Cell if Value is in Range - ByteScout

ByteScout Spreadsheet SDK – C# – Validate Cell if Value is in Range

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Validate Cell if Value is in Range

validate cell if value is in range in C# and ByteScout Spreadsheet SDK

How to code validate cell if value is in range in C#: How-To tutorial

The documentation is designed to help you to implement the features on your side. ByteScout Spreadsheet SDK was made to help with validate cell if value is in range in C#. 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.

You will save a lot of time on writing and testing code as you may just take the code below and use it in your application. To do validate cell if value is in range in your C# project or application you may simply copy & paste the code and then run your app! This basic programming language sample code for C# will do the whole work for you in implementing validate cell if value is in range in your app.

Our website provides free trial version of ByteScout Spreadsheet SDK. It comes along with all these source code samples with the goal to help you with your C# application implementation.

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 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"); // Minimum age int RangeMin = 10; // Maximum age int RangeMax = 19; // Spellcheck words for (int i = 1; i < 8; i++) { // Set current cell Cell currentCell = worksheet.Cell(i, 1); // Check current cell if (System.Convert.ToInt32(currentCell.Value) < RangeMin || System.Convert.ToInt32(currentCell.Value) > RangeMax) { // Set fill pattern currentCell.FillPattern = Bytescout.Spreadsheet.Constants.PatternStyle.Solid; // Markup wrong cell by red color currentCell.FillPatternForeColor = System.Drawing.Color.Red; } } // delete output file if exists already if (File.Exists("Output.xls")){ File.Delete("Output.xls"); } // Save document document.SaveAs("Output.xls"); // Close Spreadsheet document.Close(); // open generated XLS document in default program Process.Start("Output.xls"); } } }

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