Apache POI setPrintArea to A4 page size

て烟熏妆下的殇ゞ 提交于 2020-01-14 10:33:17

问题


I'm working with the Apache POI API to generate .xls files, and I want to set the printArea of my file.

I know there is a funcion called setPrintArea() but this one receive as parameters start and end row and column of my print area.

I want to know, if there is a way to set my print area for each sheet with the size of an A4 paper (210mmx290mm)

Thanks.


回答1:


For each Sheet in the workbook, get its PrintSetup object and call setPaperSize on it, passing the appropriate PrintSetup constant: A4_PAPERSIZE.

mySheet.getPrintSetup().setPaperSize(PrintSetup.A4_PAPERSIZE);


来源:https://stackoverflow.com/questions/15785386/apache-poi-setprintarea-to-a4-page-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!