Recent

Author Topic: Error on enter text to WorksheetGrid  (Read 5944 times)

alexs75

  • Full Member
  • ***
  • Posts: 112
Error on enter text to WorksheetGrid
« on: March 02, 2016, 01:34:15 pm »
In demo examples/visual/fpsctrls
enter to cell text 11+22/11 - work normal.
enter to cell text 55/12/12 - i'm see 1/ 1 - this error.

wp

  • Hero Member
  • *****
  • Posts: 13512
Re: Error on enter text to WorksheetGrid
« Reply #1 on: March 02, 2016, 01:46:05 pm »
I am probably as confused as fpspreadsheet on this data entry: What kind of data do you want to enter? Is it a date? Then it depends on the format settings of your system which number is taken as year, month, or day, or set the ShortDateString of the workbook's FormatSettings correctly. Or is it a fraction? Then you should use a space to split off the integer part of the number (i.e. "55 12/12").

alexs75

  • Full Member
  • ***
  • Posts: 112
Re: Error on enter text to WorksheetGrid
« Reply #2 on: March 02, 2016, 02:37:17 pm »
it's simple text

wp

  • Hero Member
  • *****
  • Posts: 13512
Re: Error on enter text to WorksheetGrid
« Reply #3 on: March 02, 2016, 02:52:56 pm »
I see - that's the format which I always postponed: format a number as text: Entered text is interpreted to be a number or a date (in your case), but should remain a text... I'll put it on my list.

wp

  • Hero Member
  • *****
  • Posts: 13512
Re: Error on enter text to WorksheetGrid
« Reply #4 on: March 09, 2016, 11:05:59 am »
There's a simple workaround: Enter the text as formula: ="55 12/12" (quotation marks around the text mandatory).

At the moment I am working at implementing a text format. But it's a bit more complicated than I thought, so please be patient. When it's finished you will be able to enter an apostrophe first to avoid processing of the text as a number or date (i.e. '55 12/12) - this is like in Excel.

alexs75

  • Full Member
  • ***
  • Posts: 112
Re: Error on enter text to WorksheetGrid
« Reply #5 on: March 09, 2016, 11:50:07 am »
ok.
thx.

wp

  • Hero Member
  • *****
  • Posts: 13512
Re: Error on enter text to WorksheetGrid
« Reply #6 on: March 09, 2016, 10:43:26 pm »
It's in trunk now. In order to enter a text such as 1/10 into a cell of the worksheet grid and prevent its automatic conversion to fraction or date there are two options (besides the formula method of the previous post):
  • Enter the text '1/10 (with a leading apostrophe), or
  • Format the cell as "text" (in the demo_ctrls, use the menu "Format"/"Numberformat"/"Text", or the "Custom..." selection of one of the format dropdowns of the toolbar), then enter the text directly.
P.S.
Reformatting back to number is a bit clumsy in some cases. But Excel does not treat this case easily either. I do not change it at the moment and hope that it will not be needed too often.
 

alexs75

  • Full Member
  • ***
  • Posts: 112
Re: Error on enter text to WorksheetGrid
« Reply #7 on: March 10, 2016, 08:50:17 am »
Work normal. Thx.

Module sHyperlinkForm not compiled with latest lazarus (Lazarus 1.7 r51896M FPC 3.1.1 x86_64-linux-gtk 2). Need use unit LazFileUtils.

 

TinyPortal © 2005-2018