Use Mango Excel Reports Instead of Building XLSX Files
Mango provides excel-reports options that can export point information through a report template. A working template can define which information appears in the workbook, avoiding the need to construct the XLSX file directly in browser JavaScript.
Enable Swagger to Find the Report Operation
- Open
env.propertiesand add the following setting:
swagger.enabled=true
- Start or restart Mango so the setting takes effect.
- Navigate to
http://[ip:port]/swagger. - Inspect the available
excel-reportsoperations and select the operation that fits the required template and point-data export.
Connect the Web Button to the Report
Use the operation exposed in Swagger as the contract for the button's JavaScript request. Swagger must supply the actual route, request method, required inputs, and response format; the available evidence does not identify those details, so do not hard-code a guessed endpoint.
When the user clicks the button, send the documented request and handle its successful response as a file download. Confirm from Swagger whether the operation returns the workbook directly or uses a separate retrieval step before implementing the browser-side download behavior.
Verify the Export
Run the report with the completed template and verify that the downloaded workbook opens as an XLSX file and contains the intended point information. If report generation works in Swagger but not from the page button, compare the JavaScript request with the successful Swagger request, including its method, inputs, and response handling.
FAQ
How do I enable Swagger in Mango?
Set swagger.enabled=true in env.properties, restart or start Mango, and open http://[ip:port]/swagger.
Can Mango export point data to XLSX?
Use the available excel-reports options and create a report template containing the point information required in the workbook.
How do I make a JavaScript button download a Mango report?
Find the relevant excel-reports operation in Swagger, reproduce its documented request on the button click, and process the successful response according to the response format shown there. Do not guess the route or whether report generation and download require one request or separate requests.