使用R中的xlsx包来调整xlsx文件中的页面设置
我正在尝试更改 xlsx 文件的页面设置,以便将其打印为横向而不是纵向,我尝试了以下操作:
library(xlsx)
wb <- createWorkbook()
sheet <- createSheet(wb, "Sheet1")
ps <- printSetup(sheet, landscape=TRUE, copies=3)
如果我创建一个新的 Excel 工作簿,这是可以的,但当我创建一个新的 Excel 工作簿时,我无法使用它我正在使用 loadWorkbook
函数加载 xls 文件。我想知道为什么。
更新:我正在处理 xls 文件,但不是 xlsx 文件,发现下面的答案无法解决我的问题,还有其他建议吗?谢谢。
I am trying to change the page setting of a xlsx file so that it will be printed as landscape, but not portrait, I tried the following:
library(xlsx)
wb <- createWorkbook()
sheet <- createSheet(wb, "Sheet1")
ps <- printSetup(sheet, landscape=TRUE, copies=3)
This is OK if I create a new Excel workbook, but I can't use it when I am using the loadWorkbook
function to load an xls file. I wonder why.
Update: I am working on a xls file but not xlsx file and found the answer below cannot solve my problem, any further suggestions? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以通过使用 getSheets 选择要设置打印区域的工作表来使其工作:
I can get it to work by using
getSheets
to select the sheet to set the print area for: