Using Janus Web as a Data Distribution Tool -- Excel Spreadsheets.
Notes on distributing data via Janus Web
The great strength of web technology is that there is no client code
to distribute — all a user needs to run a web application is a
web broswer and a URL. But sometimes data needs to be presented in a
more formal client, like a spreadsheet. In these cases the web is still
an excellent data delivery mechanism, with browsers allowing data to
be routed to alternate client applications for display.
Quick and Dirty: Non-integrated solutions
The simplest way to put web data into a client application like a
spreadsheet is simply to retrieve it into your browser, use the browser's
"Save As..." feature, and then manually alter the data as you need to to
make it compatible with your client. There are a few, simple tricks needed
to make this work well: Basically, you have to make sure the data
won't be rendered as html, so you set the mime-type to "text/plain"
using $web_type, and make sure the url ends in a plain-text suffix,
like ".txt". Then you send your data to the browser, separating columns
with commas, and let the user "scrape" the data from the browser to
their spreadsheet program.
Simple, but not very elegant or integrated, and the scrape-and-paste method
doesn't provide any of the sophisticated capabilities built into modern
spreadhseet programs, like colors, user-specified fonts and complex formulas.
Another option for static data is to simply upload completed
spreadsheets to the Janus Web Server, and download them at a client's
request. You can use
form-based uploads
to upload a single spreadsheet at a time, or use "http put" (which is
still suported, but no longer integrated into all browsers) to upload
entire directories of spreadsheets.
Details on these and other upload methods are included in the
Janus Web Server Reference Manual.
Building Client Data in Janus Web Server
The best approach, of course, is to create dynamic spreadsheets from
your 204 data and send them in native format to the browser which,
recognizing the correct mime-type, will launch the appropriate
spreadsheet application.
Say you want data sent directly from the Janus Web Server into a
MicroSoft Excel spreadsheet. The native format for Excel is ".xls",
and Microsoft provides for internal structuring of .xls sheets in XML
format. For clients who have both Janus Web ServerJanus SOAP we provide an Excel class
(the first download at the top of this page) which allows client code to
easily create spreadsheets in native format. This class was written by
Patrick Bower for Marks & Spencer, and includes methods for creating the
spreadsheet, styling content and entering formulas.
The second example, downloadable from the top of this page, takes a different
approach. A single program provides a variety of different presentation methods,
including a plain-text download, graphical views of data via VML, and
the structuring of data into .xls spreasheets using Microsoft's XML formatting
standards. The programming in this routine is not Object Oriented
but calls the SOAP methods in open code.
As a final example,
We've written a simple program that allows a user to select fields from
a Model 204 database file and that sends the requested data in
.csv format. When you
Retrieve Data Into Excel
you'll be prompted for which application to use for the returned data.
This is because we've used the Janus Web functions to set a MIME type
of "application/ms-excel" for the returned data, and your browser
may or may not have mapped that MIME type to any application.
You can see the code
that runs this application. Notice that this one program produces
both the file selection form and the field selection form, and creates
the final .csv file.
This final sample is useful for sites that do not have the Janus SOAP
product, and for whom basic comma-separated spreadsheets are adequate.