Bad conversion at xlsxooxml.pas
Original Reporter info from Mantis: Tulurdes
-
Reporter name:
Original Reporter info from Mantis: Tulurdes
- Reporter name:
Description:
This is a fix suggestion on a bug that I've found when reading some random OOXML files for conversion to CSV.
On the procedure TsSpreadOOXMLReader.ReadCell(ANode: TDOMNode; AWorksheet: TsBasicWorksheet);
at line 777 sometimes the StrToFloat can fail raising an conversion error.
I'd change that from
number := StrToFloat(dataStr, FPointSeparatorSettings);
to
if TryStrToFloat(dataStr,number, FPointSeparatorSettings) then
Also at the same file at line 792 the same can happen when converting StrToInt.
I'd change the first line to another tryStrToInt and this one wrap with a begin end
from
sstIndex := StrToInt(dataStr);
to
if tryStrToInt(dataStr,sstIndex) then begin
and add proper indentation in order to end the new if block after line 802
Steps to reproduce:
Just supply any string at dataStr that can't be converted to float
or
any string at dataStr that can't be converted to int
Additional information:
It couldn't Read a Spread Sheet with just 17000+ rows without this change, now I can read and write to CSV as I needed with perfect results.
I'll put the file with my changes below
Mantis conversion info:
- Mantis ID: 37055