Error '15 .0 'is not a valid floating point value when saving .xls

2

When trying to save an .xls file I'm having the following error:

  

'15 .0 'is not a valid floating point value

I'm trying to save it like this:

var
HCalc : THojaCalc;
vArquivo : String;

vArquivo := 'C:/MinhaPasta/Arquivo.xls'; //dentro do arquivo.xls não tem nenhum valor
HCalc := THojaCalc.create(vArquivo, False);
HCalc.ActivateSheetByIndex(1);
HCalc.CellText[3,2] := 'teste';
HCalc.SaveDocAs(vArquivo,True); //aqui da o erro
HCalc.Free;
    
asked by anonymous 29.07.2016 / 14:00

2 answers

1

The problem is that THojaCalc when saving, tries to get the version of the OleObject Application, which in your case is Excel, and play this version for Extended , and your Excel version is '15 .0 '. There's no way you can play a '15 .0 'for a Float , you'll need to change that face to '15, 0'.

I've made a change to the component, and I'll suggest tuning for developers.

For you to follow, change line 890 for this code:

exVersion := StrToFloat(StringReplace(m_vPrograma.Application.Version, '.', ',', [rfReplaceAll]), m_AmericanFormat);

Note: Remembering that treating an app's version as Float is not secure.

    
29.07.2016 / 15:39
1

Make a change to your code just below CellText .

Also use the left bar \ in the file path!

var
HCalc : THojaCalc;
vArquivo : String;

vArquivo := 'C:\MinhaPasta\Arquivo.xls'; //dentro do arquivo.xls não tem nenhum valor
HCalc := THojaCalc.create(vArquivo, False);
HCalc.ActivateSheetByIndex(1);
HCalc.CellText[3,2] := 'teste';
HCalc.AddNewSheet('AbaTeste'); //Aqui
HCalc.SaveDocAs(vArquivo,True); //aqui da o erro
HCalc.Free;
    
29.07.2016 / 15:16