.NET 总库 加快从头开始开发文档管理解决方案或增强现有应用程序以轻松处理文档操作。 API 不仅可以管理 Microsoft Office 文档,还可以处理 PDF、HTML、图像 TIFF、JPG、PNG、BMP 和 SVG、电子邮件文件、视频格式、GIS 数据格式等等。它是一套完整的文档管理和操作解决方案 API,没有任何软件依赖项。程序员可以轻松地在任何基于 .NET 的应用程序中创建、更新、呈现、打印和转换最流行的格式。
将 Word 转换为 PDF
Total API 不仅支持 Microsoft Word 格式的相互转换,还支持将 Word 转换为 PDF、HTML、图像、EPUB、Markdown 和 XPS。转换过程很简单。通过 Document 类加载 Document 并使用目标格式调用 Save 方法。就是这么简单。 Word转PDF代码集成前,开发者可以查看【转换结果】(https://products.aspose.com/words/net/conversion/word-to-pdf/)
C# - Word 到 PDF 的转换
var doc = new Document("Input.docx"); | |
doc.Save("Output.pdf"); |
将 PDF 转换为图像
API 支持将 PDF 转换为图像、Powerpoint、Excel 等格式。对于 PDF 到图像的转换,让我们将 JPG 图像视为目标文件。过程是,使用 Document 类加载 PDF 文件并初始化 JpegDevice 类 对象并通过 Process 将 PDF 渲染为 JPEG ://apireference.aspose.com/pdf/net/aspose.pdf.devices.pagedevice/process/methods/1) 方法 使用 Image 类加载 JPEG 文件,最后调用 Save 方法。
C# - PDF 到图像的转换
// supports PDF, CGM, EPUB, TeX, PCL, PS, XPS, MD, MHTML, XSLFO, HTML file formats | |
// load PDF with an instance of Document | |
var document = new Document("input.pdf"); | |
// create an object of jpegDevice | |
var renderer = new JpegDevice(); | |
// convert a particular page and save the image in JPEG format | |
renderer.Process(document.Pages[1], "output.jpeg"); | |
// load JPEG file | |
var image = Image.Load("output.jpeg"); | |
// supports Dicom, Jpeg2000, Apng, Psd, Dxf, Wmf, Emz, Wmz, Tga, Svgz file formats | |
// save JPEG to PSD file format | |
image.Save("output.psd", new PsdOptions()); |
将 Excel 转换为 Word 和 PowerPoint
用于将 Microsoft Excel 格式转换为包括 Word 和 PowerPoint 在内的不同文件,涉及主 Aspose.Total for .NET API 的相关子 API。 Excel文件转Word文件的过程,使用 Workbook 类加载EXCEL文件,先将EXCEL转为PDF,SaveFormat设置为Auto。然后使用 Document 类加载转换后的 PDF 文件并调用 Save 方法并将 Doc、Docx 设置为 SaveFormat。还列出了用于 Microsoft Excel 到 Powerpoint 转换的代码。
C# - JSON 到 Excel 转换
// load the EXCEL file using Workbook class | |
var book = new Aspose.Cells.Workbook("input.csv"); | |
// save EXCEL as PDF | |
book.Save("pdfOutput.pdf", Aspose.Cells.SaveFormat.Auto); | |
// load the PDF file using Document class | |
var document = new Aspose.Pdf.Document("pdfOutput.pdf"); | |
// save document in DOC format | |
document.Save("output.doc", SaveFormat.Doc); |
C# - Excel 到 JSON 的转换
// load the EXCEL file using Workbook class | |
var book = new Aspose.Cells.Workbook("input.csv"); | |
// save EXCEL as PDF | |
book.Save("pdfOutput.pdf", Aspose.Cells.SaveFormat.Auto); | |
// load the PDF file using Document class | |
var document = new Aspose.Pdf.Document("pdfOutput.pdf"); | |
// save document in PPTX format | |
document.Save("output.pptx", SaveFormat.Pptx); |