Recent

Author Topic: FPSpreadsheet: set a cell to #N/A  (Read 849 times)

upsidasi

  • New Member
  • *
  • Posts: 31
FPSpreadsheet: set a cell to #N/A
« on: June 09, 2022, 01:00:50 pm »
Hi,

What is the correct way to set a cell to #N/A in FPSpreadsheet?

I tried the following options:
  • molWS.WriteNumber(ARow, ACol, Nan);  ==> doesn't work
  • molWS.Writeform WriteCellValueAsString(ARow, ACol, '#N/A');  ==> doesn't work
  • molWS.Writeform WriteText(ARow, ACol, '#N/A');  ==> doesn't work
  • molWS.WriteFormula(ARow, ACol, '#N/A'); ==> it works, but is it the way to go?

Would it be different if I wanted to set a cell to #NUM! or #VALUE! ?
Thanks!

wp

  • Hero Member
  • *****
  • Posts: 11906
Re: FPSpreadsheet: set a cell to #N/A
« Reply #1 on: June 09, 2022, 01:49:00 pm »
Code: Pascal  [Select][+][-]
  1. type
  2.   TsWorksheet = class(...)
  3.     function WriteErrorValue(ARow, ACol: Cardinal; AValue: TsErrorValue): PCell; overload;
  4.     procedure WriteErrorValue(ACell: PCell; AValue: TsErrorValue); overload;
where TsErrorValue is declared in unit fpsTypes
Code: Pascal  [Select][+][-]
  1.   {@@ Error code values
  2.     @value  errOK                  ok, no error
  3.     @value  errEmptyIntersection   A space was used in formulas that reference multiple ranges; a comma separates range references (#NULL!)
  4.     @value  errDivideByZero        Trying to divide by zero (#DIV/0!)
  5.     @value  errWrongType           The wrong type of operand or function argument is used (#VALUE!)
  6.     @value  errIllegalRef          A reference is invalid (#REF!)
  7.     @value  errWrongName           Text in the formula is not recognized (#NAME?)
  8.     @value  errOverflow            A formula has invalid numeric data for the type of operation (#NUM!)
  9.     @value  errArgError            A formula or a function inside a formula cannot find the referenced data (#N/A)
  10.     @value  errFormulaNotSupported This formula is not suppored by fpSpreadsheet (error code not used by Excel and Calc)   }
  11.   TsErrorValue = (
  12.     errOK,                 // no error
  13.     errEmptyIntersection,  // #NULL!
  14.     errDivideByZero,       // #DIV/0!
  15.     errWrongType,          // #VALUE!
  16.     errIllegalRef,         // #REF!
  17.     errWrongName,          // #NAME?
  18.     errOverflow,           // #NUM!
  19.     errArgError,           // #N/A  ( = #NV in German )
  20.     errFormulaNotSupported // No excel error
  21.   );

upsidasi

  • New Member
  • *
  • Posts: 31
Re: FPSpreadsheet: set a cell to #N/A
« Reply #2 on: June 09, 2022, 02:58:32 pm »
Thank you wp!

I clearly need a new pair of glasses!

 

TinyPortal © 2005-2018