Copy excel into word document

Hi,
Our application use Aspose.word version 9.5.0.0 for creating word reports
I would like to copy an excel report (example is attached) into word document.
Is it poosible? can you please send me code sample how to do it?
Thanks,

Hi
Thanks for your request. There is no direct way to copy from Excel to Word using Aspose components. However, you can convert your Excel to Word using Aspose.Words+Aspose.Cells and then insert the produced document into your destination document.
You can find a demo that shows how to convert from Excel to Word using Aspose.Words and Aspose.Cells in our demo projects. You can download them from here:
https://releases.aspose.com/words/net
Best regards,

Hi,
I’m trying to test your example but there is a compile error: I’m using VS2010 with framework 4 and Aspose.Cells 5.2.1.0.
The errors are:
Error 3 The type or namespace name ‘Characters’ could not be found (are you missing a using directive or an assembly reference?)

Error 2 Cannot implicitly convert type ‘Aspose.Cells.FontSetting[]’ to ‘System.Collections.ArrayList’

Hi Gal,
Thanks for your inquiry.
There were some changes to the Aspose.Cells API which is causing these errors. Please find an updated version of this class provided by Andrey here: https://forum.aspose.com/t/68056
Thanks,

Thanks it works !

It works fine when I copy tables from excel to word document.
however, if excel document contains sheets with graphs/pictures it failed.
Example of excel file is attached
Thanks,

Hi
Thanks for your request. The problem seems to be not in the code of converter, but in Aspose.Cells. For some reason Aspose.Cells cannot create a range. The following simple code throws an exception:

// Get area in the worksheet that will be printed
// Returns something like this "A1:D51" of null
string excelPrintArea = excelWorksheet.PageSetup.PrintArea;
if (!string.IsNullOrEmpty(excelPrintArea))
{
    // Get first cell in the printed area
    string rangeStart = excelPrintArea.Substring(0, excelPrintArea.IndexOf(":"));
    // Get last cell in the printed area
    string rangeEnd = excelPrintArea.Substring(excelPrintArea.IndexOf(":") + 1);
    // Get printed range from worksheet
    Aspose.Cells.Range range = excelWorksheet.Cells.CreateRange(rangeStart, rangeEnd);
    colCount = range.ColumnCount + range.FirstColumn;
    rowCount = range.RowCount + range.FirstRow;
    startColumn = range.FirstColumn;
    startRow = range.FirstRow;
}

It seems names of cells returned by excelWorksheet.PageSetup.PrintArea are not recognized as valid. I think, you should report this problem to Aspose.Cells team. My colleagues will answer you shortly.
Best regards,

The issues you have found earlier (filed as 27261) have been fixed in this .NET update and in this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(6)