Recent

Author Topic: How to read the values calculated and processed by formulas?  (Read 170 times)

dodgex

  • New Member
  • *
  • Posts: 20
How to read the values calculated  by formulas?

The ReadAsText method cannot be read
« Last Edit: May 12, 2026, 05:46:51 am by dodgex »

Nicole

  • Hero Member
  • *****
  • Posts: 1324
Re: How to read the values calculated and processed by formulas?
« Reply #1 on: May 12, 2026, 10:51:19 am »
Maybe it helps you to get answers if you post code snippets.
For you it is clear, what you mean by "formulas", for me it is not.

wp

  • Hero Member
  • *****
  • Posts: 13555
Re: How to read the values calculated and processed by formulas?
« Reply #2 on: May 12, 2026, 11:03:17 am »
The ReadAsText method cannot be read
Why not?
Code: Pascal  [Select][+][-]
  1. program Project1;
  2. uses
  3.   FPSpreadsheet, FPSTypes, xlsxOOXML;
  4. var
  5.   wbook: TsWorkbook;
  6.   wsheet: TsWorksheet;
  7. begin
  8.   wbook := TsWorkbook.Create;
  9.   try
  10.     wbook.Options := wbook.Options + [boAutoCalc];
  11.     wsheet := wbook.AddWorksheet('test');
  12.     wsheet.WriteNumber(0, 0, 2.0);
  13.     wsheet.WriteFormula(0, 1, '=A1*A1');
  14.  
  15.     WriteLn('A1 = ', wsheet.ReadAsText(0, 0));
  16.     WriteLn(wsheet.ReadFormula(0, 1), ' = ', wsheet.ReadAsText(0, 1));
  17.   finally
  18.     wBook.Free;
  19.   end;
  20.  
  21.   ReadLn;
  22. end.
  23.  

Output:
Code: [Select]
A1 = 2
A1*A1 = 4

dodgex

  • New Member
  • *
  • Posts: 20
Re: How to read the values calculated and processed by formulas?
« Reply #3 on: May 12, 2026, 11:17:00 am »
The ReadAsText method cannot be read
Why not?
Code: Pascal  [Select][+][-]
  1. program Project1;
  2. uses
  3.   FPSpreadsheet, FPSTypes, xlsxOOXML;
  4. var
  5.   wbook: TsWorkbook;
  6.   wsheet: TsWorksheet;
  7. begin
  8.   wbook := TsWorkbook.Create;
  9.   try
  10.     wbook.Options := wbook.Options + [boAutoCalc];
  11.     wsheet := wbook.AddWorksheet('test');
  12.     wsheet.WriteNumber(0, 0, 2.0);
  13.     wsheet.WriteFormula(0, 1, '=A1*A1');
  14.  
  15.     WriteLn('A1 = ', wsheet.ReadAsText(0, 0));
  16.     WriteLn(wsheet.ReadFormula(0, 1), ' = ', wsheet.ReadAsText(0, 1));
  17.   finally
  18.     wBook.Free;
  19.   end;
  20.  
  21.   ReadLn;
  22. end.
  23.  

Output:
Code: [Select]
A1 = 2
A1*A1 = 4

thank you !!!
wbook.Options := wbook.Options + [boAutoCalc];
I didn't add this code

 

TinyPortal © 2005-2018