Page breaks in SAPUI5

2019-09-10 06:47发布

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.

2条回答
Luminary・发光体
2楼-- · 2019-09-10 06:57

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; }

查看更多
冷血范
3楼-- · 2019-09-10 07:16

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 ;)

查看更多
登录 后发表回答