Veggerby : IBlog | Low decoupling, highly incoherent

Aug/07

15

Added HttpHandler with Gzip support to Veggerby.Excel

Just published is a new version of Veggerby.Excel that includes a HttpHandler that not only spews out the headers and Excel XML body, but also supports Gzip compression to allow potentially very large Excel XML files to be compressed to a bare minimum.

The ExcelHttpHandler comes in the form on an abstract class with just on abstract method that must be overridden.

public abstract class ExcelHttpHandler : IHttpHandler
{
    protected abstract void Render(HttpContext context);
}

To utilize the HttpHandler simply create a subclass of the ExcelHttpHandler class and overwrite the Render() method to include all the rendering of the Excel document (finalizing by calling the Render() method on the ExcelWorkbook for the context.Response.OutputStream). Fx.

public class MyExcelHttpHandler : ExcelHttpHandler
{

    protected override void Render(HttpContext context)
    {
        ExcelWorkbook workbook = new ExcelWorkbook();
        // … create the workbook structure …
        workbook.Save(context.Response.OutputStream);
    }

}

The HttpHandler will automatically perform Gzip compression if the request’er supports is.

For more information and download see Veggerby.Excel

·

1 comment

  • VenkatNo Gravatar · June 18, 2008 at 19:07

    Hello,

    Can I use this with a VB.net web project? If yes can you please let me know on how to make sue of the dll?

    Thanks,
    VC.

Leave a Reply

<<

>>

Theme Design by devolux.nh2.me