Office/Pdf格式转换,Net5环境下Aspose最新版21.8全系列,去水印等

var byteKey = Convert.FromBase64String("xxxxxx");
 
            //注册,实现去水印            
            new Aspose.Pdf.License().SetLicense(new MemoryStream(byteKey));
            new Aspose.Cells.License().SetLicense(new MemoryStream(byteKey));
            new Aspose.Words.License().SetLicense(new MemoryStream(byteKey));
            new Aspose.Slides.License().SetLicense(new MemoryStream(byteKey));
            string wordFile = "wordFile.docx";
            string excelFile = "excelFile.xlsx";
            string pptFile = "pptFile.pptx";
            string pdfFile = "pdfFile.pdf";
            Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
            workbook.Worksheets.Add();
            workbook.Worksheets[0].Cells[1, 1].Value = "excelTest";
            workbook.Save(excelFile);
            workbook.Save(wordFile, Aspose.Cells.SaveFormat.Docx);
            workbook.Save(pptFile, Aspose.Cells.SaveFormat.Pptx);
            workbook.Save(pdfFile, Aspose.Cells.SaveFormat.Pdf);
            Console.WriteLine("保存成功!");

  

示例代码不包含key,下面有获取key方法

office所有版本2003-2022,Pdf所有版本均支持。

pdf

 

加微信25489181,获取key

原文地址:https://www.cnblogs.com/cordova/p/15224817.html