I am new to the TFlexCelGrid component, so please forgive me if this is a dumb question!
After entering a value or formula into a cell, how do you get the Grid to recalculate?
Thanks in advance,
Rick Stephens
Richard,
Sadly, as I said to you by email, you need FlexCel 6 to recalculate. And to use FlexCel 6 you need Delphi XE or newer.
To do recalculation with FlexCelGrid and FlexCel 6 you need to:
1)Install FlexCel 6 in Xe or newer
2)Install FlexCel 3, selecting to install XlsxAdapter when the setup asks you to.
3)In the UpdateCell event, add this lines of code:
procedure TFXlsViewer.UpdateEdCell(const ARow, ACol: integer);
var
AColor: integer;
Fmt: TFlxFormat;
begin
if LastEditorMode and (not Data.EditorMode or (ARow <> LastRow) or (ACol <> LastCol)) then
begin
(FlexCelImport.GetWorkbook as TXlsxFile).GetTWorkbook.Recalc;
end;
With this you should get a grid that recalculates, as you can see in the exe demo:
But as said, Sadly recalculation is a feature of FlexCel 6. It is one of the 2 features (the only being xlsx support) which make FlexCel 6 so big: We need to add support for over 300 functions, and that is a lot of code.
You did tell me that and I completely missed it. Sorry.
Since this is in D2009, I suppose I could write a DLL in XE5 that would load the sheet, recalculate it, and then save it. I could then call that from my D2009 program and then reload the sheet afterwards.
Indeed, a dll could be a solution. We actually have one internally already working. I'll send it to you via private email in a couple of days, when I finish testing it.
Thank you!! I was just about to start writing one....but I will wait for yours. I appreciate it.
How are you coming along with that DLL?
Richard,
I've sent you a dll by email, let me know if you can make it work.