Page breaks in SAPUI5

为君一笑 提交于 2020-01-06 18:06:09

问题


What is the best practice for creating specific page breaks in SAPUI5 and is it actually possible?

Classical CSS atributes page-break-after and page-break-beforedoesn't seem to work in my case. For example, I have two sap.m.VBox elements and I attached them a CSS class which specifies page-break-after: always !important;when printing, but nothing happens. If I add * {overflow-x: visible !important; overflow-y: visible !important;} then it will break and continue to draw the content in next page if it doesn't fit in one page, but it doesn't work in IE.

I have tryed also adding an empty div element that would work as a page break indicator, but still CSS wouldn't do anything. I guess that's because everything in SAPUI5 is put into one content div.


回答1:


You can solve this by adding an empty element in between.

If you want a break that is 200 pixels high, your page content can look like this:

return new sap.m.Page({
content:[
oVBox1,
sap.m.Panel({height: "200px", width: "100%}),
oVBox2
]
});

ofcourse you might want to set your panel background-color to transparent ;)




回答2:


The "page-break-after" is ignored because the property display of SAPUI5 views is set to inline-block.

Simply override the CSS style for the corresponding class with a custom CSS and it should work: .sapUiView { display: block; }



来源:https://stackoverflow.com/questions/29097484/page-breaks-in-sapui5

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