简体   繁体   中英

Setting an excel sheet in landscape mode from XLWT

I have a Python program that creates an excel sheet, but I have been asked by one of the users to modify it so that if he hits print it will print out to landscape mode, without him having to specify this. Is there some way to set the sheet to landscape in XLWT or some similar Python library for excel?

Thank you.

有了XLWT,我相信它很简单:

worksheetObject.portrait = False

I think Mark's answer was valid with previous versions of xlwt , it does not work as of version 0.7.5. The following works instead:

sheet.set_portrait(False)

Notice it is now a property of the sheet, not of the whole workbook.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM