Recent

Author Topic: Cell size and word wrap  (Read 7392 times)

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Cell size and word wrap
« on: June 02, 2012, 01:04:31 am »
If I understand correctly, fpspreadsheet does not support setting cell sizes and word wrapping.
Are there any plans for that? An estimate of the amount of work involved?

I have mistakenly recommented fpspreadsheet to my students as a method to export reports
generated by their applications to Excel -- now they all fail their assignment.
I now have to either find a quick fix or cancel the assignment.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Cell size and word wrap
« Reply #1 on: June 03, 2012, 06:21:47 pm »
For which format? xls or xlsx?

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Cell size and word wrap
« Reply #2 on: June 13, 2012, 06:30:37 am »
Any one -- this was just a student project. Sorry -- I somehow missed your reply.
I have already dropped the assignment I mentioned as impossible one.
Maybe next year :-)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Cell size and word wrap
« Reply #3 on: June 13, 2012, 08:54:24 am »
I started investigating what would take to implement this on OpenDocument and:

1> There is no such thing as cell size. There is column size and row size, which one do you need? Both? This will need adding a list of rows and a list of columns to each worksheet.

2> Word-wrap seams easy to implement, it is just a another formatting setting for a cell

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Cell size and word wrap
« Reply #4 on: June 13, 2012, 09:21:25 am »
I added support for word-wrap in OpenDocument in rev 2463

dcminus

  • New Member
  • *
  • Posts: 24
Re: Cell size and word wrap
« Reply #5 on: August 15, 2013, 10:27:17 am »
1> There is no such thing as cell size. There is column size and row size, which one do you need? Both? This will need adding a list of rows and a list of columns to each worksheet.

I know this topic is old, but I think my question is related.

I am trying to use TSWorksheetGrid for my app to import and present data to the user.

I would like to resize my columns based on their content length. Is there a function to do this?


Thanks in advance,

DC

PS.: Sorry if it is very trivial, just started to use Lazarus yesterday :)

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Cell size and word wrap
« Reply #6 on: August 15, 2013, 02:58:29 pm »
Maybe this?

Code: [Select]
procedure TForm1.StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer;
  aRect: TRect; aState: TGridDrawState);
begin
  if StringGrid1.ColWidths[ACol] < Canvas.TextWidth(StringGrid1.Cells[ACol, ARow]) + 10  then
    StringGrid1.ColWidths[ACol] := Canvas.TextWidth(StringGrid1.Cells[ACol, ARow]) + 10;
end;

dcminus

  • New Member
  • *
  • Posts: 24
Re: Cell size and word wrap
« Reply #7 on: August 15, 2013, 03:52:28 pm »
Brilliant! Just what I was after.  8)

Thanks a lot typo!

 

TinyPortal © 2005-2018