Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Date Validation/Date Validation.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Date_Validation</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Syncfusion.XlsIO;

namespace Date_Validation
{
class Program
{
static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];

//Data Validation for Date
IDataValidation dateValidation = worksheet.CreateDataValidation(worksheet.Range["A1:A100000"]);
dateValidation.AllowType = ExcelDataType.Date;
dateValidation.CompareOperator = ExcelDataValidationComparisonOperator.Between;
dateValidation.FirstDateTime = new DateTime(2003, 5, 10);
dateValidation.SecondDateTime = new DateTime(2004, 5, 10);

//Shows the error message
dateValidation.ShowErrorBox = true;
dateValidation.ErrorBoxText = "Enter a value between 10/5/2003 and 10/5/2004";
dateValidation.ErrorBoxTitle = "ERROR";
dateValidation.PromptBoxText = "Data validation for date";
dateValidation.ShowPromptBox = true;

workbook.SaveAs(Path.GetFullPath("Output/DateValidation.xlsx"));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Formula Validation/Formula Validation.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Formula_Validation</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Syncfusion.XlsIO;

namespace Formula_Validation
{
class Program
{
static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];

//Data Validation using a custom formula
IDataValidation validation = worksheet.CreateDataValidation(worksheet.Range["A1:A100000"]);
validation.AllowType = ExcelDataType.Formula;
validation.FirstFormula = "=A1>10";

//Shows the error message
validation.ErrorBoxText = "Enter a value greater than 10";
validation.ErrorBoxTitle = "ERROR";
validation.PromptBoxText = "Custom DataValidation";
validation.ShowPromptBox = true;

workbook.SaveAs(Path.GetFullPath("Output/FormulaValidation.xlsx"));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="List Validation/List Validation.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>List_Validation</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Syncfusion.XlsIO;

namespace List_Validation
{
class Program
{
static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];

worksheet.Range["B1"].Text = "Item1";
worksheet.Range["B2"].Text = "Item2";
worksheet.Range["B3"].Text = "Item3";

//Data validation for the user-defined range
IDataValidation validation = worksheet.CreateDataValidation(worksheet.Range["A1:A100000"]);
validation.AllowType = ExcelDataType.User;
validation.FirstFormula = "=Sheet1!$B$1:$B$3";

//Shows the error message
validation.ErrorBoxText = "Choose the value from the list";
validation.ErrorBoxTitle = "ERROR";
validation.PromptBoxText = "Data validation for user-defined list";
validation.IsPromptBoxVisible = true;
validation.ShowPromptBox = true;

workbook.SaveAs(Path.GetFullPath(@"Output/ListValidation.xlsx"));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Number Validation/Number Validation.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Number_Validation</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Syncfusion.XlsIO;

namespace Number_Validation
{
class Program
{
static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];

//Data Validation for Numbers
IDataValidation numberValidation = worksheet.CreateDataValidation(worksheet.Range["A1:A100000"]);
numberValidation.AllowType = ExcelDataType.Integer;
numberValidation.CompareOperator = ExcelDataValidationComparisonOperator.Between;
numberValidation.FirstFormula = "0";
numberValidation.SecondFormula = "10";

//Shows the error message
numberValidation.ShowErrorBox = true;
numberValidation.ErrorBoxText = "Enter a value between 0 and 10";
numberValidation.ErrorBoxTitle = "ERROR";
numberValidation.PromptBoxText = "Data validation for numbers";
numberValidation.ShowPromptBox = true;

workbook.SaveAs(Path.GetFullPath("Output/NumberValidation.xlsx"));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Text Length Validation/Text Length Validation.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Syncfusion.XlsIO;

namespace Text_Length_Validation
{
class Program
{
static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];

//Data Validation for Text Length
IDataValidation txtLengthValidation = worksheet.CreateDataValidation(worksheet.Range["A1:A100000"]);
txtLengthValidation.AllowType = ExcelDataType.TextLength;
txtLengthValidation.CompareOperator = ExcelDataValidationComparisonOperator.Between;
txtLengthValidation.FirstFormula = "0";
txtLengthValidation.SecondFormula = "5";

//Shows the error message
txtLengthValidation.ShowErrorBox = true;
txtLengthValidation.ErrorBoxText = "Text length should be lesser than 5 characters";
txtLengthValidation.ErrorBoxTitle = "ERROR";
txtLengthValidation.PromptBoxText = "Data validation for text length";
txtLengthValidation.ShowPromptBox = true;

workbook.SaveAs(Path.GetFullPath("Output/TextLengthValidation.xlsx"));
}
}
}
}




Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Text_Length_Validation</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Time Validation/Time Validation.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Syncfusion.XlsIO;

namespace Time_Validation
{
class Program
{
static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];

//Data validation for the time
IDataValidation timeValidation = worksheet.CreateDataValidation(worksheet.Range["A1:A100000"]);
timeValidation.AllowType = ExcelDataType.Time;
timeValidation.CompareOperator = ExcelDataValidationComparisonOperator.Between;
timeValidation.FirstFormula = "10.00";
timeValidation.SecondFormula = "12.00";

//Shows the error message
timeValidation.ShowErrorBox = true;
timeValidation.ErrorBoxText = "Enter a correct time";
timeValidation.ErrorBoxTitle = "ERROR";
timeValidation.PromptBoxText = "Data validation for time";
timeValidation.ShowPromptBox = true;

workbook.SaveAs(Path.GetFullPath("Output/TimeValidation.xlsx"));
}
}
}
}




Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Time_Validation</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Loading