Recent

Author Topic: pagebreak  (Read 2574 times)

kjteng

  • Sr. Member
  • ****
  • Posts: 259
pagebreak
« on: July 23, 2019, 03:09:49 am »
Is there a way to set/remove pagebreak for worksheet ?  Have I missed out some methods/ properties of pagelayout?

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: pagebreak
« Reply #1 on: July 25, 2019, 10:55:49 am »
Try the current version from svn. There are still some issues with the OpenDocument format, but the others (xlsx, xls (BIFF8-BIFF2), Excel xml) are working correctly.

See also: https://wiki.lazarus.freepascal.org/FPSpreadsheet#Page_breaks

[EDIT]
All tests passed now.
« Last Edit: July 27, 2019, 06:40:46 pm by wp »

kjteng

  • Sr. Member
  • ****
  • Posts: 259
Re: pagebreak
« Reply #2 on: July 26, 2019, 04:18:58 pm »
Tested with xlsx file and have the following observations:
AddPageBreakToRow:
Add one pagebreak -   No page break appear when the worksheet is opened in Excel
Add two pagebreaks - only one pagebreak appear when opened in Excel and the pagebreak is not at correct row

AddPageBreakToCol seems to work fine at the beginning. However, we will have the same issue as above if we Reset All Pagebreaks in Excel and then open the file in fpspread.  ie.  one pagebreak less will be added and the verticle page break position runs.

Attached is my testprogram



wp

  • Hero Member
  • *****
  • Posts: 11923
Re: pagebreak
« Reply #3 on: July 26, 2019, 06:52:00 pm »
Found a stupid bug. Please check again.

Also added properties PageBreakPen (type TPen, default: blue dashed line) and ShowPageBreaks (type: Boolean, default: true) to the worksheet in order to display page breaks in the grid.

kjteng

  • Sr. Member
  • ****
  • Posts: 259
Re: pagebreak
« Reply #4 on: July 29, 2019, 01:17:35 pm »
Working fine with xlsx file.
Encountered some problem with ods:
1. Column pgbreak created in Libreoffice (new file)  does not appear when the file is opened in fpSpread
2. for worksheet with multiple column pgbreaks (created in fpSpread) -  if one of the the column pgbreak is removed (and saved) in LibreOffice,  all column pgbreaks disappear when the file is opened in fpSpread (or sometime I get just a blank grid).

BTW, may I know  is there any difference between Hidecol  and setting columnwidth to 0?

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: pagebreak
« Reply #5 on: July 31, 2019, 11:03:26 pm »
Try r7091. It should be better now.

may I know  is there any difference between Hidecol  and setting columnwidth to 0?
The column records of the worksheet contain a set field "Options" with the possible elements "croHidden" or "croPageBreak" which are added when a column is hidden or follows a page-break. This is the information evaluated when the file is written or read. The column width, on the other hand, can contain any value.

In the worksheet grid, however, the possibility to "truely" hide columns like in the worksheet would make conversion of grid column to worksheet column very complicated. So, I decided to keep the hidden columns and just set their width to 0 via the grid's ColWidth[] property. The unhidden colwidth is retained in the worksheet's column record. Therefore, it is possible to hide a column having a special width in the grid, and when the column is re-shown it gets its original width back. There is one issue, though: because the hidden column is still present in the grid with zero width, the column reappears when its border is dragged with the mouse in the column header.

kjteng

  • Sr. Member
  • ****
  • Posts: 259
Re: pagebreak
« Reply #6 on: August 01, 2019, 01:24:16 am »
Thanks for the  detailed explaination.
Will try the SVN later today.

kjteng

  • Sr. Member
  • ****
  • Posts: 259
Re: pagebreak
« Reply #7 on: August 02, 2019, 04:41:00 am »
Tested: OK on ods now. TQ.

 

TinyPortal © 2005-2018