在解决方案上右键,打开包管理器
添加代码
using Aspose.Cells.Charts; using Aspose.Cells.Drawing; using Aspose.Cells.Rendering; using Aspose.Cells; namespace net7AsposeDemo { internal class Program { static void Main(string[] args) { new Aspose.Cells.License().SetLicense("Aspose.Total.NET.lic"); Workbook wb = new Workbook("test.xlsx"); //获取第1个sheet Worksheet worksheet = wb.Worksheets[0]; //获取该sheet有几个图表 int count = worksheet.Charts.Count; //获取该sheet的第1个图表 Chart chart = worksheet.Charts[0]; //设置图片格式 ImageOrPrintOptions options = new ImageOrPrintOptions(); options.SetDesiredSize(552, 300); options.ImageType = ImageType.Png; //图表另存为 chart.ToImage("test.png", options); Console.WriteLine("完成"); } } }
如下图
编译运行,生成的图片如下图,已成功去除水印
标签:sheet,Cells,Charts,水印,aspose23,using,net7,Aspose,options From: https://www.cnblogs.com/cordova/p/17101620.html