BootstrapBlazor.Table.ImportExportsService
7.8.0
Prefix Reserved
.NET 7.0
This package targets .NET 7.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package BootstrapBlazor.Table.ImportExportsService --version 7.8.0
NuGet\Install-Package BootstrapBlazor.Table.ImportExportsService -Version 7.8.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BootstrapBlazor.Table.ImportExportsService" Version="7.8.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BootstrapBlazor.Table.ImportExportsService --version 7.8.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BootstrapBlazor.Table.ImportExportsService, 7.8.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BootstrapBlazor.Table.ImportExportsService as a Cake Addin #addin nuget:?package=BootstrapBlazor.Table.ImportExportsService&version=7.8.0 // Install BootstrapBlazor.Table.ImportExportsService as a Cake Tool #tool nuget:?package=BootstrapBlazor.Table.ImportExportsService&version=7.8.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 相关联的弹窗
option.Close();
// 弹窗告知下载完毕
await ToastService.Show(new ToastOption()
{
Category = ToastCategory.Success,
Title = "提示",
Content = $"导出成功,请检查数据",
IsAutoHide = false
});
return true;
}
完整示例看源码工程
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- BootstrapBlazor.Table.ImportExportsMiniService (>= 7.8.0)
- Densen.Magicodes.IE.Core (>= 2.8.0)
- Haukcode.WkHtmlToPdfDotNet (>= 1.5.86)
- HtmlToOpenXml.dll (>= 2.3.0)
- Magicodes.IE.Excel (>= 2.7.2)
- Magicodes.IE.Html (>= 2.7.2)
- Magicodes.IE.Pdf (>= 2.7.2)
- Magicodes.IE.Word (>= 2.7.2)
-
.NETStandard 2.1
- BootstrapBlazor.Table.ImportExportsMiniService (>= 7.8.0)
- Densen.Magicodes.IE.Core (>= 2.8.0)
- Haukcode.WkHtmlToPdfDotNet (>= 1.5.86)
- HtmlToOpenXml.dll (>= 2.3.0)
- Magicodes.IE.Excel (>= 2.7.2)
- Magicodes.IE.Html (>= 2.7.2)
- Magicodes.IE.Pdf (>= 2.7.2)
- Magicodes.IE.Word (>= 2.7.2)
-
net7.0
- BootstrapBlazor.Table.ImportExportsMiniService (>= 7.8.0)
- Densen.Magicodes.IE.Core (>= 2.8.0)
- Haukcode.WkHtmlToPdfDotNet (>= 1.5.86)
- HtmlToOpenXml.dll (>= 2.3.0)
- Magicodes.IE.Excel (>= 2.7.2)
- Magicodes.IE.Html (>= 2.7.2)
- Magicodes.IE.Pdf (>= 2.7.2)
- Magicodes.IE.Word (>= 2.7.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on BootstrapBlazor.Table.ImportExportsService:
Package | Downloads |
---|---|
BootstrapBlazor.Table.Freesql
BootstrapBlazor 的 Table 扩展 |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
9.0.1 | 0 | 11/14/2024 | |
9.0.0 | 30 | 11/13/2024 | |
8.10.5 | 103 | 10/16/2024 | |
8.10.4 | 83 | 10/16/2024 | |
8.7.5 | 124 | 7/30/2024 | |
8.7.0 | 163 | 7/7/2024 | |
8.3.4 | 183 | 3/9/2024 | |
8.3.0 | 150 | 2/25/2024 | |
8.2.0 | 146 | 2/9/2024 | |
8.1.10 | 141 | 1/18/2024 | |
8.0.1 | 150 | 1/4/2024 | |
8.0.0 | 205 | 11/15/2023 | |
7.8.0 | 269 | 7/15/2023 | |
7.7.9 | 224 | 6/12/2023 | |
7.7.7 | 220 | 6/6/2023 | |
7.7.0 | 274 | 6/2/2023 | |
7.2.3 | 1,280 | 3/20/2023 | |
7.2.2 | 281 | 3/20/2023 | |
7.2.1 | 347 | 2/24/2023 | |
7.2.0 | 1,001 | 2/23/2023 | |
7.1.2 | 285 | 2/22/2023 | |
7.1.1 | 380 | 1/30/2023 |