* * *

Author Topic: Auto-Fit multiple columns  (Read 1038 times)

wp

  • Hero Member
  • *****
  • Posts: 4215
Re: Auto-Fit multiple columns
« Reply #15 on: January 30, 2018, 12:44:02 pm »
Nice. Any special reason why the standard TBitmap is not enough? Not sure whether "if Worksheet.IsMerged(Cell) then continue" is correct - I think this skips the base of the merged block. Probably better to use "if Worksheet.IsMerged(Cell) and not Worksheet.IsMergeBase(Cell) then continue".
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Hafedh TRIMECHE

  • New member
  • *
  • Posts: 26
Re: Auto-Fit multiple columns
« Reply #16 on: January 30, 2018, 12:59:13 pm »
The code is recovered from the procedure:
Code: Pascal  [Select]
  1. procedure TsCustomWorksheetGrid.AutoAdjustColumn(ACol: Integer);
  2.  
Code: Pascal  [Select]
  1. for cell in Worksheet.Cells.GetColEnumerator(GetWorkSheetCol(ACol)) do
  2.   begin
  3.     // Merged cells are not considered for calculating AutoColWidth -- see Excel.
  4.     if Worksheet.IsMerged(cell) then
  5.       continue;                                      
  6.  

TBGRABitmap is replaced by TBitmap. I guessed that TBGRABitmap is best in term of performance.

Would the PDF export functionality be added to FPSpreadsheet package?

Regards.

wp

  • Hero Member
  • *****
  • Posts: 4215
Re: Auto-Fit multiple columns
« Reply #17 on: January 30, 2018, 01:24:29 pm »
The code is recovered from the procedure:
Code: Pascal  [Select]
  1. for cell in Worksheet.Cells.GetColEnumerator(GetWorkSheetCol(ACol)) do
  2.   begin
  3.     // Merged cells are not considered for calculating AutoColWidth -- see Excel.
Ah, I remember...

Would the PDF export functionality be added to FPSpreadsheet package?
Certainly not to the basic fpspreadsheet package, I try to keep packages as slim as possible. But another dedicated package would be worth considering. Unfortunately I don't have the time at the moment-
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus