OverviewExcelWriter Version 4 features a solution to provide for a reliable download when using Internet Explorer v5.5 and above. Now, it's possible to perform downloads of ExcelWriter-generated workbooks without being subjected to the inconsistent, sometimes buggy behavior of the client's browser. ASP-based file downloads, such as that of ExcelWriter's saOpenInPlace and saOpenInExcel options, have long been plagued by inconsistencies with client browsers. These problems stem from the browser's unreliable interpretation of the Content-Type and Content-Disposition HTTP response headers. Problems include unreliable open/save options on the client-side, incorrect name displayed in the SaveAs dialog, and multiple unwanted pop-up dialog boxes. A reliable solution to these problems is to use a client-side object, instead of the browser itself, to perform the HTTP request to the server. We have provided a client-side HTTP client object called XLWAssistant that you can use to reliable retrieve ExcelWriter-generated workbooks from the server. Downloading with the XLWAssistant ObjectThe XLWAssistant object is a HTTP client that provides reliable file retrieval, saving, and opening capability. You can use the properties and methods of the object in client-side VBScript within Internet Explorer to handle your ExcelWriter downloads. The following sample illustrates exactly how this works: Run the Sample
The sample works as follows:
Reliable Download without XLWAssistantThe XLWAssistant object provides HTTP request and file saving capabilities. You can also realize this functionality by using a combination of Windows-specific objects. For example, you can use the MSXMLHTTP3 object for HTTP request, the ADODB.Stream object to write the HTTP response to the disk, and the WScript.Shell object to launch the file once downloaded. The only difference in this sample is what is contained in the VBScript wrapper class. The previous sample used XLWAssistant within the class, while this one uses a combination of other objects to perform the same function. The properties and methods of the VBScript class are the same for both solutions. You may want to use this solution if you do not want the client's to have to install the XLWAssistant DLL from a CAB. While this may be preferable in certain situations, there are serveral significant drawbacks to using this approach:
With these limitations in mind, it's important to mention that this sample is provided simple to illustrate how this functionality is available in many forms. Using the XLWAssistant object is recommended, but not necessary. Run the Sample
Copyright © 2003, SoftArtisans, Inc. |