- Python XlsxWriter Tutorial
- Python XlsxWriter - Home
- Python XlsxWriter - Overview
- Python XlsxWriter - Environment Setup
- Python XlsxWriter - Hello World
- Python XlsxWriter - Important classes
- Python XlsxWriter - Cell Notation & Ranges
- Python XlsxWriter - Defined Names
- Python XlsxWriter - Formula & Function
- Python XlsxWriter - Date and Time
- Python XlsxWriter - Tables
- Python XlsxWriter - Applying Filter
- Python XlsxWriter - Fonts & Colors
- Python XlsxWriter - Number Formats
- Python XlsxWriter - Border
- Python XlsxWriter - Hyperlinks
- Python XlsxWriter - Conditional Formatting
- Python XlsxWriter - Adding Charts
- Python XlsxWriter - Chart Formatting
- Python XlsxWriter - Chart Legends
- Python XlsxWriter - Bar Chart
- Python XlsxWriter - Line Chart
- Python XlsxWriter - Pie Chart
- Python XlsxWriter - Sparklines
- Python XlsxWriter - Data Validation
- Python XlsxWriter - Outlines & Grouping
- Python XlsxWriter - Freeze & Split Panes
- Python XlsxWriter - Hide/Protect Worksheet
- Python XlsxWriter - Textbox
- Python XlsxWriter - Insert Image
- Python XlsxWriter - Page Setup
- Python XlsxWriter - Header & Footer
- Python XlsxWriter - Cell Comments
- Python XlsxWriter - Working with Pandas
- Python XlsxWriter - VBA Macro
- Python XlsxWriter Useful Resources
- Python XlsxWriter - Quick Guide
- Python XlsxWriter - Useful Resources
- Python XlsxWriter - Discussion
Python XlsxWriter - Page Setup
The worksheet page setup methods are related to appearance of the worksheet when it is printed. These worksheet methods control the orientation, paper size, margins, etc.
set_landscape()
This method is used to set the orientation of a worksheet's printed page to landscape.
set_portrait()
This method is used to set the orientation of a worksheet's printed page to portrait. This is the default orientation.
set_page_view()
This method is used to display the worksheet in "Page View/Layout" mode.
set_paper()
This method is used to set the paper format for the printed output of a worksheet. It takes index as an integer argument. It is the Excel paper format index.
Following are some of the paper styles and index values −
Index | Paper format | Paper size |
---|---|---|
0 | Printer default | Printer default |
1 | Letter | 8 1/2 x 11 in |
2 | Letter Small | 8 1/2 x 11 in |
3 | Tabloid | 11 x 17 in |
4 | Ledger | 17 x 11 in |
5 | Legal | 8 1/2 x 14 in |
6 | Statement | 5 1/2 x 8 1/2 in |
7 | Executive | 7 1/4 x 10 1/2 in |
8 | A3 | 297 x 420 mm |
9 | A4 | 210 x 297 mm |
set_margin()
This method is used to set the margins of the worksheet when it is printed. It accepts left, right, top and bottom parameters whose values are in inches. All parameters are optional The left and right parameters are 0.7 by default, and top and bottom are 0.75 by default.
To Continue Learning Please Login
Login with Google