-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2437932
commit 715b474
Showing
8 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
Use Cases/Email Validation/NET Standard/Email Validation/Email Validation.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.9.34310.174 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Email Validation", "Email Validation\Email Validation.csproj", "{E7DD6085-35DA-4553-8CB0-92883B3EAF2E}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E7DD6085-35DA-4553-8CB0-92883B3EAF2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E7DD6085-35DA-4553-8CB0-92883B3EAF2E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E7DD6085-35DA-4553-8CB0-92883B3EAF2E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E7DD6085-35DA-4553-8CB0-92883B3EAF2E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {11C944C7-201E-459B-BE41-AA09300206AD} | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+10.2 KB
...s/Email Validation/NET Standard/Email Validation/Email Validation/Data/InputTemplate.xlsx
Binary file not shown.
15 changes: 15 additions & 0 deletions
15
...s/Email Validation/NET Standard/Email Validation/Email Validation/Email Validation.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>Email_Validation</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="26.1.40" /> | ||
</ItemGroup> | ||
|
||
</Project> |
46 changes: 46 additions & 0 deletions
46
Use Cases/Email Validation/NET Standard/Email Validation/Email Validation/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Syncfusion.XlsIO; | ||
|
||
namespace Email_Validation | ||
{ | ||
class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
using (ExcelEngine excelEngine = new ExcelEngine()) | ||
{ | ||
IApplication application = excelEngine.Excel; | ||
application.DefaultVersion = ExcelVersion.Xlsx; | ||
FileStream inputStream = new FileStream("../../../Data/InputTemplate.xlsx", FileMode.Open, FileAccess.Read); | ||
IWorkbook workbook = application.Workbooks.Open(inputStream); | ||
IWorksheet worksheet = workbook.Worksheets[0]; | ||
|
||
//Data validation for email format | ||
IDataValidation validation = worksheet.Range["G2:G7"].DataValidation; | ||
validation.AllowType = ExcelDataType.Formula; | ||
validation.FirstFormula = "=AND(ISNUMBER(SEARCH(\"@\", G2:G7)), ISNUMBER(SEARCH(\".\", G2:G7, SEARCH(\"@\", G2:G7))))"; | ||
|
||
//Shows the error message | ||
validation.ErrorBoxText = "Please enter a valid Email address."; | ||
validation.ErrorBoxTitle = "Invalid Email Format"; | ||
validation.PromptBoxText = "Enter an Email address"; | ||
validation.IsPromptBoxVisible = true; | ||
validation.ShowPromptBox = true; | ||
|
||
//Saving the workbook as stream | ||
FileStream OutputStream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite); | ||
workbook.SaveAs(OutputStream); | ||
|
||
//Dispose stream | ||
inputStream.Dispose(); | ||
OutputStream.Dispose(); | ||
|
||
System.Diagnostics.Process process = new System.Diagnostics.Process(); | ||
process.StartInfo = new System.Diagnostics.ProcessStartInfo("Output.xlsx") | ||
{ | ||
UseShellExecute = true | ||
}; | ||
process.Start(); | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
Use Cases/URL Validation/NET Standard/URL Validation/URL Validation.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.9.34310.174 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "URL Validation", "URL Validation\URL Validation.csproj", "{21D0DE4C-292D-49AC-97EB-A31B92219C4D}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{21D0DE4C-292D-49AC-97EB-A31B92219C4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{21D0DE4C-292D-49AC-97EB-A31B92219C4D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{21D0DE4C-292D-49AC-97EB-A31B92219C4D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{21D0DE4C-292D-49AC-97EB-A31B92219C4D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {20A67F31-A0B2-456D-B945-419215D92E71} | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+10.3 KB
Use Cases/URL Validation/NET Standard/URL Validation/URL Validation/Data/InputTemplate.xlsx
Binary file not shown.
46 changes: 46 additions & 0 deletions
46
Use Cases/URL Validation/NET Standard/URL Validation/URL Validation/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Syncfusion.XlsIO; | ||
|
||
namespace URL_Validation | ||
{ | ||
class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
using (ExcelEngine excelEngine = new ExcelEngine()) | ||
{ | ||
IApplication application = excelEngine.Excel; | ||
application.DefaultVersion = ExcelVersion.Xlsx; | ||
FileStream inputStream = new FileStream("../../../Data/InputTemplate.xlsx", FileMode.Open, FileAccess.Read); | ||
IWorkbook workbook = application.Workbooks.Open(inputStream); | ||
IWorksheet worksheet = workbook.Worksheets[0]; | ||
|
||
// Data validation for url format | ||
IDataValidation validation = worksheet.Range["G2:G7"].DataValidation; | ||
validation.AllowType = ExcelDataType.Formula; | ||
validation.FirstFormula = "=AND(ISNUMBER(SEARCH(\"://\", G2:G7)), ISNUMBER(SEARCH(\".\", G2:G7, SEARCH(\"://\", G2:G7))))"; | ||
|
||
//Shows the error message | ||
validation.ErrorBoxText = "Please enter a valid URL."; | ||
validation.ErrorBoxTitle = "Invalid URL Format"; | ||
validation.PromptBoxText = "Enter a valid URL"; | ||
validation.IsPromptBoxVisible = true; | ||
validation.ShowPromptBox = true; | ||
|
||
//Saving the workbook as stream | ||
FileStream OutputStream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite); | ||
workbook.SaveAs(OutputStream); | ||
|
||
//Dispose stream | ||
inputStream.Dispose(); | ||
OutputStream.Dispose(); | ||
|
||
System.Diagnostics.Process process = new System.Diagnostics.Process(); | ||
process.StartInfo = new System.Diagnostics.ProcessStartInfo("Output.xlsx") | ||
{ | ||
UseShellExecute = true | ||
}; | ||
process.Start(); | ||
} | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
Use Cases/URL Validation/NET Standard/URL Validation/URL Validation/URL Validation.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>URL_Validation</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="26.1.40" /> | ||
</ItemGroup> | ||
|
||
</Project> |