ZY.Report.Core 1.0.3.7

dotnet add package ZY.Report.Core --version 1.0.3.7
                    
NuGet\Install-Package ZY.Report.Core -Version 1.0.3.7
                    
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="ZY.Report.Core" Version="1.0.3.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZY.Report.Core" Version="1.0.3.7" />
                    
Directory.Packages.props
<PackageReference Include="ZY.Report.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZY.Report.Core --version 1.0.3.7
                    
#r "nuget: ZY.Report.Core, 1.0.3.7"
                    
#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.
#:package ZY.Report.Core@1.0.3.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZY.Report.Core&version=1.0.3.7
                    
Install as a Cake Addin
#tool nuget:?package=ZY.Report.Core&version=1.0.3.7
                    
Install as a Cake Tool

导入导出

nuget引用组件 :ZY.Report.Core

添加Startup

在ConfigureServices 添加代码

     services.AddExcel();

使用

ExportAddDescriptionHeader 导出集合对象

导出调用

    private readonly IExcel _excel;

	//构造函数中 注入IExcel
    public ReportController(IExcel excel)
    {
        _excel = excel;
    }
		
    [HttpGet]
    public async Task<IActionResult> ImportSummaryReport([FromQuery] TestInput input)
    {
        IList list = await _appService.Search(input);
		//list 为对象集合
        return _excel.ExportAddDescriptionHeader(list, $"报表{DateTime.Now.ToString("yyyyMMddHHmm")}");

		//list 为对象集合 可设置排序 
        return _excel.ExportAddDescriptionHeaderForOrder(list, $"报表{DateTime.Now.ToString("yyyyMMddHHmm")}");
    }
  • 注意一:返回类型需要为 IActionResult
  • 注意二:对象字段设置了[Description("")]特性的才会输出到excel

设置表头、宽度

	 //设置excel中表头名称为”姓名“ ,宽度默认为表头字符串长度
     [Description("姓名")] 
     public string Name { get; set; }
	 
	 //设置excel中表头名称为”姓名“ ,宽度为20
     [Description("姓名;20")] 
     public string Name { get; set; }
	 
	 //设置excel中表头名称为”姓名“ ,宽度为20,序号为0
     //排序由小到大,默认先排有序号的在依次排无序号的
     [Description("姓名;20;0")] 
     public string Name { get; set; 
	 
	 //设置靠左排序、靠右排序、跨行、数字类型、金额类型
     // right靠右排序 left靠左排序 rospan临近行值相同合并跨行 number数字类型内容居右 decimal金额类型自动精确2位共居右
     //前三项固定 依次 名称;列宽度;排序 ,后续设置无明确排序, “;”间隔就行
     [Description("姓名;;;right")] 
     [Description("姓名;;;left")] 
     [Description("姓名;20;;rowspan")] 
     [Description("姓名;;;rowspan;number")] 
     [Description("姓名;;0;right;decimal")] 
     [Description("姓名;;;right;rowspan")] 
     public string Name { get; set; }

枚举显示


	[Description("班级")]
    public EClassRoom ClassRoom { get; set; }
	
	public enum EClassRoom
    {
        一班=0,
        [Description("二班")]  //枚举显示值
        class2 =1
    }

设置复杂表头

     |------------------------------------------------------------------------------------------------------------|
     |                                         应收报表                                                           |
     |------------------------------------------------------------------------------------------------------------|
     |            |            |            应收未收金额           |         实收金额                    |        |
     |            |            |-------------------------------------------------------------------------|        |
     |  车辆类型  |  订单分类  |  15-60分钟订单  |  按进出计算订单 |  15-60分钟订单  |        |          |  差额  |
     |            |            |-----------------------------------------------------|  分摊  |  活跃度  |        |
     |            |            |  数量  |  金额  |  数量  |  金额  |  数量  |  金额  |        |          |        |

     var headers = new List<ReportHeader>
    {
        new ReportHeader
        {
            Nmae="应收报表",
            Colspan=13,
            Date= new List<ReportHeader>
            {
                new ReportHeader{Nmae="车辆类型",Rowspan=3},
                new ReportHeader{Nmae="订单分类",Rowspan=3},
                new ReportHeader{Nmae="应收未收金额",Colspan=6,Date=new List<ReportHeader>{
                    new ReportHeader{Nmae="15-60分钟订单",Colspan=2,Date=new List<ReportHeader>
                    {
                        new ReportHeader{Nmae="数量"},
                        new ReportHeader{Nmae="金额"}
                    }},
                    new ReportHeader{Nmae="按进出计算临停订单",Colspan=2,Date=new List<ReportHeader>
                    {
                        new ReportHeader{Nmae="数量"},
                        new ReportHeader{Nmae="金额"}
                    }},
                    new ReportHeader{Nmae="按备案包月价计算",Colspan=2,Date=new List<ReportHeader>
                    {
                        new ReportHeader{Nmae="数量"},
                        new ReportHeader{Nmae="金额"}
                    }}
                } },
                new ReportHeader{Nmae="实收金额",Colspan=4,Date=new List<ReportHeader>{
                    new ReportHeader{Nmae="0-15分钟订单",Colspan=2,Date=new List<ReportHeader>
                    {
                        new ReportHeader{Nmae="数量"},
                        new ReportHeader{Nmae="占比"}
                    }},
                    new ReportHeader{Nmae="分摊",Rowspan=2},
                    new ReportHeader{Nmae="活跃度",Rowspan=2},
                }},
                new ReportHeader{Nmae="差额",Rowspan=3}
            }
        }
    };

    return _excel.ExportAddDescriptionHeaderForOrder(list,headers, $"报表{DateTime.Now.ToString("yyyyMMddHHmm")}");
     

有自定义表头后 则不再读取字段标签内容为表头

导入

1、 仅支持 xlsx 文件导入

2、 导入表格,表头内容不能有空

Product 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 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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 was computed. 
.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.

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
1.0.3.7 143 4/20/2026
1.0.3.6 123 4/20/2026
1.0.3.5 584 4/2/2025
1.0.3.4 257 1/12/2025
1.0.3.3 203 1/3/2025
1.0.3.2 217 1/3/2025
1.0.3.1 218 12/21/2024
1.0.2.2 1,311 12/26/2022
1.0.2.1 422 12/25/2022
1.0.1.1 523 11/9/2022
1.0.0.1 818 1/10/2022