PageBreak openpyxl

282 views
Skip to first unread message

Denis Bourouffala

unread,
Oct 17, 2021, 12:48:51 AM10/17/21
to openpyx...@googlegroups.com
Good Morning,

I want to create a pagebreak with openpyxl it's possible ?

Best regards

Charlie Clark

unread,
Oct 18, 2021, 7:30:58 AM10/18/21
to openpyx...@googlegroups.com
On 17 Oct 2021, at 6:48, Denis Bourouffala wrote:

> Good Morning,
>
> I want to create a pagebreak with openpyxl it's possible ?

Yes, see https://openpyxl.readthedocs.io/en/latest/api/openpyxl.worksheet.pagebreak.html

Charlie

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Waldlehne 23
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226

Jesse

unread,
Sep 1, 2023, 3:06:26 PM9/1/23
to openpyxl-users
A few years late on this, but I just ran into the same thing, and had trouble at first understanding what to do from the API docs.  This seems to do the trick, to (for example) add a break after the 10th row:

sheet.row_breaks.append(Break(10))

id evidently represents the row number (?)

Ivan Andy

unread,
Feb 19, 2024, 8:23:30 AMFeb 19
to openpyxl-users
Good  Morning
I want to create two or more pagebreaks, but openpyxl ignore second and next.
my code for example 
sheet.row_breaks = RowBreak(brk=(Break(l + 38), Break(l)), count=2, manualBreakCount=2)

пятница, 1 сентября 2023 г. в 22:06:26 UTC+3, Jesse:
Reply all
Reply to author
Forward
0 new messages