Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xlwt - Print Range Settings

Summary: How do I set the print range settings from xlwt?

I have a document that is currently set as four pages for the purposes of printing, and I need to make it so that the print range is set to only treat it as one page. The documentation for xlwt (outside of the basics) is hard to find.

The only things I've been able to find so far are:

  • A Visual Basic answer, but the answer doesn't describe the terminology or how it works.
  • A Google Groups discussion that also doesn't explain what any of the values do.
like image 665
Havvy Avatar asked Mar 14 '14 19:03

Havvy


1 Answers

Try

worksheet.fit_num_pages=1

Or worksheet.set_fit_num_pages(1) both of which shrinks everything to fit on one page. The default value is set to 0 meaning no scaling happens.

ws.print_scaling is a scaling percentage, set by default to 100.

ws.paper_size_code defaults to 9 on my system, but presumably lets you choose between A3, A4, ...

like image 165
pandita Avatar answered Nov 09 '22 17:11

pandita