From a31df7affd13b4daea37194acac15ee5ec3bdc1e Mon Sep 17 00:00:00 2001 From: Alex chow Date: Thu, 17 Apr 2025 15:46:56 +0200 Subject: [PATCH 1/3] =?UTF-8?q?feat(DefaultTableExport):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=98=AF=E5=90=A6=E5=90=AF=E7=94=A8=20Excel=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=AD=9B=E9=80=89,=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=90=AF=E7=94=A8=20Excel=20=E8=87=AA=E5=8A=A8=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E5=8F=82=E6=95=B0=20#5845?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/DefaultTableExport.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/BootstrapBlazor.TableExport/Services/DefaultTableExport.cs b/src/components/BootstrapBlazor.TableExport/Services/DefaultTableExport.cs index 88d48a09..33740e27 100644 --- a/src/components/BootstrapBlazor.TableExport/Services/DefaultTableExport.cs +++ b/src/components/BootstrapBlazor.TableExport/Services/DefaultTableExport.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using MiniExcelLibs; +using MiniExcelLibs.OpenXml; using System.Text; namespace BootstrapBlazor.Components; @@ -52,11 +53,18 @@ private async Task InternalExportAsync(IEnumerable items, { options ??= serviceProvider.GetRequiredService>().Value.TableSettings.TableExportOptions; cols ??= Utility.GetTableColumns(); + + var configuration = new OpenXmlConfiguration() + { + AutoFilter = options.AutoFilter, + EnableAutoWidth = options.EnableAutoWidth, + }; + var lookupService = serviceProvider.GetRequiredService(); var value = new ExportDataReader(items, cols, options, lookupService); using var stream = new MemoryStream(); - await MiniExcel.SaveAsAsync(stream, value, excelType: excelType); + await MiniExcel.SaveAsAsync(stream, value, excelType: excelType,configuration: configuration); fileName ??= $"ExportData_{DateTime.Now:yyyyMMddHHmmss}.{GetExtension()}"; stream.Position = 0; From 1e3d0cfbcffa49333bec15e46885d4ebc8b341b3 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 18 Apr 2025 06:56:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/DefaultTableExport.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/BootstrapBlazor.TableExport/Services/DefaultTableExport.cs b/src/components/BootstrapBlazor.TableExport/Services/DefaultTableExport.cs index 33740e27..65de0ecf 100644 --- a/src/components/BootstrapBlazor.TableExport/Services/DefaultTableExport.cs +++ b/src/components/BootstrapBlazor.TableExport/Services/DefaultTableExport.cs @@ -54,17 +54,21 @@ private async Task InternalExportAsync(IEnumerable items, options ??= serviceProvider.GetRequiredService>().Value.TableSettings.TableExportOptions; cols ??= Utility.GetTableColumns(); - var configuration = new OpenXmlConfiguration() + IConfiguration? configuration = null; + if (excelType == ExcelType.XLSX) { - AutoFilter = options.AutoFilter, - EnableAutoWidth = options.EnableAutoWidth, - }; + configuration = new OpenXmlConfiguration() + { + AutoFilter = options.EnableAutoFilter, + EnableAutoWidth = options.EnableAutoWidth, + }; + } var lookupService = serviceProvider.GetRequiredService(); var value = new ExportDataReader(items, cols, options, lookupService); using var stream = new MemoryStream(); - await MiniExcel.SaveAsAsync(stream, value, excelType: excelType,configuration: configuration); + await MiniExcel.SaveAsAsync(stream, value, excelType: excelType, configuration: configuration); fileName ??= $"ExportData_{DateTime.Now:yyyyMMddHHmmss}.{GetExtension()}"; stream.Position = 0; From 87580eb7187c7601f7288e9ec11e10545ae840eb Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 18 Apr 2025 06:56:14 +0800 Subject: [PATCH 3/3] chore: bump version 9.2.3 --- .../BootstrapBlazor.TableExport.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/BootstrapBlazor.TableExport/BootstrapBlazor.TableExport.csproj b/src/components/BootstrapBlazor.TableExport/BootstrapBlazor.TableExport.csproj index a5fd2921..3e202054 100644 --- a/src/components/BootstrapBlazor.TableExport/BootstrapBlazor.TableExport.csproj +++ b/src/components/BootstrapBlazor.TableExport/BootstrapBlazor.TableExport.csproj @@ -1,7 +1,7 @@  - 9.2.2 + 9.2.3 true @@ -11,8 +11,8 @@ - - + +