Error '15.0' is not a Valid floating point value when saving . xls

Asked

Viewed 363 times

2

While trying to save a file. xls I am having the following error:

'15.0' is not a Valid floating point value

I’m trying to save 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;
  • The file path is with the same "right" bar?

2 answers

1

Make a change to your code just below the 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;

1


The problem is that the THojaCalc while saving, try to grab the App version OleObject, which in your case is Excel, and play that version for a Extended, and the version of your Excel is '15.0'. There’s no way you can play a '15.0' for a Float, Voce will need to change this guy to '15,0'.

I made a change to the component, and I will suggest the adjustment for the collaborators.

So you can follow, exchange line 890 for this code:

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

Note: Remembering that treat the version of an app as Float it’s not safe.

  • I think the project has been discontinued, but follow the Fork link: https://github.com/charoleizer/Delphi-SpreadSheets

Browser other questions tagged

You are not signed in. Login or sign up in order to post.