C#使用 Aspose.Cells 库导出 Excel 为图片
Apose.Cells 收费库
官网文档:SheetRender | Aspose.Cells for Java API Reference
Excel文件流导出为图片实操示例:
public static MemoryStream Excel2Img(Stream xlsxStream, int pageIndex = 0) { var result = new MemoryStream(); if (xlsxStream == null) { return result; } var wookSheet = new Workbook(xlsxStream).Worksheets[0]; new Aspose.Cells.Rendering.SheetRender(wookSheet, new ImageOrPrintOptions()).ToImage(pageIndex, result); return result; }
Workbook new 支持本地文件or文件流:
public Workbook(string file); public Workbook(Stream stream);
SheetRender ToImage 还支持直接保存生成后的图片到指定路径:
public void ToImage(int pageIndex, string fileName);
蟹老板:简单讲两句,此库还支持 Excel、World 转 PDF 等等等,缺点:收费。(Or Cracked version)
“好记性不如烂代码!”
本文来自博客园,作者:Pengxx,转载请注明原文链接:https://www.cnblogs.com/pengxx/p/17819608.html
“先从0到1,再从1到100”