OpenPyXL - 如何设置工作表的打印区域 [英] OpenPyXL - How to set print area for a worksheet

查看:119
本文介绍了OpenPyXL - 如何设置工作表的打印区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 OpenPyXL 创建发票.我有一个工作表,其中包含要打印的区域和该范围之外的一些注释.我几乎一切都在工作,但我无法在 API 中找到任何功能的任何内容.有没有办法在工作表上设置打印区域?

I am trying to use OpenPyXL to create invoices. I have a worksheet with an area to be printed and some notes outside of that range. I have most everything working but I am unable to find anything in the API for one function. Is there a way to set the print area on a worksheet?

我能找到很多打印设置,但不能找到打印区域.

I am able to find lots of print settings, but not the print area.

谢谢!

推荐答案

在 openpyxl 的当前版本(撰写本文时为 2.5.4)中,这是使用以下方法完成的:

In the current version of openpyxl (2.5.4 at time of writing), this is done using:

Worksheet.print_area = "A1:L25"

文档位于这里.

这篇关于OpenPyXL - 如何设置工作表的打印区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆