Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page view can be set to 'pageBreakPreview' #576

Closed

Conversation

patrickziegler
Copy link

This commit adds the optional argument view to Worksheet.set_page_view(self, view="pageLayout") to enable the user to select other page views such as "pageBreakPreview".

This commit does not change the API in any way. Two test functions have been added and the documentation was updated.

Fixes #575

@amk26cap
Copy link

amk26cap commented Dec 3, 2021

@jmcnamara @patrickziegler I would like to use this feature - is there some reason not to merge it yet? Thank you

@jmcnamara
Copy link
Owner

is there some reason not to merge it yet?

Mainly because there were hardly any requests for this feature and it would need some more tests before I could merge it. But if there is interest I can move it up the TODO list (probably at the end of this month).

@amk26cap
Copy link

amk26cap commented Dec 4, 2021

is there some reason not to merge it yet?

Mainly because there were hardly any requests for this feature and it would need some more tests before I could merge it. But if there is interest I can move it up the TODO list (probably at the end of this month).

Got it, ok, thank you.

@patrickziegler patrickziegler changed the title Page view can now be set to 'pageBreakPreview' Page view can be set to 'pageBreakPreview' Dec 6, 2021
@sonarcloud
Copy link

sonarcloud bot commented Dec 6, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@patrickziegler
Copy link
Author

Hey together, after seeing your comments, I revisited this again and removed one unnecessary change. If you have further suggestions for improvement, I would add them too.

@amk26cap as a quick alternative, I used something along the following lines back then.

class WorksheetFixed(xlsxwriter.worksheet.Worksheet):
    def set_page_view(self, view="pageLayout"):
        self.page_view = view

@jmcnamara
Copy link
Owner

I've added this as a feature to XlsxWriter v3.1.2 via the worksheet.set_pagebreak_view() method:

import xlsxwriter

workbook = xlsxwriter.Workbook("test.xlsx")
worksheet = workbook.add_worksheet()

worksheet.write("A1", "Hello")
worksheet.write("Z100", "Hello")

worksheet.set_h_pagebreaks([10, 20, 30, 40])

worksheet.set_pagebreak_view()

workbook.close()

Output:

screenshot

Thanks for the PR and the prompt.

@jmcnamara jmcnamara closed this May 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selecting pageBreakPreview as view type
3 participants