【问题标题】:Import excel table sheet in word by aspose.word for C# .Net通过 aspose.word for C# .Net 在 word 中导入 excel 表格
【发布时间】:2017-11-15 08:20:51
【问题描述】:

我有一个 excel 文件,我想从中导入一个工作表到我由 aspose.word 创建的 .DOCX 文件中。我尝试了 InsertOleObject,但没有显示任何表格,只显示链接到 excel 文件的对象形状。

【问题讨论】:

    标签: c# .net ole aspose aspose.words


    【解决方案1】:

    很遗憾,没有将 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 合作,担任开发人员传道者。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-21
      • 1970-01-01
      • 2018-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-13
      • 2010-11-13
      相关资源
      最近更新 更多