Create Native Word and Excel Docs
Read
Review on MSDN Magazine (June 2006)
Most data-driven Web sites are used as interfaces to collect, process, and summarize information. Reports that summarize the data can be presented to the user in a variety of formats—the most common way is to display the report directly in a Web page. However, in some scenarios Microsoft® Excel® and Word documents are a more ideal format. If the report is stored as an Excel document, for example, a user can easily e-mail it to a colleague, make her own modifications to the data, sort and filter the data without having to re-request the report from the Web site, and so on.
Generating Word and Excel documents on a Web server can be accomplished in a variety of ways. One option is to use the Office Web Components (OWC), which are a collection of COM components for generating Excel spreadsheets and charts. While OWC allows for creating more feature-rich Excel documents, it requires that Microsoft Office be installed on the Web server and introduces performance and scalability concerns.
In short, efficiently generating feature-rich Office documents in a server-side environment requires that you create the raw, binary version of the Office document on the server using simple file creation techniques. This approach offers the best of both worlds: native documents can be created with the full set of Office features, yet there's no requirement to have Office installed on the server.
OfficeWriter version 3.5, by SoftArtisans, allows for both Excel and Word documents to be created in this manner. With OfficeWriter, you start by creating an Excel or Word template on your desktop computer. The templates contain placeholders that indicate where the dynamic data will be placed. In addition, these templates can contain the full set of Office features and capabilities. Spreadsheet templates, for example, can include charts, pivot tables, formulas, macros, multiple sheets, and so on. When the template is complete, just upload it to the Web server and create an ASP.NET page that binds data to the template. This will create a new Excel or Word document, mashing together the data and template.
OfficeWriter allows for a variety of data sources to be bound to the underlying template, including results from a database query, and the resulting Office document can be saved to the Web server's file system or streamed to the client. OfficeWriter also provides integration with SQL Server™ Reporting Services, allowing for reports to be designed directly from within Word and for generated reports to be exported as Word documents or enhanced Excel spreadsheets. |