Recent

Author Topic: [Solved] Cannot get SpreadsheetGrid.NumberFormat to work  (Read 1986 times)

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
[Solved] Cannot get SpreadsheetGrid.NumberFormat to work
« on: January 28, 2022, 12:05:05 am »
Hi,

I'm struggling a bit with FPSpreadsheetGrid at the moment.
I'm trying to formal a cell to have date format of 'mmm/yy', but it dosn't seem to work.

Code: Pascal  [Select][+][-]
  1. grid.NumberFormat[1,1] := 'mmm/yy' ;

But if I enter 1/1/22 into Cells[1,1] I just get 01/01/2022, not Jan/22 has I was expecting.

Any help would be appreciated.

many thanks in advance
Dave
« Last Edit: January 31, 2022, 09:46:22 am by daveinhull »
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
Re: Cannot get SpreadsheetGrid.NumberFormat to work
« Reply #1 on: January 30, 2022, 05:42:23 pm »
Hi,

Any thoughts from anyone?

Thanks
Dave
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Cannot get SpreadsheetGrid.NumberFormat to work
« Reply #2 on: January 30, 2022, 06:29:28 pm »
Did you try to uncheck AutoDetectCellType?

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
Re: Cannot get SpreadsheetGrid.NumberFormat to work
« Reply #3 on: January 31, 2022, 09:42:37 am »
Hi wp,

That's got it. I had looked at this and I had unchecked AutoDetectCellType, but after I had tried working with setting formats and end up detecting the cell and manually formatting the date in code.
Silly developer error, changing more than one thing at once and not sticking to the testing strategy.

Appreciate you help

Thanks
Dave
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

 

TinyPortal © 2005-2018