Today you are going to learn how to validate data in cell and mark wrong with color in C#. ByteScout Spreadsheet SDK was made to help with validate data in cell and mark wrong with color in C#. ByteScout Spreadsheet SDK is the library (SDK) that is capable of writing, reading, modifying and calculating Excel and CSV spreadsheets. Most popular formulas can be calculated and reculculated with Excel installed. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays.
This rich sample source code in C# for ByteScout Spreadsheet SDK includes the number of functions and options you should do calling the API to implement validate data in cell and mark wrong with color. Follow the instruction from the scratch to work and copy and paste code for C# into your editor. Use of ByteScout Spreadsheet SDK in C# is also explained in the documentation included along with the product.
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.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
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");
// Spellcheck words
for (int i = 0; i < 5; i++)
{
// Set current cell
Cell currentCell = worksheet.Cell(0, i);
// Spellcheck current cell
if ((string)currentCell.Value == "Simpsan")
{
// Set fill pattern
currentCell.FillPattern = Bytescout.Spreadsheet.Constants.PatternStyle.Solid;
// Markup wrong word 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");
}
}
}
60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page
Explore ByteScout Spreadsheet SDK Documentation
Explore Samples
Sign Up for ByteScout Spreadsheet SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page
Explore ByteScout Spreadsheet SDK Documentation
Explore Samples
Sign Up for ByteScout Spreadsheet SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: