Justin Cooney

Web Development Tips and Examples

  • I recently had the requirement to take the HTML from a batch of reports on a Web application and output these with very specific formatting requirements to Excel. I am familiar with the basic syntax of setting the content type to ‘application/ms-excel’ before streaming  the HTML content. However things get rapidly more complex if the requirements include actually setting presets in Excel.

    I’m surprised at how little documentation there is for how to do this online although everyone has a need to do it. The lack of information from the Microsoft official articles is also quite amazing. Basically the developer is left to their own devices when writing code to create spreadsheets dynamically through HTML, XML, and CSS.

    The most helpful information I was able to find was at the following sites: (more…)

  • WinPatrol takes snapshot of your critical system resources and alerts you in real-time to any changes that may occur without your knowledge.
    WinPatrol – Essential Home PC Anti-Malware Software

    I was thinking about what security software I would consider essential when setting up a new home computer. There are a few options that come to mind, but in my opinion WinPatrol is absolutely necessary to have. When I talk with people about it I’m surprised at how few people know about it or use it. I have been using the software for the past seven years and would not feel safe using my PC without it.

    WinPatrol comes in free and paid-for versions, but the free version does a great job of protecting your PC. Although WinPatrol has many really cool features, it’s primary purpose is to run in the background as you use your computer. WinPatrol keeps snapshots of important system files and will warn you if malware is trying to modify these files or set itself up as a start up program. Specifically, WinPatrol monitors modifications to the host file, prevents keylogger driver installation, rogue Active X and browser helper objects, and malicious startup programs.

    Bottom line is: WinPatrol will allow you to stop many malware attacks dead in their tracks before they can even get properly started. (more…)

  • I’ve been working on adding the ability to export to Excel format to reports that I have written in ASP.NET. While doing this I have received numerous feature requests including the ability to set by default the paper size to be printed to.

    As a little bit of background on the topic: I use a traditional method of streaming the HTML version of the report to the browser with the content type set to MS Excel. This allows me to send Excel-specific markup to format parts of the Excel document.

    One can set the default page settings for an Excel document using the Microsoft Excel XML Spreadsheet model (SpreadsheetML). Specifically, the XML hierarchy is:

    <x:ExcelWorkbook>
     <x:ExcelWorksheets>
      <x:ExcelWorksheet>
       <x:WorksheetOptions>
        <x:Print>
         <x:PaperSizeIndex>

    Although documentation exists on the Microsoft Excel XML Spreadsheet model, I have not actually seen any detailed description on the options available when setting the page sizes. Since these are simply numeric values their meaning is not immediately apparent to me so I have been testing what each value means by trial and error. (more…)