Hi Aspose.cells support,
We want to extract from a CSV file (using Aspose.cells.7.3.1) data as string. So we put the ConvertNumericData to false.
It works well for integer data like “12”, and for data like “<span style=“font-size:9.0pt;mso-bidi-font-size:
12.0pt;font-family:“Arial”,“sans-serif”;mso-fareast-font-family:“Times New Roman”;
mso-ansi-language:EN-US;mso-fareast-language:FR;mso-bidi-language:AR-SA” lang=“EN-US”>74:70” and “<span style=“font-size:9.0pt;mso-bidi-font-size:
12.0pt;font-family:“Arial”,“sans-serif”;mso-fareast-font-family:“Times New Roman”;
mso-ansi-language:EN-US;mso-fareast-language:FR;mso-bidi-language:AR-SA” lang=“EN-US”>69:65” it works too. But for “<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:DoNotShowComments/>
<w:DoNotShowPropertyChanges/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>FR</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:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<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]–><span style=“font-size:9.0pt;mso-bidi-font-size:
12.0pt;font-family:“Arial”,“sans-serif”;mso-fareast-font-family:“Times New Roman”;
mso-ansi-language:EN-US;mso-fareast-language:FR;mso-bidi-language:AR-SA” lang=“EN-US”>64:60<!–[if gte mso 10]>
<![endif]–>", it returns an Aspose.cells.DateTime. So why the last data is not considered as a string?
Code used to set ConvertNumericData to false :
LoadOptions lo = new LoadOptions(FileFormatType.CSV);Code used to get the cell vallue :
lo.setConvertNumericData(false);
lo.setLocale(Locale.ENGLISH);
try {
workbook = new Workbook(csvPath, lo);
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
Cell currentCell = sheetCells.get(row, cellInd);N.B: I join 3 attachments.
Object cellValue = currentCell.getValue();
Template.rtf : is the desired result.
CSVTested.csv : is the csv file where the data are extracted
Result.rtf : is the current result
Cordially.
jplim.