Recent

Author Topic: [Solved] Word wrapping in an TsWorksheetGrid?  (Read 1312 times)

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
[Solved] Word wrapping in an TsWorksheetGrid?
« on: January 25, 2022, 02:50:42 pm »
Hi,

Is it possble to word wrap in a TsWorksheetGrid?

I've read through the documentaiton for FPSpreadsheet and there is an option for wordwrapping in a worksheet, but I just don't know how to connect the (non-vidsual) worksheeet to the visual WorksheetGrid

// Example: activate wordwrap in cell A1
MyWorksheet.WriteWordwrap(0, 0, true)

Any help would be appreciated

Many thanks
Dave
« Last Edit: January 28, 2022, 11:31:32 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

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Word wrapping in an TsWorksheetGrid?
« Reply #1 on: January 25, 2022, 03:16:05 pm »
There's a property for it: TsWorksheetGrid.Wordwrap[col,row]

This code toggle this property for the current cell in the grid:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   with sWorksheetGrid1 do
  4.     Wordwrap[Col, Row] := not Wordwrap[Col, Row];
  5. end;

See also: https://wiki.lazarus.freepascal.org/TsWorksheetGrid#Cell_formatting (at the end of the first bullet list).

daveinhull

  • Sr. Member
  • ****
  • Posts: 297
  • 1 divided by nothing must still be 1!
Re: Word wrapping in an TsWorksheetGrid?
« Reply #2 on: January 25, 2022, 03:24:23 pm »
Many thanks wp  :D
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