net7,aspose23全系列,无水印演示

 

 

 

 在解决方案上右键,打开包管理器

 

 

 

 

 

 

 

添加代码

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("完成");
        }
    }
}

 

如下图

 

 编译运行,生成的图片如下图,已成功去除水印

 

 附档下载 

posted @ 2023-02-08 14:23  mansai  阅读(1108)  评论(1编辑  收藏  举报