在 Sap Fiori 中打印

Printing in Sap Fiori

我想知道打印选项是否在 sap fiori 应用程序中可用?如果是这样,它是仅在桌面上还是在移动设备上?如果可以,请发布代码示例,我将不胜感激。

感谢您的帮助。

您可以通过使用 javascript 构造 HTML 在 SAPUI5 应用程序中创建打印。它将同时出现在桌面和移动设备上。

    var temp = this.getView().getModel();
        console.log(temp);
        var nameofWork =
            "A variable object is an abstract concept." + 
            "In different context types, physically, it’s presented" +
            " using different object. For example, in the global context" + 
            " the variable object is the global object itself (that’s why we have an ability to refer global variables via property names of the global object).";
        var mainView = "<html><body><div><h2>Name of work:</h2><div><p>" + nameofWork + "</p></div></div>";

        mainView += "</body></html>";
        var ctrlString = "width=600px,height=600px";
        sap.ui.core.BusyIndicator.hide();
        var wind = window.open("", "PrintWindow", ctrlString);
        wind.document.write(mainView);
        wind.print();
        wind.close();