Skip to content

Commit e426802

Browse files
Merge pull request #168 from SyncfusionExamples/712207-import-nontabular-info
712207-FAQ for How to import non-tabular information in pre-designed Excel file
2 parents 1286335 + 7dae379 commit e426802

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35521.163 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Importing-Non-Tabular-Information", "Importing-Non-Tabular-Information\Importing-Non-Tabular-Information.csproj", "{20B49ADB-0BEB-41F0-8170-042E31CFE7ED}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{20B49ADB-0BEB-41F0-8170-042E31CFE7ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{20B49ADB-0BEB-41F0-8170-042E31CFE7ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{20B49ADB-0BEB-41F0-8170-042E31CFE7ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{20B49ADB-0BEB-41F0-8170-042E31CFE7ED}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Importing_Non_Tabular_Information</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="29.1.37" />
13+
</ItemGroup>
14+
15+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using Syncfusion.XlsIO;
2+
using static System.Net.Mime.MediaTypeNames;
3+
4+
using (ExcelEngine excelEngine = new ExcelEngine())
5+
{
6+
IApplication application = excelEngine.Excel;
7+
application.DefaultVersion = ExcelVersion.Xlsx;
8+
IWorkbook workbook = application.Workbooks.Open(@"..\..\..\Data\Input.xlsx", ExcelOpenType.Automatic);
9+
IWorksheet worksheet = workbook.Worksheets[0];
10+
11+
ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor();
12+
13+
List<string> fruits = new List<string>();
14+
fruits.Add("Apple");
15+
fruits.Add("Banana");
16+
fruits.Add("Orange");
17+
fruits.Add("Mango");
18+
fruits.Add("Blueberry");
19+
fruits.Add("Pineapple");
20+
21+
List<string> places = new List<string>();
22+
places.Add("New York");
23+
places.Add("London");
24+
places.Add("Tokyo");
25+
places.Add("Paris");
26+
27+
28+
List<string> cars = new List<string>();
29+
cars.Add("Toyota Corolla");
30+
cars.Add("Honda Civic");
31+
32+
33+
marker.AddVariable("Places", places);
34+
marker.AddVariable("Fruits", fruits);
35+
marker.AddVariable("Cars", cars);
36+
marker.ApplyMarkers();
37+
38+
39+
workbook.SaveAs(@"..\..\..\Data\Output.xlsx");
40+
workbook.Close();
41+
42+
}

0 commit comments

Comments
 (0)