Recent

Author Topic: Filled horizontal alignment  (Read 1678 times)

bpranoto

  • Full Member
  • ***
  • Posts: 183
Filled horizontal alignment
« on: May 09, 2024, 12:45:23 pm »
Does FPSpreadsheet support filled horizontal alignment?

The tsHorAlignment set only has haDefault, haLeft, haCenter and haRight

Thank you.

wp

  • Hero Member
  • *****
  • Posts: 12296
Re: Filled horizontal alignment
« Reply #1 on: May 09, 2024, 07:17:50 pm »
You mean justified alignment in which the widths of the spaces are adjusted so that the cell text is aligned at both left and right sides? This was not supported because the LCL drawing styles do not cover this case. But on the other hand, somebody who only wants to read/write files may be missing it. Therefore, I just extended the TsHorAlignment enumeration by an element haJustify:
Code: Pascal  [Select][+][-]
  1. type
  2.   TsHorAlignment = (haDefault, haLeft, haCenter, haRight, haJustify);

This is supported now by xlsx, xls (Excel 8, Excel 5), Excel xml, OpenDocument ods for both reading and writing.

But note that the new version is only available on CCR so far. For installation you must use svn, or you download the zipped snapshot from https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/fpspreadsheet/.

bpranoto

  • Full Member
  • ***
  • Posts: 183
Re: Filled horizontal alignment
« Reply #2 on: May 10, 2024, 04:18:04 am »
Quote
You mean justified alignment in which the widths of the spaces are adjusted so that the cell text is aligned at both left and right sides?
No, with fill horizontal alignment, the text cell value is repeated so it fills the cell width

« Last Edit: May 10, 2024, 08:51:16 am by bpranoto »

TRon

  • Hero Member
  • *****
  • Posts: 3145
Re: Filled horizontal alignment
« Reply #3 on: May 10, 2024, 04:29:54 am »
No, with fill horizontal alignment, the text cell value is repeated so it fills the cell width
I am sure I misunderstand but can you show a picture of how something like that should look like ?

As I interpret that statement it is something that I have never seen before in a spreadsheet.
All software is open source (as long as you can read assembler)

bpranoto

  • Full Member
  • ***
  • Posts: 183
Re: Filled horizontal alignment
« Reply #4 on: May 10, 2024, 04:36:16 am »
Libreoffice has 5 horizontal alignment: Default, Left,Center,Right,Justified,Filled and Distributed.

In the attachment, the A1 cell's text value is =, when we apply the Filled horizontal alignment it draws repeated = occupy the cell width

TRon

  • Hero Member
  • *****
  • Posts: 3145
Re: Filled horizontal alignment
« Reply #5 on: May 10, 2024, 04:45:58 am »
Thank you very much for the picture and explanation bpranoto.

You have thought me something new about spreadsheets (at least about formatting cells)  :) (I never used that feature before)

As far as I know fpspreadsheet (currently) does not have provision for that. As author wp is able to tell more.
« Last Edit: May 10, 2024, 04:48:37 am by TRon »
All software is open source (as long as you can read assembler)

bpranoto

  • Full Member
  • ***
  • Posts: 183
Re: Filled horizontal alignment
« Reply #6 on: May 10, 2024, 04:52:09 am »
You mean justified alignment in which the widths of the spaces are adjusted so that the cell text is aligned at both left and right sides?

This is called Distributed alignment

Justified alignment is different:
  • if the text is only 1 row, it is left aligned
  • if the text is wrapped to multiple rows, rows before the last row is aligned to left and right, but the last row is left aligned

See the difference In the attachment, cell A6 is distributed  while cell A10 is justified
« Last Edit: May 10, 2024, 07:25:03 am by bpranoto »

bpranoto

  • Full Member
  • ***
  • Posts: 183
Re: Filled horizontal alignment
« Reply #7 on: May 10, 2024, 04:56:07 am »
Thank you very much for the picture and explanation bpranoto.

You have thought me something new about spreadsheets (at least about formatting cells)  :) (I never used that feature before)

As far as I know fpspreadsheet (currently) does not have provision for that. As author wp is able to tell more.

You're welcome TRon. This feature is useful for a balance sheet financial report like in the attachment.

wp

  • Hero Member
  • *****
  • Posts: 12296
Re: Filled horizontal alignment
« Reply #8 on: May 10, 2024, 12:35:35 pm »
Here you are: r9348 supports justified, distributed and filled alignments:

Code: Pascal  [Select][+][-]
  1. TsHorAlignment = (haDefault, haLeft, haCenter, haRight, haJustified, haDistributed, haFilled);

bpranoto

  • Full Member
  • ***
  • Posts: 183
Re: Filled horizontal alignment
« Reply #9 on: May 10, 2024, 12:57:56 pm »
Thank you very much wp..

 

TinyPortal © 2005-2018