Skip to content

Commit 970a4d3

Browse files
committed
EPPlus 6.0.3
1 parent 9b41e31 commit 970a4d3

File tree

5 files changed

+9
-32
lines changed

5 files changed

+9
-32
lines changed

17-FXReportFromDatabase/FXReportFromDatabase.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ public static string Run(string connectionString)
157157
UsdCny = cell.GetCellValue<double>(4),
158158
UsdDkk = cell.GetCellValue<double>(5),
159159
}).ToList();
160-
161-
var json = System.Text.Json.JsonSerializer.Serialize(query);
162160
}
163161

164162
//Get the documet as a byte array from the stream and save it to disk. (This is useful in a webapplication) ...

31-HtmlExport/HtmlRangeExportSample.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,25 +111,24 @@ private static void ExportMultipleRanges(DirectoryInfo outputFolder)
111111
wsStock.Cells["A3:E4"].Style.Fill.SetBackground(Color.Green);
112112
wsStock.Cells["A7:E8"].Style.Fill.SetBackground(Color.Red);
113113

114-
//Create the exporter. The workbook exporter exports ranges only. If you want to export tables, use the exporter available on the table object.
114+
var tblChartData = p.Workbook.Worksheets["ChartData"].Tables[0];
115+
116+
//Create the exporter. The workbook exporter exports ranges and tables, if the range corresponds to the table range..
115117
var rngExporter = p.Workbook.CreateHtmlExporter(
116118
ws3D.Cells["A1:D16"],
117-
wsStock.Cells["A1:E11"]);
119+
wsStock.Cells["A1:E11"],
120+
tblChartData.Range); //If you want to export a table, the exact table range must be used.
118121

119122
//Get the html for the ranges in the HTML. The argument index referece to the ranges supplied when creating the exporter.
120123
var html3D = rngExporter.GetHtmlString(0);
121124
var htmlStock = rngExporter.GetHtmlString(1);
125+
var tblHtml = rngExporter.GetHtmlString(2);
122126
var css = rngExporter.GetCssString();
123127

124128
//We also exports a table and merge the css the range css.
125-
var tblChartData = p.Workbook.Worksheets["ChartData"].Tables[0];
126-
var tblExporter = tblChartData.CreateHtmlExporter();
127-
var tblHtml = tblExporter.GetHtmlString();
128-
var tblCss = tblExporter.GetCssString();
129-
130129
var htmlTemplate = "<html>\r\n<head>\r\n<style type=\"text/css\">\r\n{0}</style></head>\r\n<body>\r\n{1}<hr>{2}<hr>{3}</body>\r\n</html>";
131130
File.WriteAllText(FileUtil.GetFileInfo(outputFolder, "Range-04-MultipleRanges.html", true).FullName,
132-
string.Format(htmlTemplate, css+tblCss, html3D, htmlStock, tblHtml));
131+
string.Format(htmlTemplate, css, html3D, htmlStock, tblHtml));
133132
}
134133
}
135134
}

EPPlusSampleApp.Core.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18+
<PackageReference Include="EPPlus" Version="6.0.3" />
1819
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
1920
<PackageReference Include="System.Data.Common" Version="4.3.0" />
2021
<PackageReference Include="System.Data.SqlClient" Version="4.8.0" />
@@ -25,10 +26,6 @@
2526
<Folder Include="Properties\" />
2627
</ItemGroup>
2728

28-
<ItemGroup>
29-
<ProjectReference Include="..\EPPlus\src\EPPlus\EPPlus.csproj" />
30-
</ItemGroup>
31-
3229
<ItemGroup>
3330
<None Update="appsettings.json">
3431
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

EPPlusSampleApp.Core.sln

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ VisualStudioVersion = 17.0.31912.275
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EPPlusSampleApp.Core", "EPPlusSampleApp.Core.csproj", "{68677B2E-EA58-4EA5-88CC-479E0B2B286C}"
77
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EPPlus", "..\EPPlus\src\EPPlus\EPPlus.csproj", "{9454E393-4DF4-4F71-9A12-47CB95F1B8B8}"
9-
EndProject
10-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EPPlus.System.Drawing", "..\EPPlus\src\EPPlus.System.Drawing\EPPlus.System.Drawing.csproj", "{2C7DC827-1865-4273-A798-1CA1A5DE348B}"
11-
EndProject
12-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EPPlus.Interfaces", "..\EPPlus\src\EPPlus.Interfaces\EPPlus.Interfaces.csproj", "{4B1E1999-1B25-4814-9A58-7F2EDB6DF91B}"
13-
EndProject
148
Global
159
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1610
Debug|Any CPU = Debug|Any CPU
@@ -21,18 +15,6 @@ Global
2115
{68677B2E-EA58-4EA5-88CC-479E0B2B286C}.Debug|Any CPU.Build.0 = Debug|Any CPU
2216
{68677B2E-EA58-4EA5-88CC-479E0B2B286C}.Release|Any CPU.ActiveCfg = Release|Any CPU
2317
{68677B2E-EA58-4EA5-88CC-479E0B2B286C}.Release|Any CPU.Build.0 = Release|Any CPU
24-
{9454E393-4DF4-4F71-9A12-47CB95F1B8B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25-
{9454E393-4DF4-4F71-9A12-47CB95F1B8B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
26-
{9454E393-4DF4-4F71-9A12-47CB95F1B8B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
27-
{9454E393-4DF4-4F71-9A12-47CB95F1B8B8}.Release|Any CPU.Build.0 = Release|Any CPU
28-
{2C7DC827-1865-4273-A798-1CA1A5DE348B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29-
{2C7DC827-1865-4273-A798-1CA1A5DE348B}.Debug|Any CPU.Build.0 = Debug|Any CPU
30-
{2C7DC827-1865-4273-A798-1CA1A5DE348B}.Release|Any CPU.ActiveCfg = Release|Any CPU
31-
{2C7DC827-1865-4273-A798-1CA1A5DE348B}.Release|Any CPU.Build.0 = Release|Any CPU
32-
{4B1E1999-1B25-4814-9A58-7F2EDB6DF91B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33-
{4B1E1999-1B25-4814-9A58-7F2EDB6DF91B}.Debug|Any CPU.Build.0 = Debug|Any CPU
34-
{4B1E1999-1B25-4814-9A58-7F2EDB6DF91B}.Release|Any CPU.ActiveCfg = Release|Any CPU
35-
{4B1E1999-1B25-4814-9A58-7F2EDB6DF91B}.Release|Any CPU.Build.0 = Release|Any CPU
3618
EndGlobalSection
3719
GlobalSection(SolutionProperties) = preSolution
3820
HideSolutionNode = FALSE

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ dotnet run
4444
|29|[External links](/29-ExternalLinks)|Shows how to work with links to external workbooks
4545
|30|[Sorting Ranges](/30-WorkingWithRanges)|Shows how to work with the Sort method for ranges and tables
4646
|31|[Html Export](/31-HtmlExport)|Shows how to export tables and ranges to HTML
47+
|32|[Json Export](/32-JsonExport)|Shows how to export tables and ranges to JSON
4748

4849
### Output files
4950
The samples above produces some workbooks - the name of each workbook indicates which sample that generated it. These workbooks are located in a subdirectory - named "SampleApp" - to the output directory of the sample project.

0 commit comments

Comments
 (0)