We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Copying excel worksheet to word

hi

Is it possible to copy the contents of a excel along with the format to word (not an image it should be editable) maybe as a table on the word.

I have explored the option of reading data and creating table but I want to know if aspose has the option of directly copying the worksheet as table on the word.

please let me know.

Hi Sarah,

Thanks for your inquiry.

First of all, please note that Microsoft Word and Microsoft Excel documents are completely different file formats; so, some features that are available in Microsoft Word are not available in Microsoft Excel and vice versa and it is hard to convert from Word to Excel and from Excel to Word with 100% fidelity.

Unfortunately, there is no direct way to convert Excel document to Word. However, it is possible using Aspose.Words and Aspose.Cells. Please use the attached utility to convert Excel document to Word document. Hope this helps you.


ConverterXls2Doc converterXls2Doc = new ConverterXls2Doc(MyDir + "Aspose.Words.xlsx", true, "Arial", "10");

converterXls2Doc.convert(false);

Document convertedWordDoc = converterXls2Doc.getDocument();

convertedWordDoc.save(MyDir + "Out.docx");

hi

Thanks for sharing the code .
It did work for me I was able to copy .
but i get a message in the document and the formatting like the header color is lost :frowning:
Is it possible to retain the formatting ??
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:DoNotOptimizeForBrowser/>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–>

Evaluation Only. Created with Aspose.Words. Copyright 2003-2016 Aspose Pty Ltd.


Also, the license is collective for aspose words and cells or seperate for each?

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Hi Sarah,

Thanks for your inquiry. Please note that in evaluation mode there are some limitations applied. E.g. Aspose.Words injects an evaluation watermark at the top of the document. The document's contents are truncated after a certain number of paragraphs during import or export.

Please request for 30-days temporary license from here:
Get temporary license

Please refer to the following article about applying license.
Applying a License

Regarding formatting issue, please share your input Excel document and output Word document here for testing? We will investigate the issue on our side and provide you more information.