HcfNS.Office 7.0.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package HcfNS.Office --version 7.0.2.1                
NuGet\Install-Package HcfNS.Office -Version 7.0.2.1                
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="HcfNS.Office" Version="7.0.2.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HcfNS.Office --version 7.0.2.1                
#r "nuget: HcfNS.Office, 7.0.2.1"                
#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 HcfNS.Office as a Cake Addin
#addin nuget:?package=HcfNS.Office&version=7.0.2.1

// Install HcfNS.Office as a Cake Tool
#tool nuget:?package=HcfNS.Office&version=7.0.2.1                

Hcf Office 组件,封装基于Office操作的实现

用法

通过nuget引用 Hcf.Office 程序集

Install-Package HcfNS.Office

添加 OfficePack 组件包

services.AddPack<OfficePack>();

示例

导出Excel

IExcelWriter _excelWriter=provider.GetService<IExcelWriter>();//获取ExcelWriter实例
int count = 5;
string[] fields = new[]
{
    "Column1","Column2","Column3","Column4","Column5"
};
string[] headers = new[]
{
    "列1","列2","列3","列4","列5"
};

List<TestInfo> tests = new List<TestInfo>();
for(int i = 0; i < 20000; i++)
{
    tests.Add(new TestInfo
    {
        Column1 = "Column1_" + i.ToString(),
        Column2 = "Column2_" + i.ToString(),
        Column3 = i,
        Column4 = i,
        Column5 = "Column5_" + i.ToString()
    });
}

List<TestInfo> tests1 = new List<TestInfo>();
for (int i = 20000; i < 60000; i++)
{
    tests1.Add(new TestInfo
    {
        Column1 = "Column1_" + i.ToString(),
        Column2 = "Column2_" + i.ToString(),
        Column3 = i,
        Column4 = i,
        Column5 = "Column5_" + i.ToString()
    });
}

_excelWriter.StartWrite();
_excelWriter.WriteTitle("测试Excel导出标题", count);
_excelWriter.WriteHeader(headers);
_excelWriter.WriteData(tests, fields);
_excelWriter.WriteData(tests1, fields);
byte[] bytes = _excelWriter.GetExcelBytes();
_excelWriter.Close();
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.0.2.2 0 12/28/2024
7.0.2.1 67 12/23/2024
7.0.2 77 12/19/2024
7.0.1 89 11/27/2024
7.0.0 92 11/14/2024
6.0.2 125 4/26/2024
6.0.1.1 490 5/23/2023
6.0.1 717 10/18/2022
6.0.0.1 704 10/10/2022
6.0.0 744 8/17/2022
5.0.0.1 709 9/1/2021
5.0.0 701 6/22/2021
3.2.3.1 689 9/1/2021
3.2.3 733 6/18/2021
3.2.2.5 727 2/9/2021
3.2.2.4 753 2/9/2021
3.2.2.3 665 2/9/2021
3.2.2.1 693 2/9/2021
3.2.2 762 2/9/2021
3.2.1 865 6/20/2020
3.2.0 837 6/20/2020
1.0.0 891 1/31/2020