前言
在2.2里程碑中我们增加了一些新的功能,正如标题所写通过请求头进行导出我们不同格式的文件.下面我们来看一下如何使用.通过这种方式无论是对我们的数据多用途,还是说对我们的数据校验都做到了轻松易配。
同时我们也将在本周发布2.3版本,另外3.0版本我们将进行一次大的性能提升。3.0版本我们将对Razor引擎以及导出引擎进行更换,包括对所有代码的重构,这是值得期待的。
上周我们发布了2.2.5版本更新如下:
-
【Nuget】版本更新到2.2.5
-
【Excel导出】增加分栏、分sheet、追加rows导出 #74
- exporter.Append(list1).SeparateByColumn().Append(list2).ExportAppendData(filePath); - exporter.Append(list1).SeparateBySheet().Append(list2).ExportAppendData(filePath); - exporter.Append(list1).SeparateByRow().AppendHeaders().Append(list2).ExportAppendData(filePath);
-
[Excel导出】修复‘IsAllowRepeat=true’ #107
-
[Pdf导出】增加PDF扩展方法,支持通过以参数形式传递特性参数 #104
- Task<byte[]> ExportListBytesByTemplate<T>(ICollection<T> data, PdfExporterAttribute pdfExporterAttribute,string temple); - Task<byte[]> ExportBytesByTemplate<T>(T data, PdfExporterAttribute pdfExporterAttribute,string template);
主要步骤
1.安装包
Install-Package Magicodes.IE.AspNetCore
2.开始配置
在Startup.cs
的Configure()方法中,在UseRouting()中间件之后,注册如下中间件
public void Configure(IApplicationBuilder app)
{
app.UseRouting();
app.UseMagiCodesIE();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
上面这种以中间件形式可以为我们提供导出服务,那么我们再看一下另一种方式如下所示:
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers(options=>options.Filters.Add(typeof(MagicodesFilter)));
}
上面两种方式都可以为我们提供导出服务,我们只需要对我们的控制器进行配置我们的特性,在这边呢 特性主要做的是一个标识作用,标识他的一些相关的内容数据,同时标识他可以当成文件导出。
[HttpGet("excel")]
[Magicodes(Type = typeof(ExportTestDataWithAttrs))]
public List<ExportTestDataWithAttrs> Excel()
{
return GenFu.GenFu.ListOf<ExportTestDataWithAttrs>(100);
}
上面代码片段中我们标识这个类允许被导出。同时我们需要通过Type指定我们被导出类的类型。
这样填写完后我们可以通过对该地址的调用,但是注意我们必须要添加请求头以标识被导出的文件类型。如果不添加请求头,那么此处将返回的还是json格式的数据。请求头名称为Magicodes-Type
/// <summary>
/// XLSX
/// </summary>
internal const string XLSXHttpContentMediaType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
/// <summary>
/// PDF
/// </summary>
internal const string PDFHttpContentMediaType = "application/pdf";
/// <summary>
/// DOCX
/// </summary>
internal const string DOCXHttpContentMediaType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
/// <summary>
/// HTML
/// </summary>
internal const string HTMLHttpContentMediaType = "text/html";
如果说是模板导出word或者pdf甚至说html文件那么我们也是同样的操作如下所示:
[HttpGet("Word")]
[Magicodes(Type = typeof(ReceiptInfo), TemplatePath = ".//ExportTemplates//receipt.cshtml")]
public ReceiptInfo Word()
{
return new ReceiptInfo
{
Amount = 22939.43M,
Grade = "2019秋",
IdNo = "43062619890622xxxx",
Name = "张三",
Payee = "湖南心莱信息科技有限公司",
PaymentMethod = "微信支付",
Profession = "运动训练",
Remark = "学费",
TradeStatus = "已完成",
TradeTime = DateTime.Now,
UppercaseAmount = "贰万贰仟玖佰叁拾玖圆肆角叁分",
Code = "19071800001"
};
}
我们还是需要对其指定Type,然后通过TemplatePath进行指定模板地址即可
同样的我们还可以通过请求头进行标识本次请求是否是文件格式导出。
[HttpGet("pdf")]
[Magicodes(Type = typeof(BatchPortraitReceiptInfoInput), TemplatePath = ".//ExportTemplates//batchReceipt.cshtml")]
public BatchPortraitReceiptInfoInput Pdf()
{
var input = new BatchPortraitReceiptInfoInput
{
Payee = "湖南心莱信息科技有限公司",
SealUrl =
@"data:image/jpeg;base64,R0lGODlheAB4APcAAEMAAPf395mZmZJQUPUBAdbW1swAAP+Zma0AAISEhPUqKry8vMwqKpkAAP9SUv97e64wMP+ZzElJSeBRUf/N4+F6esOgoPD///cREc8YGO/v7/dDQ2YAANJTU/9mZtk5Oc5+frM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OfPA4rekqP2RG21ayjFI0T8Hav9lkjd83k18Vjn2aX+YGr/841Hw+oN28gQlAgW37oirGqZ/6K6xd36xuDy++d/jqs+b51z0v9y62Yqxp/5A3NpHYDBt91FivKShA27Zv/0XoB8GXoZQqCKVO/Y+w6r/o1988xIp+1YSH5tNrFBHrK7GWKbPdhe96rmn/slyFv81KO2HEtX/YgsAiiPvYOSddXAzrX+/SwxxWIs4T1wYVcfhZRsrlps7z7KzmH7Md28GgKi6E0qEFxAZIDJALHURHe4HLGceGE9CKwFoA8xIgxt1UKo2YtqN5xMRuenZb1tey0m220pKFHUcjcByZoF4HWx3+ScBwGE2DLPxQU3yQcZsMNYEovq8l7n6VJkYTWrBCFLBsLoibraFyYZjz61O7EKibhbSLYuhlYRpJz9tWAkww4LlJD/BLAdEBiwncdn/AYw6MEDPFpZRAAAAAElFTkSuQmCC",
ReceiptInfoInputs = new List<BatchPortraitReceiptInfoDto>()
};
for (var i = 0; i < 500; i++)
input.ReceiptInfoInputs.Add(new BatchPortraitReceiptInfoDto
{
Amount = 22939.43M,
Grade = "2019秋",
IdNo = "43062619890622xxxx",
Name = "张三",
PaymentMethod = "微信支付",
Profession = "运动训练",
Remark = "学费",
TradeStatus = "已完成",
TradeTime = DateTime.Now,
UppercaseAmount = "贰万贰仟玖佰叁拾玖圆肆角叁分",
Code = "1907180000" + i
});
return input;
}
[HttpGet("Html")]
[Magicodes(Type = typeof(ReceiptInfo), TemplatePath = ".//ExportTemplates//receipt.cshtml")]
public ReceiptInfo Html()
{
return new ReceiptInfo
{
Amount = 22939.43M,
Grade = "2019秋",
IdNo = "43062619890622xxxx",
Name = "张三",
Payee = "湖南心莱信息科技有限公司",
PaymentMethod = "微信支付",
Profession = "运动训练",
Remark = "学费",
TradeStatus = "已完成",
TradeTime = DateTime.Now,
UppercaseAmount = "贰万贰仟玖佰叁拾玖圆肆角叁分",
Code = "19071800001"
};
}