Skip to content

Commit 138d142

Browse files
992365-RemoveDataValidationSample
1 parent afab47b commit 138d142

File tree

5 files changed

+52
-0
lines changed

5 files changed

+52
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="Remove Validation/Remove Validation.csproj" />
3+
</Solution>

Data Validation/Remove Validation/.NET/Remove Validation/Remove Validation/Output/.gitkeep

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.IO;
2+
using Syncfusion.XlsIO;
3+
4+
namespace Remove_Validation
5+
{
6+
class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
using (ExcelEngine excelEngine = new ExcelEngine())
11+
{
12+
IApplication application = excelEngine.Excel;
13+
application.DefaultVersion = ExcelVersion.Xlsx;
14+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"../../../Data/InputTemplate.xlsx"));
15+
IWorksheet worksheet = workbook.Worksheets[0];
16+
17+
//Removing data validation from the worksheet
18+
worksheet.UsedRange.Clear(ExcelClearOptions.ClearDataValidations);
19+
20+
//Saving the workbook
21+
workbook.SaveAs(Path.GetFullPath(@"../../../Output/Output.xlsx"));
22+
}
23+
}
24+
}
25+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net10.0</TargetFramework>
6+
<RootNamespace>Remove_Validation</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Output\*">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Data\*">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
</ItemGroup>
23+
24+
</Project>

0 commit comments

Comments
 (0)