Writing of the code to validate cells with dates with spreadsheet sdk in C# can be done by developers of any level using ByteScout Data Extraction Suite. ByteScout Data Extraction Suite was made to help with validate cells with dates with spreadsheet sdk in C#. ByteScout Data Extraction Suite is the bundle that includes three SDK tools for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK.
Save time on writing and testing code by using the code below and use it in your application. To use validate cells with dates with spreadsheet sdk in your C# project or application just copy & paste the code and then run your app! Check these C# sample code examples to see if they acknowledge to your needs and requirements for the project.
If you want to try other samples for C# then free trial version of ByteScout Data Extraction Suite is available on our website.
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) { // in this sample we scan cells with ages data for people // then mark all dates where age is between 10 and 19 years and mark these cells with red color // Create new Spreadsheet Spreadsheet document = new Spreadsheet(); document.LoadFromFile("Data.xls"); // Get worksheet by name Worksheet worksheet = document.Workbook.Worksheets.ByName("Sample"); // Years range int RangeMin = 10; int RangeMax = 19; // Minimum age DateTime YearMin = DateTime.Now; // Maximum age DateTime YearMax = DateTime.Now; // Minimum year YearMax = YearMax.AddYears(-RangeMin); // Maximum year YearMin = YearMin.AddYears(-RangeMax); // Check dates for (int i = 1; i < 8; i++) { // Set current cell Cell currentCell = worksheet.Cell(i, 1); DateTime dateBirth = currentCell.ValueAsDateTime; // Check current cell if (dateBirth < YearMin || dateBirth > YearMax) { // Set fill pattern currentCell.FillPattern = Bytescout.Spreadsheet.Constants.PatternStyle.Solid; // Markup wrong cell by red color currentCell.FillPatternForeColor = System.Drawing.Color.Red; } // Set cell format currentCell.NumberFormatString = "dd.mm.yyyy"; } // 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 Data Extraction Suite Home Page
Explore ByteScout Data Extraction Suite Documentation
Explore Samples
Sign Up for ByteScout Data Extraction Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page
Explore ByteScout Data Extraction Suite Documentation
Explore Samples
Sign Up for ByteScout Data Extraction Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: