16 February 2014

Invalid Dates and Formatting your ExpPrint HTML Listings with Cascading Style Sheets (CSS)

A curious mix of topics you might think – but one lead to the other a few days ago, so in explaining a minor enhancement as a result of a customer reporting an issue, I thought I’d explain how I resolved the situation in more detail…

11 February 2014

Overview of How ExpPrint Works

ExpPrint has several steps to get a listing:

image

1. The shell extension (the right click “ExpPrint Listing…” menu in Windows Explorer)

This component gathers all the properties of the files and converts them into an XML format in the .xplisting file.

2. The ExpPrint Viewer

This loads the .xplisting and allows you to select a transformation – currently either Detailed Table (HTML),  Detailed Table (CSV), or Multi-Column (HTML).

3. The viewer then displays the user interface for the chosen transformation and finally invokes the transform.

The result is either a Detailed Table HTML file, Detailed Table CSV file, or Multi-column HTML file which is then invoked, causing the application registered for the file type to open the file. So, for the HTML outputs, the file will load in your default browser, while the CSV option will probably load in your spreadsheet application.

Why is it so involved?

In a word – flexibility.

Early versions of ExpPrint involved just 1 stage – you invoked the shell extension and it got the file system information and either output the listing to your printer, or to a text file.

But people want more…

  • Print preview
  • More properties/metadata
  • More formatting options

It quickly became difficult to squeeze new feature in, so a radical departure was necessary in order to have the bigger facilities like Print Preview.

The solution is as presented above. In essence ExpPrint stands on the shoulders of giants. By outputting HTML, users can use the full features of their browsers to provide printing and preview facilities, and by structuring the HTML to allow it to be comprehensively formatted using standard CSS, listings can have much richer presentation facilities than I could ever have hoped to develop from scratch. However, the link is the intermediate form – the XML data. By having the shell extension gather all the file properties that Windows provides (thankfully without having to write any code that knows about the file formats) and saving them as XML, the transformation of the XML to HTML or CSV is accomplished using XSL Transforms. XSLT enables the same XML data in the .xplisting file to be converted to any text format by way of an XSLT transform program. The 3 options available in the ExpPrint Viewer: Detailed Table (HTML), Detailed Table (CSV), and Multi-Column (HTML) are in effect 3 XSLT programs. You can extend ExpPrint with your own transform programs, but it’s far from a trivial undertaking, so if you think you might want a custom transform, send us an email and ask away.