By selecting the worksheet with the print area you activate the print function for your app. This enables you to save the content of your calculation as a PDF file and send it by e-mail.
Activate print function
First, make sure your source Excel file contains a worksheet that contains the relevant info for your print data. For more information about how to define print areas, please visit the article "Set or clear a print area on a worksheet".
If you want the printout to be in landscape orientation, change the page orientation in your source file. (See: "Print a Worksheet in Landscape or Portrait")
To enable the the print functionality in your app, please proceed as follows:
- Open your app in the web portal.
- Navigate to "Edit".
- Select "Print functionality
- Select the print sheet.
- Save the changes and update your app.
Attached please find a sample file in which the worksheet "angebot" is used as print sheet for the app.
Please be advised that charts will not be visible in the PDF, especially if your source file is an .xlsx file. Sometimes charts are printed if you save your file as .xls and use this version as source file for your app. In this article, you can find out how to switch/update the source file of your app: https://support.openasapp.net/hc/en-us/articles/207939275
You can find a step by step guide on how to build an app with print functionality here: "Create a license calculator with print functionality".
Printing different worksheets in the app
It is possible to print different sheets from Excel, depending on the page of your application on which the user triggers the print function.
The implementation takes place via the XML configuration. The XML configuration of your app can be found under "Advanced" > "XML Configuration". To make changes to the XML, switch to edit mode by clicking on the pencil icon.
The definition that controls the Print function is:
If you want to print Table1 from page A of your application, add the definition
printsheet=Table1; to the page definitions of page A.
If you want to print Table5 on page B of your application, add the definition
printsheet=Table5; to the page definitions of page B.
The screenshot will help you to find the location where you need to add the definition.
In this example, the worksheet "salespeople" is printed on the first page (pageid="1"). (printsheet=salespeople;). On the second page (pageid="2") the worksheet "machines" is defined as a print sheet (printsheet=machines;).
Printing worksheets "Action Button"-specifically
It is possible to print different sheets from Excel, depending on which action button the user clicks and thus triggers the print function. You can learn more about Action Buttons here: Action Buttons
First, add a "Print" action button as described here: "Action Button, to create a PDF".
The conversion is (still) done via the XML configuration. The XML configuration of your app can be found under "Advanced" " "XML Configuration". To make changes to the XML, switch to edit mode by clicking on the pencil icon. For more information, see the article "Working in the XML view".
The definition that controls the print function is:
If you want to print Table1 using the Action button in your application, add the definition
sheet="Table1"; to the Action definitions of the Action Button.
If you want to print Table5 using another Action Button in your application, add the definition
sheet="Table5"; to the Action definitions of the Action Button.
The screenshot will help you to find the place where you need to add the definition.
In this example, the upper action button (
caption="Print Page 1") prints the worksheet "Offer" (
sheet="offer";). On the second page (
caption="Print Page 2") the worksheet "Calculation" is defined as a print sheet (