Skip to content

Commit 6319119

Browse files
committed
Merge branch 'master' into pdfReader_WatermarkDemoModeOnly#5811
2 parents 84a349d + 6aa3020 commit 6319119

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/components/BootstrapBlazor.TableExport/BootstrapBlazor.TableExport.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.2.2</Version>
4+
<Version>9.2.3</Version>
55
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
66
</PropertyGroup>
77

@@ -11,8 +11,8 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="BootstrapBlazor" Version="9.2.3" />
15-
<PackageReference Include="MiniExcel" Version="1.39.0" />
14+
<PackageReference Include="BootstrapBlazor" Version="9.5.8" />
15+
<PackageReference Include="MiniExcel" Version="1.40.0" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

src/components/BootstrapBlazor.TableExport/Services/DefaultTableExport.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Microsoft.Extensions.Logging;
99
using Microsoft.Extensions.Options;
1010
using MiniExcelLibs;
11+
using MiniExcelLibs.OpenXml;
1112
using System.Text;
1213

1314
namespace BootstrapBlazor.Components;
@@ -52,11 +53,22 @@ private async Task<bool> InternalExportAsync<TModel>(IEnumerable<TModel> items,
5253
{
5354
options ??= serviceProvider.GetRequiredService<IOptions<BootstrapBlazorOptions>>().Value.TableSettings.TableExportOptions;
5455
cols ??= Utility.GetTableColumns<TModel>();
56+
57+
IConfiguration? configuration = null;
58+
if (excelType == ExcelType.XLSX)
59+
{
60+
configuration = new OpenXmlConfiguration()
61+
{
62+
AutoFilter = options.EnableAutoFilter,
63+
EnableAutoWidth = options.EnableAutoWidth,
64+
};
65+
}
66+
5567
var lookupService = serviceProvider.GetRequiredService<ILookupService>();
5668
var value = new ExportDataReader<TModel>(items, cols, options, lookupService);
5769

5870
using var stream = new MemoryStream();
59-
await MiniExcel.SaveAsAsync(stream, value, excelType: excelType);
71+
await MiniExcel.SaveAsAsync(stream, value, excelType: excelType, configuration: configuration);
6072

6173
fileName ??= $"ExportData_{DateTime.Now:yyyyMMddHHmmss}.{GetExtension()}";
6274
stream.Position = 0;

0 commit comments

Comments
 (0)