Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议增加一个可以设置打印时纸张尺寸的方法 #17

Open
sysutt opened this issue Jul 14, 2020 · 3 comments
Open

建议增加一个可以设置打印时纸张尺寸的方法 #17

sysutt opened this issue Jul 14, 2020 · 3 comments

Comments

@sysutt
Copy link

sysutt commented Jul 14, 2020

现在导出的Excel表在打印时的纸张尺寸默认是按照北美纸张Letter尺寸打印的,在宽高比上跟A4纸会有区别,看了一下源码,对比Excel的原始数据结构,发现对write_ws_xml_pagesetup做一点修改即可解决:
function write_ws_xml_pagesetup(setup) {
var pageSetup = writextag("pageSetup", null, {
paperSize: setup.pagesize || "9",
scale: setup.scale || "100",
orientation: setup.orientation || "portrait",
horizontalDpi: setup.horizontalDpi || "4294967293",
verticalDpi: setup.verticalDpi || "4294967293"
});
return pageSetup
}
在pageSetup中增加paperSize: setup.pagesize || "9",这里面的9表示A4纸的尺寸,这样就解决问题了。

@wangerzi
Copy link
Owner

赞赞赞~~~非常感谢,我找空写进去

@wangerzi
Copy link
Owner

wangerzi commented Aug 5, 2020

@sysutt 话说,,我咋没在我这里的 xlsx.js 找到这个函数呢。。

@sysutt
Copy link
Author

sysutt commented Sep 8, 2020

@wangerzi 我看了一下自己改的文件,原来write_ws_xml_pagesetup这个函数也是我自己加的。。。然后在代码里面找到/* pageSetup */,在后面加上if (ws['!pageSetup'] != null) o[o.length] = write_ws_xml_pagesetup(ws['!pageSetup']); 就OK了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants