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

Free Support Forum - aspose.com

Where is ConverterXls2Doc written by Alexey?

how to convert xls or xlsx to doc?
where is ConverterXls2Doc demo to download?
THX

Hi,


Thanks for your inquiry. You can convert Excel documents to Word using Aspose.Words and Aspose.Cells. I have attached here the Java version of this converter i.e. ConverterXls2Doc.zip.

Please let us know if you need more information, We are always glad to help you.

Best Regards,

Thanks a lot

I use aspose-cells-7.0.3.jar,but the sourcecode of the demo dose not match.so it occurs many errors。

Hi

Thanks for your request. Most likely, Awais attached old version of the code. Please try using the attached code and let me know if case of any issues.

Best regards,

thanks,it works well.
But when the text of cell in excel is date(etc:2011-12-01),the text is formated as 2011-12-01T00:00:00
When the text of cell in excel is long integer ,the text is formated as
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
<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>ZH-CN</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:SpaceForUL/>
<w:BalanceSingleByteDoubleByteWidth/>
<w:DoNotLeaveBackslashAlone/>
<w:ULTrailSpace/>
<w:DoNotExpandShiftReturn/>
<w:AdjustLineHeightInTable/>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
<w:UseFELayout/>
</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]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.5pt; mso-bidi-font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:1.0pt;}

<![endif]–>4.11110008E8.
How to resolve these questions?

thanks.

Hi

Thanks for your request. I suppose the problem occurs in the following method (see the highlighted code):

///

/// Get text with formating from Excel cell

///

/// Input Excel cell

/// Parent document

/// Run that contains text with formating

private Run GetTextFromCell(com.aspose.cells.Cell cell, Document doc) throws Exception

{

Run run = new Run(doc);

if(cell.getValue()!=null)

{

run.setText(cell.getValue().toString().replace(ControlChar.LINE_FEED_CHAR, ControlChar.LINE_BREAK_CHAR));

//Convert Excel Font to Words Font

ImportFont(run.getFont(), cell.getStyle().getFont());

}

return run;

}

Here we use toString method, that uses invariant culture to format date and decimal values. You can change the code that that it format values properly.

Best regards,

Thanks.It’s right.The string from cell must be formated.

Hi

Please feel free to ask if you need more assistance, we are always glad to help you.

Best regards,