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 @@ - - + + diff --git a/src/components/BootstrapBlazor.TableExport/Services/DefaultTableExport.cs b/src/components/BootstrapBlazor.TableExport/Services/DefaultTableExport.cs index 88d48a09..65de0ecf 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,22 @@ private async Task InternalExportAsync(IEnumerable items, { options ??= serviceProvider.GetRequiredService>().Value.TableSettings.TableExportOptions; cols ??= Utility.GetTableColumns(); + + IConfiguration? configuration = null; + if (excelType == ExcelType.XLSX) + { + 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); + await MiniExcel.SaveAsAsync(stream, value, excelType: excelType, configuration: configuration); fileName ??= $"ExportData_{DateTime.Now:yyyyMMddHHmmss}.{GetExtension()}"; stream.Position = 0;