Recent

Author Topic: I open the file and save. All formulas are lost  (Read 1381 times)

veb86

  • Jr. Member
  • **
  • Posts: 67
I open the file and save. All formulas are lost
« on: May 17, 2024, 02:52:51 pm »
Hello. I'm back.
I tried to work with OLE but it is very slow.
I have a large number of calculations that I want to do in Excel. I am ready to add the formulas I need that are not in the library, but under your control.
Now I decided to try this library again, how many formulas will be lost. As a result, I lose absolutely everything. I think I'm making some mistake. Please help me. Revision:9261

my code:
Code: Pascal  [Select][+][-]
  1. MyWorkbook := TsWorkbook.Create;  
  2. MyWorkbook.ReadFromFile('d:\4.xlsx', sfOOXML);
  3. MyWorkbook.Options := MyWorkbook.Options + [boAutoCalc];
  4. MyWorkbook.WriteToFile('d:\444.xlsx', sfOOXML,true);  
  5.  
« Last Edit: May 17, 2024, 03:39:07 pm by veb86 »

wp

  • Hero Member
  • *****
  • Posts: 12530
Re: I open the file and save. All formulas are lost
« Reply #1 on: May 17, 2024, 04:22:01 pm »
By default, fpspreadsheet does not read formulas. You must activate this by adding [boReadFormulas] to the Workbook.Options. And do the BEFORE reading.

https://wiki.lazarus.freepascal.org/FPSpreadsheet#Formulas

veb86

  • Jr. Member
  • **
  • Posts: 67
Re: I open the file and save. All formulas are lost
« Reply #2 on: May 17, 2024, 04:39:15 pm »
Thank you. It worked. Now we will need to add new formulas.
For now it is very necessary:
INDEX
MATCH
ROUNDUP

I think it's worth starting with ROUNDUP)))

Please tell me where to read about adding new formulas.

wp

  • Hero Member
  • *****
  • Posts: 12530

 

TinyPortal © 2005-2018