Home Applications Light-weight-EXCEL-download

Light-weight-EXCEL-download

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
5
1 reviews
0
Awards
455
Views
28
IPM installs
6
2
Details
Releases  (10)
Reviews  (1)
Issues
Articles  (1)
Light weight Excel export over CSP

What's new in this version

fix IPM

Good old CSP is well equipped to produce HTML tables accepted from EXCEL as input.
With modern Browsers you don’t even need and tags.
So the required code around your SQL result set is really slim.
And you are free to add any formatting you need either by HTML or in SQL.

The final trick to move your table from browser to EXCEL:
In the method, OnPreHTTP inherited from %CSP.Page you
set %response.ContentType=“application/vnd.ms-excel”

Now when you call the class with your browser you get asked to open or to save it.
Next, because the extension is .cls you get asked for the program to open it.
like this:

And if you select EXCEL (or any compatible tool) the table is ready for the user to work with it.
as this:

Summary:

This could be a slim solution for rater static SQL queries.
Well suited to serve a wide distributed population of users.

  • No need for additional EXCEL installation on Caché server
  • No need for new Caché version + license upgrades to run ZENreports
  • No need for extra transport to move results to users
  • No need for local installed installed software (Squirrel)
  • No need for additional management of SQL access rights

Rather small size of code with simple structure

Now you will understand why I titled it “Light Weight”

Article in DC

Test and Demo

  • the screenshots were created when I still used MS EXCEL and MS InternetExplorer on WIN 10
  • the initial design expected a namespace SAMPLES (as in Class Docs)
  • for testing in Docker a dedicated demo class is now created

Docker

Container build and start runs ALL installation steps.
It is immedeatly ready for use as described

Prerequisites

Make sure you have git and Docker desktop installed.

Installation

Clone/git pull the repo into any local directory

$ git clone https://github.com/rcemper/Light-weight-EXCEL-download.git
$ docker compose up -d && docker compose logs -f

Test

from the terminal create the demo file by

USER>write ##class(DC.EXCELlight).toFile()

see the result by

USER>$cat DC.EXCEL.html

Testing in browser depends on the ability of your browser to
match with ContentType=“application/vnd.ms-excel” otherwise
you just get an offer to download the actual page:
This may sound obvious. Though ….
Feedback to the package shows the need for this clarification.

This is the link:
http://localhost:42773/csp/user/DC.EXCELlight.cls

Made with
Install
zpm install excel-light download archive
Version
1.1.115 Oct, 2024
ObjectScript quality test
Category
Technology Example
Works with
CachéEnsembleInterSystems IRIS
First published
20 Jul, 2020
Last checked by moderator
15 Oct, 2024Impossible to Test