-
Notifications
You must be signed in to change notification settings - Fork 31
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
1cfeba9
commit 9533f81
Showing
35 changed files
with
521 additions
and
1 deletion.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
Data Validation/Custom Validation/.NET/Custom Validation/Custom 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,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.12.35417.141 d17.12 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Custom Validation", "Custom Validation\Custom Validation.csproj", "{9DF53F0C-052E-4760-AF98-06C06305121D}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{9DF53F0C-052E-4760-AF98-06C06305121D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9DF53F0C-052E-4760-AF98-06C06305121D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9DF53F0C-052E-4760-AF98-06C06305121D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9DF53F0C-052E-4760-AF98-06C06305121D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
23 changes: 23 additions & 0 deletions
23
...ation/Custom Validation/.NET/Custom Validation/Custom Validation/Custom 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,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>Custom_Validation</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="Data\*"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Output\*"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
Empty file.
43 changes: 43 additions & 0 deletions
43
Data Validation/Custom Validation/.NET/Custom Validation/Custom 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,43 @@ | ||
using Syncfusion.XlsIO; | ||
|
||
namespace Custom_Validation | ||
{ | ||
class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
// Initialize Excel engine and application. | ||
using (ExcelEngine excelEngine = new ExcelEngine()) | ||
{ | ||
IApplication application = excelEngine.Excel; | ||
application.DefaultVersion = ExcelVersion.Xlsx; | ||
|
||
// Create a workbook and worksheet. | ||
IWorkbook workbook = application.Workbooks.Create(1); | ||
IWorksheet worksheet = workbook.Worksheets[0]; | ||
|
||
// Data validation for custom data. | ||
IDataValidation validation = worksheet.Range["A3"].DataValidation; | ||
worksheet.Range["A1"].Text = "Enter the value greater than 10 in A1"; | ||
worksheet.Range["A2"].Text = "Enter the text in A3"; | ||
worksheet.Range["A1"].AutofitColumns(); | ||
validation.AllowType = ExcelDataType.Formula; | ||
validation.FirstFormula = "=A1>10"; | ||
|
||
// Show the error message. | ||
validation.ShowErrorBox = true; | ||
validation.ErrorBoxText = "A1 value is less than 10"; | ||
validation.ErrorBoxTitle = "ERROR"; | ||
validation.PromptBoxText = "Custom Data Validation"; | ||
validation.ShowPromptBox = true; | ||
|
||
// Save the Excel document. | ||
FileStream outputStream = new FileStream(Path.GetFullPath("Output/CustomValidation.xlsx"), FileMode.Create, FileAccess.Write); | ||
workbook.SaveAs(outputStream); | ||
|
||
//Dispose streams | ||
outputStream.Dispose(); | ||
} | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Excel to Text/Excel to Text/.NET/Excel to Text/Excel to Text.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,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.12.35417.141 d17.12 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Excel to Text", "Excel to Text\Excel to Text.csproj", "{6657A512-E336-4097-8D5E-BF4A998D261A}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6657A512-E336-4097-8D5E-BF4A998D261A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6657A512-E336-4097-8D5E-BF4A998D261A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6657A512-E336-4097-8D5E-BF4A998D261A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6657A512-E336-4097-8D5E-BF4A998D261A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+8.8 KB
Excel to Text/Excel to Text/.NET/Excel to Text/Excel to Text/Data/InputTemplate.xlsx
Binary file not shown.
24 changes: 24 additions & 0 deletions
24
Excel to Text/Excel to Text/.NET/Excel to Text/Excel to Text/Excel to Text.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,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>Excel_to_Text</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="Data\*"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Output\*"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
Empty file.
25 changes: 25 additions & 0 deletions
25
Excel to Text/Excel to Text/.NET/Excel to Text/Excel to Text/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,25 @@ | ||
using Syncfusion.XlsIO; | ||
|
||
namespace Excel_to_Text | ||
{ | ||
class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
// Initialize Excel engine and application. | ||
using (ExcelEngine excelEngine = new ExcelEngine()) | ||
{ | ||
IApplication application = excelEngine.Excel; | ||
application.DefaultVersion = ExcelVersion.Xlsx; | ||
|
||
// Open an existing workbook. | ||
FileStream inputStream = new FileStream(Path.GetFullPath("Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); | ||
IWorkbook workbook = application.Workbooks.Open(inputStream); | ||
|
||
// Save the workbook in .txt format with space (" ") as the delimiter. | ||
using FileStream outputStream = new FileStream(Path.GetFullPath("Output/Excel to Text.txt"), FileMode.Create, FileAccess.ReadWrite); | ||
workbook.SaveAs(outputStream, " "); | ||
} | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Import Data to Template/Import Array/.NET/Import Array/Import Array.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,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.12.35417.141 d17.12 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Import Array", "Import Array\Import Array.csproj", "{686B45E1-3585-408C-B498-8F90C8379DD5}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{686B45E1-3585-408C-B498-8F90C8379DD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{686B45E1-3585-408C-B498-8F90C8379DD5}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{686B45E1-3585-408C-B498-8F90C8379DD5}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{686B45E1-3585-408C-B498-8F90C8379DD5}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+8.35 KB
Import Data to Template/Import Array/.NET/Import Array/Import Array/Data/InputTemplate.xlsx
Binary file not shown.
23 changes: 23 additions & 0 deletions
23
Import Data to Template/Import Array/.NET/Import Array/Import Array/Import Array.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,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>Import_Array</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="Data\*"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Output\*"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
Empty file.
43 changes: 43 additions & 0 deletions
43
Import Data to Template/Import Array/.NET/Import Array/Import Array/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,43 @@ | ||
using Syncfusion.XlsIO; | ||
|
||
namespace Import_Array | ||
{ | ||
class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
// Initialize Excel engine and application. | ||
using (ExcelEngine excelEngine = new ExcelEngine()) | ||
{ | ||
IApplication application = excelEngine.Excel; | ||
application.DefaultVersion = ExcelVersion.Xlsx; | ||
|
||
// Open an existing workbook. | ||
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); | ||
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); | ||
|
||
// Create Template Marker Processor. | ||
ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor(); | ||
|
||
// Insert Array Horizontally. | ||
string[] names = { "Mickey", "Donald", "Tom", "Jerry" }; | ||
string[] descriptions = { "Mouse", "Duck", "Cat", "Mouse" }; | ||
|
||
// Add collections to the marker variables where the name should match with input template. | ||
marker.AddVariable("Names", names); | ||
marker.AddVariable("Descriptions", descriptions); | ||
|
||
// Process the markers in the template. | ||
marker.ApplyMarkers(); | ||
|
||
// Saving the workbook. | ||
FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportArray.xlsx"), FileMode.Create, FileAccess.Write); | ||
workbook.SaveAs(outputStream); | ||
|
||
//Dispose streams | ||
inputStream.Dispose(); | ||
outputStream.Dispose(); | ||
} | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Import Data to Template/Import Collection/.NET/Import Collection/Import Collection.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,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.12.35417.141 d17.12 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Import Collection", "Import Collection\Import Collection.csproj", "{8E2BF7A1-1349-4BC9-97C9-137105EE4C35}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{8E2BF7A1-1349-4BC9-97C9-137105EE4C35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{8E2BF7A1-1349-4BC9-97C9-137105EE4C35}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{8E2BF7A1-1349-4BC9-97C9-137105EE4C35}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{8E2BF7A1-1349-4BC9-97C9-137105EE4C35}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+7.16 KB
...mplate/Import Collection/.NET/Import Collection/Import Collection/Data/Andy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
...mplate/Import Collection/.NET/Import Collection/Import Collection/Data/InputTemplate.xlsx
Binary file not shown.
Binary file added
BIN
+6.31 KB
...emplate/Import Collection/.NET/Import Collection/Import Collection/Data/Jim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.67 KB
...plate/Import Collection/.NET/Import Collection/Import Collection/Data/Karen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.93 KB
...ate/Import Collection/.NET/Import Collection/Import Collection/Data/Phyllis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.1 KB
...ate/Import Collection/.NET/Import Collection/Import Collection/Data/Stanley.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
...plate/Import Collection/.NET/Import Collection/Import Collection/Import Collection.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,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>Import_Collection</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="Data\*"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="Output\*"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
Empty file.
70 changes: 70 additions & 0 deletions
70
...rt Data to Template/Import Collection/.NET/Import Collection/Import Collection/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,70 @@ | ||
using Syncfusion.Licensing; | ||
using Syncfusion.XlsIO; | ||
|
||
namespace Import_Collection | ||
{ | ||
class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
// Initialize Excel engine and application. | ||
using ExcelEngine excelEngine = new ExcelEngine(); | ||
IApplication application = excelEngine.Excel; | ||
application.DefaultVersion = ExcelVersion.Xlsx; | ||
|
||
// Open an existing workbook. | ||
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); | ||
IWorkbook workbook = application.Workbooks.Open(inputStream); | ||
|
||
// Create Template Marker Processor. | ||
ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor(); | ||
|
||
// Get the data into collection object. | ||
IList<Report> reports = GetSalesReports(); | ||
|
||
// Add collections to the marker variables where the name should match with input template. | ||
marker.AddVariable("Reports", reports); | ||
|
||
//Applying Markers | ||
marker.ApplyMarkers(); | ||
|
||
// Saving the workbook. | ||
FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportCollection.xlsx"), FileMode.Create, FileAccess.Write); | ||
workbook.SaveAs(outputStream); | ||
|
||
//Dispose streams | ||
inputStream.Dispose(); | ||
outputStream.Dispose(); | ||
} | ||
// Gets a list of sales reports. | ||
private static List<Report> GetSalesReports() | ||
{ | ||
List<Report> reports = new List<Report>(); | ||
reports.Add(new Report("Andy Bernard", "45000", "58000", 29, "Data/Andy.png")); | ||
reports.Add(new Report("Jim Halpert", "34000", "65000", 91, "Data/Jim.png")); | ||
reports.Add(new Report("Karen Fillippelli", "75000", "64000", -14, "Data/Karen.png")); | ||
reports.Add(new Report("Phyllis Lapin", "56500", "33600", -40, "Data/Phyllis.png")); | ||
reports.Add(new Report("Stanley Hudson", "46500", "52000", 12, "Data/Stanley.png")); | ||
return reports; | ||
} | ||
|
||
// Sales report. | ||
public class Report | ||
{ | ||
public string SalesPerson { get; set; } | ||
public string SalesJanJun { get; set; } | ||
public string SalesJulDec { get; set; } | ||
public int Change { get; set; } | ||
public byte[] Image { get; set; } | ||
|
||
public Report(string name, string janToJun, string julToDec, int change, string imagePath) | ||
{ | ||
SalesPerson = name; | ||
SalesJanJun = janToJun; | ||
SalesJulDec = julToDec; | ||
Change = change; | ||
Image = File.ReadAllBytes(imagePath); | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.