【发布时间】:2017-11-15 08:20:51
【问题描述】:
我有一个 excel 文件,我想从中导入一个工作表到我由 aspose.word 创建的 .DOCX 文件中。我尝试了 InsertOleObject,但没有显示任何表格,只显示链接到 excel 文件的对象形状。
【问题讨论】:
标签: c# .net ole aspose aspose.words
我有一个 excel 文件,我想从中导入一个工作表到我由 aspose.word 创建的 .DOCX 文件中。我尝试了 InsertOleObject,但没有显示任何表格,只显示链接到 excel 文件的对象形状。
【问题讨论】:
标签: c# .net ole aspose aspose.words
很遗憾,没有将 Excel 文档转换为 Word 的直接方法。然而,通过 Aspose.Cells 和 Aspose.Pdf 的合作是可能的。首先使用 Aspose.Cells 将 Excel 文档转换为 PDF,然后使用 Aspose.Pdf 将 PDF 文档转换为 Word 文档。请检查以下示例代码。
//Use Aspose.Cells to convert XLS to Word document
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook("Book1.xls");
// To convert first sheet only you need to hide other worksheets
workbook.Worksheets[1].IsVisible = false;
// Save the XLS document into PDF document
workbook.Save("output.pdf", Aspose.Cells.SaveFormat.Pdf);
//Use Aspose.Pdf to convert PDF to Word document
// Open the source PDF document
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document("output.pdf");
// Save the PDF file into Word document
pdfDocument.Save("PDFToDOCX_out.docx", Aspose.Pdf.SaveFormat.DocX);
我与 Aspose 合作,担任开发人员传道者。
【讨论】: