BootstrapBlazor.Table.ImportExportsMiniService 9.0.1
BootstrapBlazor Table 数据导入导出服务扩展包
Table 导出UI
<ExportButtonDropdownTemplate>
<h6 class="dropdown-header">当前页数据</h6>
<div class="dropdown-item" @onclick="_=>ExportExcelAsync(mainTable.Rows)">
<i class="fas fa-file-excel"></i>
<span>Excel</span>
</div>
<div class="dropdown-item" @onclick="_=>ExportWordAsync(mainTable.Rows)">
<i class="fas fa-file-word"></i>
<span>Word</span>
</div>
<div class="dropdown-item" @onclick="_=>ExportHtmlAsync(mainTable.Rows)">
<i class="fa-brands fa-html5"></i>
<span>Html</span>
</div>
<div class="dropdown-item" @onclick="_=>ExportPDFAsync(mainTable.Rows)">
<i class="fas fa-file-pdf"></i>
<span>PDF</span>
</div>
<div class="dropdown-divider"></div>
<h6 class="dropdown-header">全部数据</h6>
<div class="dropdown-item" @onclick="_=>ExportExcelAsync(GetAllItems())">
<i class="fas fa-file-excel"></i>
<span>Excel</span>
</div>
<div class="dropdown-item" @onclick="_=>ExportWordAsync(GetAllItems())">
<i class="fas fa-file-word"></i>
<span>Word</span>
</div>
<div class="dropdown-item" @onclick="_=>ExportHtmlAsync(GetAllItems())">
<i class="fa-brands fa-html5"></i>
<span>Html</span>
</div>
<div class="dropdown-item" @onclick="_=>ExportPDFAsync(GetAllItems())">
<i class="fas fa-file-pdf"></i>
<span>PDF</span>
</div>
</ExportButtonDropdownTemplate>
C# 代码
[Inject]
[NotNull]
ImportExportsService? ImportExportsService { get; set; }
private async Task<bool> ExportExcelAsync(IEnumerable<TItem> items) => await ExportAutoAsync(items, ExportType.Excel);
private async Task<bool> ExportPDFAsync(IEnumerable<TItem> items) => await ExportAutoAsync(items, ExportType.Pdf);
private async Task<bool> ExportWordAsync(IEnumerable<TItem> items) => await ExportAutoAsync(items, ExportType.Word);
private async Task<bool> ExportHtmlAsync(IEnumerable<TItem> items) => await ExportAutoAsync(items, ExportType.Html);
private async Task<bool> ExportAutoAsync(IEnumerable<TItem> items, ExportType exportType = ExportType.Excel)
{
if (items == null || !items.Any())
{
await ToastService.Error("提示", "无数据可导出");
return false;
}
var option = new ToastOption()
{
Category = ToastCategory.Information,
Title = "提示",
Content = $"导出正在执行,请稍等片刻...",
IsAutoHide = false
};
// 弹出 Toast
await ToastService.Show(option);
await Task.Delay(100);
// 开启后台进程进行数据处理
await Export(items?.ToList(), exportType);
// 关闭 option 相关联的弹窗
await option.Close();
// 弹窗告知下载完毕
await ToastService.Show(new ToastOption()
{
Category = ToastCategory.Success,
Title = "提示",
Content = $"导出成功,请检查数据",
IsAutoHide = false
});
return true;
}
完整示例看源码工程
Showing the top 20 packages that depend on BootstrapBlazor.Table.ImportExportsMiniService.
Packages | Downloads |
---|---|
Densen.Extensions.BootstrapBlazor
Densen Blazor组件库以及BootstrapBlazor服务扩展包
|
1 |
Densen.Extensions.BootstrapBlazor
Densen Blazor组件库以及BootstrapBlazor服务扩展包
|
2 |
Densen.Extensions.BootstrapBlazor
Densen Blazor组件库以及BootstrapBlazor服务扩展包
|
3 |
Densen.Extensions.BootstrapBlazor
Densen Blazor组件库以及BootstrapBlazor服务扩展包
|
4 |
Densen.Extensions.BootstrapBlazor
Densen Blazor组件库以及BootstrapBlazor服务扩展包
|
5 |
Densen.Extensions.BootstrapBlazor
Densen Blazor组件库以及BootstrapBlazor服务扩展包
|
6 |
Densen.Extensions.BootstrapBlazor
Densen Blazor组件库以及BootstrapBlazor服务扩展包
|
9 |
Densen.Extensions.BootstrapBlazor
Densen Blazor组件库以及BootstrapBlazor服务扩展包
|
10 |
Densen.Extensions.BootstrapBlazor
Densen Blazor组件库以及BootstrapBlazor服务扩展包
|
12 |
Densen.Extensions.BootstrapBlazor
Densen Blazor组件库以及BootstrapBlazor服务扩展包
|
14 |
.NET 7.0
- MiniExcel (>= 1.35.0)
- System.IO.Packaging (>= 8.0.1)
- MiniWord (>= 0.8.0)
.NET Standard 2.1
- System.IO.Packaging (>= 8.0.1)
- MiniWord (>= 0.8.0)
- MiniExcel (>= 1.35.0)
.NET Standard 2.0
- System.IO.Packaging (>= 8.0.1)
- MiniExcel (>= 1.35.0)
- MiniWord (>= 0.8.0)
.NET 9.0
- System.IO.Packaging (>= 8.0.1)
- MiniExcel (>= 1.35.0)
- MiniWord (>= 0.8.0)
.NET 8.0
- System.IO.Packaging (>= 8.0.1)
- MiniWord (>= 0.8.0)
- MiniExcel (>= 1.35.0)
Version | Downloads | Last updated |
---|---|---|
9.0.1 | 3 | 12/16/2024 |
9.0.0 | 5 | 12/12/2024 |
8.10.5 | 3 | 12/22/2024 |
8.10.4 | 3 | 12/15/2024 |
8.7.5 | 3 | 12/19/2024 |
8.7.0 | 3 | 12/19/2024 |
8.3.4 | 10 | 05/09/2024 |
8.3.0 | 9 | 05/09/2024 |
8.2.0 | 9 | 06/03/2024 |
8.1.10 | 9 | 05/09/2024 |
8.0.0 | 10 | 12/10/2023 |
7.8.0 | 10 | 05/09/2024 |
7.7.9 | 9 | 05/09/2024 |
7.7.7 | 7 | 06/03/2024 |