White Paper - SoftArtisans
Transcription
White Paper - SoftArtisans
White Paper ACKNOWLEDGEMENTS SoftArtisans would like to thank Jon Flanders for his original vision and prototype of ExcelWriter. Copyright © 2002 by SoftArtisans Inc. All rights reserved. No part of this paper may be reproduced or transmitted in any form or by any means without the written permission of SoftArtisans Inc. This white paper is a working document and is provided "AS IS," without any warranties. SoftArtisans expressly disclaims any warranties or representations as to accuracy or completeness of the contents and any implied warranties of merchantability or fitness for a particular purpose. The contents are not suitable for use in all situations, and any use by you of the contents is at your own risk; the information in this document may be corrected or updated from time to time. SoftArtisans will not be liable for damages of any kind, including direct, consequential (including loss of profits, business, or data) or special damages, which may arise out of or result from reliance on or use of the information. 1/28/2002 2:39 PM Revision History Date Initials Description 10/07/01 LM VSLive! 11/9/01 LM ExcelWriter V3 Release 12/18/01 LM/RI V3.02 Update 01/14/02 JG/LM/RI Update SoftArtisans 1330 Beacon Street Suite 400 Brookline, MA 02446 Tel: 617-738-0777 / 877-SOFTART Fax: 617-738-6278 i E-mail: [email protected] INTRODUCTION........................................................................ 1 1.1 WHAT IS EXCELWRITER .........................................................................1 1.2 WHAT EXCELWRITER IS NOT...................................................................2 1.3 HOW EXCELWRITER WORKS ...................................................................2 2 GENERAL INFORMATION.................................................. 4 2.1 OPERATION .........................................................................................4 • • • • • 2.1.1 How Does it Work? 4 2.1.2 Server Operation 4 2.1.3 Excel Not Required on Server 2.1.4 ExcelWriter CodeWizard 5 2.1.5 Single Multi-threaded DLL 5 2.2.1 Supported Platforms 5 2.3.1 Automated Installation via MSI 2.3.2 Manual Installation via REGSVR32 6 2.3.3 Documentation and Samples 7 2.3.4 Minimal Installation 7 2.4.1 Server Licenses 7 2.4.2 Developer Licenses 8 2.4.3 ExcelWriter Desktop Licenses 2.4.4 Bundling ExcelWriter in Your Solution – OEM Program 2.5.1 Differences Between the Full and LE Versions 2.5.2 Which Version is Right for You? 2.6.1 Microsoft Excel on Win32 2.6.2 Microsoft Excel on Apple Macintosh 16 5 2.2 DEPLOYMENT .......................................................................................5 • 2.3 INSTALLATION .....................................................................................6 • • • • 6 2.4 LICENSING ..........................................................................................7 • • • • 8 9 2.5 EDITION DIFFERENCES...........................................................................9 • • 11 15 2.6 CLIENT REQUIREMENTS ........................................................................ 16 • • 3 16 EXCEL AS A REPORTING FORMAT................................... 17 3.1 ADVANTAGES ..................................................................................... 17 • • • • 4 3.1.1 Familiarity of Client 17 3.1.2 Richness 3.1.3 Ease of Modification 3.1.4 Upload Back to Server 17 17 17 USAGE SCENARIOS ........................................................ 19 4.1 INTRANET REPORTING .........................................................................19 4.2 B2B COMMERCE .................................................................................20 ii 4.3 STOCK PORTFOLIO ..............................................................................21 4.4 HUMAN RESOURCES.............................................................................21 • 5 4.4.1 Web-based Payroll 21 FEATURES IN DEPTH ...................................................... 22 5.1 5.2 5.3 5.4 • • 5.5 5.6 5.7 5.8 5.9 • • EXCEL VERSION COMPATIBILITY ............................................................22 ADDRESSING CELLS .............................................................................22 SETTING CELL VALUES .........................................................................22 IMPORTING FROM A DATABASE ..............................................................23 5.4.1 ADO 23 5.4.2 ODBC 23 5.9.1 MSXML 5.9.2 Excel XML DOM FORMATTING .....................................................................................23 FORMULAS.........................................................................................24 CHARTING .........................................................................................24 IMAGES ............................................................................................25 XML IMPORT .....................................................................................26 26 27 5.10 SAVING RESULTS ................................................................................29 • • • 5.10.1 To Disk 30 5.10.2 To Memory 30 5.10.3 Streamed to Browser 30 5.11 READ AN EXISTING SPREADSHEET* ........................................................31 • 5.11.1 Importing Formulas • 5.14.1 ExcelApp.Open vs. ExcelTemplate Decision Tree 32 5.12 MODIFYING AN EXISTING SPREADSHEET ..................................................33 5.13 USING TEMPLATE SPREADSHEETS ...........................................................33 5.14 EXCELAPP.OPEN VS. EXCELTEMPLATE .....................................................36 37 5.15 DATA ...............................................................................................38 • • 6 5.15.1 Formulas 38 5.15.2 Macros, Outlines, Pivot Tables and VBA 39 COMPARISON TO MICROSOFT EXCEL ............................. 40 6.1 EXCEL ON THE WEB SERVER ..................................................................40 • • 6.1.1 Licensing 40 6.2 OFFICE WEB COMPONENTS ...................................................................40 7 6.1.2 Performance 40 COMPARISON TO OTHER ALTERNATIVES ....................... 43 7.1 CSV FILES ........................................................................................43 7.2 HTML ..............................................................................................43 7.3 CRYSTAL DECISIONS ...........................................................................43 8 ADMINISTRATION ......................................................... 44 8.1 SECURITY CONSIDERATIONS .................................................................44 8.2 CONFIGURING IIS ..............................................................................45 8.3 INSTALLATION / UNINSTALLATION.........................................................46 iii 9 CASE STUDIES ............................................................... 47 9.1 MANUFACTURING COMPANY ..................................................................47 9.2 B2B E-COMMERCE COMPANY.................................................................50 9.3 DESTINATION HARDWARE SALES AND MANUFACTURING COMPANY ................53 10 PERFORMANCE............................................................... 56 10.1 BENCHMARKS .....................................................................................56 EXCEL RITER BJECT VERSUS XCEL BJECT FFICE W O (V2) E O O 2000.......................56 10.2SCALABILITY .....................................................................................57 10.3PERFORMANCE LIMITATIONS .................................................................57 • • • 10.3.1 ExcelWriter LE 57 10.3.2 ExcelWriter Developer 57 10.4IMPROVING PERFORMANCE ...................................................................58 • • 11 12 10.3.3 ASP Threading 10.4.1 Using Styles 57 58 10.4.2 Use CopyFromRecordSet or GetDataFromRecordset 61 TECHNICAL SUPPORT..................................................... 62 11.1PRE-SALES SUPPORT ...........................................................................62 11.2MAINTENANCE PROGRAM......................................................................63 11.3TWO-HOUR PRIORITY SUPPORT INCIDENT ...............................................63 11.424-HOUR PRIORITY SUPPORT INCIDENT..................................................63 11.5SUPPORT HOURS ................................................................................63 11.6SELF-HELP SUPPORT............................................................................64 11.7PEER-SUPPORTED DISCUSSION LIST .......................................................64 11.8SOFTARTISANS CONSULTING SERVICES ...................................................64 FOR MORE INFORMATION.............................................. 65 12.1SOFTARTISANS WEB SITES ...................................................................65 • • • • • 12.1.1 Main ExcelWriter Page 65 12.1.2 News and Announcements 65 12.1.3 Support Site 65 12.1.4 Demo Site 65 12.2EXCEL ON THE WEB .............................................................................66 • • 12.1.5 Discussion Lists 65 12.2.1 Microsoft Excel Web Site 66 12.3ASP SITES........................................................................................66 13 12.2.2 EXCEL-L Discussion List 66 OTHER PRODUCTS FROM SOFTARTISANS ...................... 67 iv Introduction Online reporting is among the best uses of Web technology and a challenging objective on many Web sites. The most efficient method of delivering timely data to partners, internal employees, and customers is a self-service Web reporting application. Already, many companies business calculate administration ® formatted in Microsoft and over track the sales, Web. evaluate investments, Traditionally, most and automate quantitative data is Excel and the business world is proficient in the software. But most of today’s Web reporting solutions do not produce native Excel—particularly not richly formatted Excel with charts, pivot tables, and VBA. Difficult new software requires training and may limit users’ capacity and interest to manipulate data that they receive over the Web. SoftArtisans provides a powerful spreadsheet engine that generates Excel on the Web. Organizations do not need to stop using Excel because they move processes to the Web. With SoftArtisans ExcelWriter, developers quickly and easily build robust, scalable reporting applications that generate native Excel without installing Excel on the server. A simple yet comprehensive solution, ExcelWriter creates full-function Excel from a database, ADO recordset, or an existing workbook. ExcelWriter enables a wide range of businesses to create high-performance applications while making efficient use of limited systems, development resources, and users’ Excel proficiency. ExcelWriter generates editable Microsoft Excel worksheets and charts in a few easy steps. This powerful product creates native .xls code, which is real, full-function Excel— not Comma Separated Value (CSV) flat files or Excel look-alikes. ExcelWriter populates the spreadsheet from the recordset object, and then adds formatting and formulas to cells—or serves you the can open users a clear, pre-existing workbook professionally or formatted template Excel workbook. spreadsheets ExcelWriter and charts. ExcelWriter is capable of high performance for demanding sites that need to generate thousands of spreadsheets for many concurrent users each day. Users may save fullfunction, formatted accessed spreadsheets Excel spreadsheets generated server for easy access. by to immediately SoftArtisans manipulate ExcelWriter can be data. saved Heavily on the Custom spreadsheets can be streamed directly to the client machine. 1.1 What is ExcelWriter ExcelWriter is a server-side control for developing high-speed Excel Web applications. It consists of a single, multi-threaded dynamic link library (DLL) that accepts data from many sources. The data can be gathered from an ActiveX Data Object (ADO) connection to a database, parsed from an XML document, scripted to gather from a CSV or other flat file, or retrieved from a pre-existing Excel workbook. It generates Excel in the native Microsoft binary format (BIFF8 or BIFF7, depending on the what version of Excel or Excel viewer is installed on the client.). The output can be streamed via the Internet or intranet to a client machine for display in a browser or with Excel. These files can also be saved on the server or the client machine hard disk. ExcelWriter-generated Excel files can contain comprehensive formatting, formulas, custom styles, charting, and images. They can consist of single or multiple worksheets. An Excel file generated by ExcelWriter is virtually identical to having created it directly in Excel. 1 ExcelWriter does not require the Microsoft Excel object on your server. This control has no dependencies on Excel. In fact, it generates Excel format output with benchmarked performance that is at least over 100 times faster than that of the Microsoft Excel object. ExcelWriter can be used from any environment that supports COM, such as Active Server Pages (ASP) or Visual Basic (VB), VB.NET or ASP.NET. 1.2 What ExcelWriter is Not ExcelWriter is not a visual end-user tool like Microsoft Excel. It is not an ActiveX control that exists client side. Rather, it generates native Excel files via server-side scripting that can be read by Microsoft Excel. ExcelWriter does not use XML or HTML to represent the spreadsheet. The resultant spreadsheet is in the native Microsoft binary format. This permits the creation of much richer spreadsheets, including charts and images, and allows for support of many versions of Excel from Excel ’95 through Excel XP. ExcelWriter does not have a calculation engine to perform computation on the cells in the spreadsheet. When formulas are included in a spreadsheet, Excel calculates the values when it loads the spreadsheet. (Please note: since ExcelWriter does not calculate values, evaluation of formulas is not possible during spreadsheet creation). ExcelWriter is not a charting engine. It cannot produce static charts in GIF or JPG/JPEG image format. Rather, it produces fully dynamic 2D or 3D Excel charts capable of referencing data from the same or another worksheet in the workbook. 1.3 How ExcelWriter Works ExcelWriter instructs entirely consists ExcelWriter in memory of a to on series create the of a COM new server. objects. A spreadsheet. Working developer This writes spreadsheet exclusively in a script will memory be that built enhances performance and maximizes security. Here is an example of how a Web developer might use ExcelWriter within an ASP page. In this case, we’ll assume that a client, accessing the application, has just filled out some information on a Web form and pressed the “Submit” button. The ASP forms processing page: • • Validates the user’s input Based on the user’s input, customizes a query and runs it against a data source, to produce a recordset • • • • • • • • Instantiates the ExcelWriter object Creates a blank worksheet(s) Imports the recordset into the spreadsheet where applicable Adds formulas Creates custom styles Applies these styles and other formatting elements to the worksheet(s) Adds charts or inserts images Streams the newly created Excel file to the user’s machine for opening in the browser or with Excel or for saving locally to the client’s hard disk 2 In this example, every user receives a fresh, new unique spreadsheet in response to their input. In addition to streaming the spreadsheet to the user, ExcelWriter could also save the file to the hard disk of the server. Figure 1: ExcelWriter is a server-side component that generates a native Excel workbook on the Web from an existing .xls file, an ASP page, and/or any data source. Simply click a button and display existing data as a Web form. A second click and you get a full- featured Excel spreadsheet. Save it as an Excel file on the server or stream to a client. The document is fully editable and virtually all of the standard formulas are available. It's just that easy! This provides just one possible scenario for usage of ExcelWriter. We will cover others later in this document. 3 2 General Information 2.1 Operation 2.1.1 How Does it Work? ExcelWriter object In order to create an Excel workbook in the native Microsoft binary format (BIFF) with ExcelWriter, you must create an instance of the in a script that is executed server-side. With ASP, this is done as follows: Set xlw = Server.CreateObject("SoftArtisans.ExcelWriter") As with Microsoft Excel, a Worksheet is then created: Set ws = xlw.Worksheets(1) WorkSheets(1) Each spreadsheet contains multiple worksheets. Only one worksheet is needed in this WorkSheets(2) Cells example. The Next, first worksheet is and so on. . The second worksheet would be server or are added to the WorkSheet: ws.Cells("A1").Value = "Name" ws.Cells("B1").Value = "Count" ws.Cells("C1").Value = "Dollar" ws.Cells("A2").Value = "Fred Smith" ws.Cells("B2").Value = 10 ws.Cells("C2").Value = 37.5 This creates the cells on the worksheet and fills in the values. Once the values are filled in, the virtual workbook can be saved to the streamed to a client machine. xlw.Save "first.xls", saOpenInExcel In this case, the spreadsheet is streamed to the client and triggers a “FileDownload” dialog box that will give the client the choice of opening the file with Excel or saving the spreadsheet locally. If it is saved, the default name will be first.xls. 2.1.2 Server Operation The ExcelWriter application object requiring the should ability be installed on to generate Excel a Web server Web reports. that hosts Once the installed, Web the object model’s methods and properties are accessed via an ASP script that runs serverside. A fully formatted, dynamic Excel workbook is created, populated with data from a data source and then formatted in memory on the server. Depending on the “Save” option called, the output can be stored as a file on the server or streamed via the Internet or intranet to a client machine for viewing or saving locally. 4 2.1.3 Excel Not Required on Server ExcelWriter works without dependency on the Microsoft Excel object so the Excel object is not required on the server. This avoids the performance penalties and instability otherwise associated with instantiating multiple copies of the Excel object on a Web server. In addition to performance improvements, ExcelWriter offers greater licensing flexibility and ease of deployment than does Excel. This is ideal for a Web reporting application. There are no per-user or per-seat license costs. 2.1.4 ExcelWriter CodeWizard ExcelWriter Developer editions contain a very useful added component: CodeWizard. This new component has the ability to take an Excel ExcelWriter workbook (or template) as input and to generate an ASP, VB, or ASP.NET file that contains the code necessary to functionality) reproduce using it (with ExcelWriter most, on the if not server. all of Using formatting and ExcelWriter CodeWizard its included can greatly reduce the time and the resources required to script complex Web reports. 2.1.5 Single Multi-threaded DLL ExcelWriter is a high-performance, multi-threaded set of COM objects built for serving thousands of concurrent users on a single server. Unlike the Excel object, separate instances of ExcelWriter can be created safely on the server to handle individual concurrent requests. 2.2 Deployment ExcelWriter is designed for easy deployment on your Web server. It is flexible enough to work with most Windows-based server configurations and security settings. 2.2.1 Supported Platforms ExcelWriter has the following System Requirements: • • • Windows 2000 or Windows NT 4.0 Any environment that supports COM or Automation, including: - Active Server Pages (IIS3 or IIS4) Visual Basic Windows Scripting Host Visual C++ Internet Explorer ASP DLL Version 4.0.622 or later (WinNT Server or Workstation) or ASP DLL Version 5.0 or later (Windows 2000 or Advanced Server) • If you intend to create workbooks from databases, install the latest Microsoft drivers. The driver package is available for free for all versions of IIS at http://www.microsoft.com/data/. Choose to download MDAC 2.0 or later. MDAC includes updates to ADO, OLEDB, and related ODBC drivers 5 2.3 Installation ExcelWriter can be installed in two ways: by running the automated installation that uses the Microsoft Installer (MSI), or by doing a manual installation. The automated installation is easiest to use and deploy. Simply double-click on the “ExcelWriterVxx.exe” and follow the InstallShield Wizard instructions. The manual installation option is available for situations where the use of an auto installer is disallowed or where minimal installation may be desired. 2.3.1 Automated Installation via MSI Running the Auto Installation program will: • Unpack ExcelWriter files to C:\Program Files\SoftArtisans\ExcelWriter (or to an alternative location that you specify during the installation) • • Register the ExcelWriter DLL (saexcel.dll) Create a virtual directory which gives access to the documentation and included samples 2.3.2 Manual Installation via REGSVR32 To manually install ExcelWriter, you must first run the automatic installation (described above) to unpack the files. Once the files are unpacked, if you move ExcelWriter to a new server, you can run either the automatic or manual installation. To register the ExcelWriter component, do the following: • Copy the ExcelWriter DLL (saexcel.dll) to any stable directory on your Web server. For example, to copy the saexcel.dll to c:\winnt\system32\inetsrv, at the command prompt, type, “copy saexcel.dll c:\winnt\system32\inetsrv” • Manually register the saexcel.dll, as follows. - To stop the Web server, open a DOS window, and enter, "net stop iisadmin /y" - To register the saexcel.dll, enter, - To restart the Web server, enter, “regsvr32 path\ saexcel.dll” "net start w3svc" - Optional: If you want to restart FTP and SMTP services, use the following commands: "net start msftpsvc" "net start smtpsvc" 6 2.3.3 Documentation and Samples ExcelWriter documentation is online at http://demo.softartisans.com/Excelwriter/default.asp or can be installed (optional). To install the ExcelWriter documentation and included samples, do the following: • Create a virtual directory called ExcelWriter, and map it to the Doc-Samples directory, as follows: 1. Open the Internet Services Manager. 2. Right-click Default Web Site. 3. Select New -> Virtual Directory. The Virtual Directory Creation Wizard will open. 4. Click Next. 5. Enter ExcelWriter as the alias for your virtual directory, and click Next. Note: You may use a different alias, but you will need to change the contents of the global.asa file. To do this, Open doc-samples\global.asa, and change Application("vroot") = "/ExcelWriter/" to, Application("vroot") = "/YourAlias/" 6. Browse to ExcelWriter's Doc-Samples directory and click next. Unless you selected a different directory during installation, you will find DocSamples in C:\Program Files\Software Artisans\ExcelWriter. 7. Check Read, Run, and Browse, and click Next. 8. Click Finish. 2.3.4 Minimal Installation The minimal installation of ExcelWriter consists of simply registering the single ExcelWriter DLL (saexcel.dll) as described above. No other libraries or DLLs need be registered or present on the system, besides the standard Windows installation. 2.4 Licensing ExcelWriter has a simple license. Every machine where the ExcelWriter DLL (saexcel.dll) is present and registered must have a valid license from SoftArtisans. This applies to both production and servers development workstations. Whether the software was installed by auto or manual installation, or by some other means, a valid license is required for the machine. 2.4.1 Server Licenses ExcelWriter server edition is licensed on a per-central processing unit (CPU) basis. This means that pricing is determined by the number of CPUs that exist on the Web server that will use ExcelWriter to generate Web reporting in Excel. The ExcelWriterLE version is licensed strictly on a per-server basis irrespective of the number of CPUs on that server. There are no per-user licenses for any version of ExcelWriter. This enables ExcelWriter to be used on an Internet server without any regard to what the user has installed on their PC. The user does not need a license 7 of Excel to use ExcelWriter-generated reports. In the case of a multi-homed, shared server that may be serving many different sites concurrently, a server license of ExcelWriter is required for each CPU. In the case of a cluster, either by Microsoft Clustering Services or Network Load Balancing, a license of ExcelWriter is required for every CPU in the cluster. This is the case even when using an Active-Passive cluster. 2.4.2 Developer Licenses A low-cost Developer Edition license is available for developers creating solutions using ExcelWriter. A Developer Edition license is necessary for every machine where ExcelWriter is installed for development purposes. If several developers share a single Web server for development, only a single license of ExcelWriter is necessary. If each developer uses his own Web server for development, an ExcelWriter-developer license is required for each development Web server. If a developer has multiple Web servers or test servers, each Web server or test server requires a Developer Edition license. The Developer Edition has precisely the same functionality as the server version, but it is limited to creating only a single spreadsheet at a time. ExcelWriter’s multi-threaded capability has been disabled in the Developer Edition. The Developer Edition must not be used in a production server environment. It is only to be used to create solutions. Usage of the Developer Edition in a production server environment is a violation of the license agreement. The ExcelWriter license in no way allows you to bundle or redistribute ExcelWriter as part of a solution. The Developer Edition license simply allows your developers to create solutions around ExcelWriter at lower cost than the full server license. It does not allow you to bundle or redistribute ExcelWriter in your solution, either within your organization or to other parties. (Please see the Desktop or OEM licenses if you need to bundle ExcelWriter in your application.) 2.4.3 ExcelWriter Desktop Licenses SoftArtisans ExcelWriter Desktop Edition is a high performance control for generating Microsoft ® Excel format spreadsheets from your client-side applications. It provides all the richness of ExcelWriter Server Edition, with the ability to bundle this functionality into the desktop applications that you create and distribute. Licensing is per-developer with no run-time royalties. Applications developed using ExcelWriter Desktop Edition can be used on any Windows client, including Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000 and Windows XP. No additional software is required to create an Excel spreadsheet with your ExcelWriter Desktop Edition application on the client machine. If the application created with ExcelWriter Desktop Edition will access data from a database, the database must be on or accessible from the client machine. When using an ADO data source, all client machines running the ExcelWriter Desktop application must have the latest Microsoft ADO libraries. ExcelWriter Desktop cannot be installed on a server. 8 2.4.4 Bundling ExcelWriter in Your Solution – OEM Program The ExcelWriter license specifically prohibits resale or redistribution in any manner. If you are interested in bundling ExcelWriter in your Web solution, please contact the SoftArtisans OEM Sales Department at [email protected]. There are several flexible OEM programs that can be tailored to meet your requirements. 2.5 Edition Differences The pricing and licensing schemes for ExcelWriter differ depending on the features. The price of each ExcelWriter (Full) license is determined by the number of CPUs in the deployment server configuration. The ExcelWriterLE license is priced strictly on a per- server basis regardless of the number of CPUs. A developer license is required for every development PC where the product is installed. license. any Each server requires a server There are no per-user, per-IP address, or per-Web site costs associated with version. SoftArtisans also offers a non-expiring free version of ExcelWriter, ExcelWriterFree. This freeware version has limited functionality and contains a nonremovable splash page advertisement for SoftArtisans. There are four major editions of ExcelWriter: • ExcelWriter Server • ExcelWriter Developer Edition for enterprise class Web sites requiring maximum functionality and volume. offers the same functionality as ExcelWriter Server, but is limited to only a single spreadsheet created at one time. This is the typical development environment. Other restrictions may apply. • ExcelWriterLE Server o ExcelWriterLE Developer Edition for entry level Web sites requiring ease of use and minimal formatting and functions. offers the same functionality as ExcelWriterLE server but is limited to only a single spreadsheet created at one time. This is the typical development environment. Other restrictions may apply. • ExcelWriter Desktop for generating Excel format spreadsheets from your client- side applications. • ExcelWriterFree provides the same functionality as ExcelWriterLE spreadsheet contains a worksheet that advertises the paid versions. 9 but every EDITION DIFFERENCES ExcelWriter Server Edition Licensing Per CPU OS Required Server Only Developer Edition Per development server Professional/ WorkStation or Server ExcelWriterLE Server Edition Developer Edition ExcelWriter Desktop ExcelWriter Free Per server Per development Per developer server Free, no redistribution Server Only Professional/ WorkStation or Server Professional/ WorkStation Server Only Yes Easy Database Yes Import Yes Yes Yes Yes Templates Yes Yes Yes No Unlimited Unlimited Font type, style, size, and color; cell borders, alignment, and background Font type, style, size, and color; cell borders, Unlimited alignment, and background Over 53, more to come Over 53, more to come Sum, Average only Sum, Average only Over 53, more to come Yes Max rows: 500 Font type, style, size, and color; cell borders, alignment, and background Sum, Average only Yes Yes Yes Yes Yes Yes Cell Formatting Excel Functions Numeric Formatting Yes Max Cell Length Biff7: Biff8: 255 32000 Biff7: Biff8: 255 32000 Biff7: Biff8: 255 32000 Biff7: Biff8: 255 32000 Biff7: Biff8: 255 32000 Max Number of Rows Biff7: Biff8: 16384 65536 Biff7: Biff8: 16384 65536 Biff7: Biff8: 16384 65536 Biff7: Biff8: 16384 65536 Biff7: Biff8: 16384 65536 Max Number 256 of Columns Max workbooks generated per Unlimited 24 hour period Number of concurrent workbooks Unlimited that can be generated Biff7: Biff8: 255 32000 500 256 256 256 256 256 Unlimited 200* 200* Unlimited 200* 1 Unlimited 1 1 Unlimited Bar, column, and pie only No Bar, column, and pie only No Yes Yes Bar, column, and pie only No Charting Yes Yes Pictures Yes Open Method or ExcelTemplate Object Yes Open Method or ExcelTemplate ExcelTemplate Object only Object ExcelTemplate Object only ExcelTemplate Object only ExcelTemplate Object only No No No No No Yes No Yes No Yes Yes No Read Excel workbooks Worksheets contain Ad ExcelWriter CodeWizard ExcelWriterLE and ExcelWriter Free will fail when generating more than 200 workbooks within 24 hours. Generated workbooks can be streamed to the browser or saved in static files on the hard disk. Static workbooks can be served an unlimited number of times. Only the generation of new workbooks is limited. * 10 All editions of ExcelWriter support Microsoft's BIFF7 and BIFF8 file formats. BIFF7 is the format used in Excel 95, and BIFF8 is used in Excel 97/2000/2002 (XP). BIFF7 and BIFF8 files can be opened in Excel 97/2000/2002 (XP) and BIFF7 files can be opened in Excel 95. Note that ExcelWriter 2.0+ produces spreadsheets in BIFF8 format by default, ExcelWriter 1.x produces spreadsheets in BIFF7 format only, and not all BIFF8 features are available in Excel 95. 2.5.1 Differences Between the Full and LE Versions ExcelWriter is tailored functionality functionality while that is specifically for serving a currently enterprise large part number of the class sites of product requiring a maximum of requests. and no It includes limitation on all of the spreadsheet generation. ExcelWriterLE is designed for lower volume sites that require ease of use and minimal formatting and functions. It has a maximum of 200 new workbooks that can be generated during a 24-hour period that begins when the first spreadsheet is created. The developer important versions distinction: are These equivalent versions to the are comparable single-threaded server and editions allow with only a one single spreadsheet to be created at one time. This is typical of the development environment. The developer versions also include the ExcelWriter CodeWizard that can automate development by producing the code for ExcelWriter to easily recreate an existing Excel file. SoftArtisans ExcelWriter SoftArtisans ExcelWriterLE SoftArtisans ExcelWriter Desktop SoftArtisans ExcelWriter Free and FORMATTING NUMERIC FORMATTING GENERAL NUMBER CURRENCY ACCOUNTING DATE TIME PERCENTAGE FRACTION SCIENTIFIC TEXT SPECIAL CUSTOM STYLISTIC FORMATTING FREEZE PANES FONT FONT TYPE FONT STYLE (REGULAR, BOLD, OR ITALIC) FONT SIZE FONT UNDERLINE (NONE, SINGLE, DOUBLE, ACCOUNTING SINGLE, ACCOUNTING DOUBLE) yes yes yes yes yes yes yes yes yes yes yes yes and yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes 11 yes yes yes FONT COLOR FONT EFFECTS (STRIKETHROUGH, SUPERSCRIPT, SUBSCRIPT) CELL HEIGHT AND WIDTH ROW HEIGHT AUTOFIT ROW HEIGHT COLUMN WIDTH AUTOFIT COLUMN WIDTH MERGE CELLS ALIGNMENT HORIZONTAL (GENERAL, LEFT, CENTER, RIGHT, FILL, JUSTIFY, CENTER ACROSS SELECTION) VERTICAL (TOP, CENTER, BOTTOM, JUSTIFY) TEXT CONTROL (WRAP TEXT) ORIENTATION BORDER BORDER OUTLINE (NONE, OUTLINE) BORDER LINE STYLE BORDER LINE COLOR CELL SHADING COLOR CELL BACKGROUND PATTERN BREAK HORIZONTAL PAGE BREAK PROTECTION LOCKED HIDDEN HYPERLINK NON-RELATIVE: HTTP, HTTPS, FTP, MAILTO, UNC PATH CHARTING STANDARD CHARTING COLUMN: Clustered column, Stacked column, 100% stacked column, 3D clustered column, 3D stacked column, 3D 100% stacked column, 3D column BAR: Clustered bar, Stacked bar, 100% stacked bar, 3D clustered bar, 3D stacked bar, 3D 100% stacked bar LINE: Line, Stacked line, 100% stacked line, Line with data markers, Stacked line with data markers, 100% stacked line with data markers, 3D line PIE: Pie, 3D Pie, Exploded Pie, 3D Exploded Pie XY (Scatter): Scatter, Scatter connected by curves, with data markers, Scatter connected by curves, without data markers, Scatter connected by lines, with data markers, Scatter connected by lines, without data markers AREA: Area, Stacked area, 100% stacked area, 3D area, 3D stacked area, 3D 100% stacked area DOUGHNUT: Doughnut, Exploded doughnut RADAR: Radar, Radar with data markers, Filled radar SURFACE: 3D surface, Wireframe 3D surface, Contour, Wireframe contour BUBBLE: 3D Bubble CYLINDER: 3D All types of column charts with cylindrical shape CONE: 3D All types of column charts with cone shape PYRAMID: 3D All types of column charts with pyramid shape 12 yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes CUSTOM CHARTING LINE-COLUMN: Clustered column, stacked column, yes 100% stacked column (with line) LINE-COLUMN 2 AXES: Clustered column, stacked column, 100% stacked column (with line) yes EXCEL FUNCTION MATH FUNCTIONS ABS worksheet function EXP worksheet function INT worksheet function MOD worksheet function ROUND worksheet function SUBTOTAL worksheet function SUM worksheet function SUMIF worksheet function STRING FUNCTIONS LEN worksheet function MID worksheet function REPLACE worksheet function VALUE worksheet function BOOLEAN FUNCTIONS (AKA logical functions) AND worksheet function OR worksheet function FALSE worksheet function NOT worksheet function TRUE worksheet function IF worksheet function TIME FUNCTIONS DATE worksheet function DAY worksheet function HOUR worksheet function MINUTE worksheet function MONTH worksheet function NOW worksheet function SECOND worksheet function TIME worksheet function TODAY worksheet function WEEKDAY worksheet function YEAR worksheet function STATISTICAL FUNCTIONS AVERAGE worksheet function COUNT worksheet function COUNTA worksheet function COUNTIF worksheet function MAX worksheet function MEDIAN worksheet function MIN worksheet function PERCENTILE worksheet function STDEV worksheet function STDEVP worksheet function ISNUMBER worksheet function DATABASE FUNCTIONS DAVERAGE worksheet function DCOUNT worksheet function yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes 13 yes DCOUNTA worksheet function DGET worksheet function DMAX worksheet function DMIN worksheet function DPRODUCT worksheet function DSTDEV worksheet function DSTDEVP worksheet function DSUM worksheet function DVAR worksheet function DVARP worksheet function LOOKUP and REFERENCE FUNCTIONS ROW worksheet function COLUMN worksheet function ROWS worksheet function COLUMNS worksheet function HLOOKUP worksheet function VLOOKUP worksheet function yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes 14 2.5.2 Which Version is Right for You? Figure 2: Determining which license your application requires In order to determine which ExcelWriter version will best fit your requirements, you will need to evaluate such factors as the daily volume of Excel workbook generation created by your application, the depth of formatting required, types of charts required, need for image insertion and whether or not you will need to use pre-existing Excel files as a data source. ExcelWriterLE may fulfill your needs if you do not expect a high volume and do not require complex formatting or formulas other than “Sum” and “Average”, charts other than bar, column or pie, and will not need to open pre-existing Excel files. (See Figure 2) Please contact [email protected] for assistance with determining which version will best suit your requirements. They can also assist with providing information on upgrading from the LE to the full version, so you can start with a lower cost and, as your needs grow, possibly upgrade to a more robust edition. 15 2.6 Client Requirements No software is required on the client in order to download and save an ExcelWriter generated Excel file. However, to open the file, one of the following must be installed on the client. • Microsoft Excel 95, 97, 2000, 2001(MAC) or 2002 (XP). • Microsoft's free Excel 97 Viewer: (http://office.microsoft.com/downloads/2000/xlviewer.aspx) The Viewer Excel 97 allows the user to view and print an Excel spreadsheet, but not to modify it. • Another application that supports the Excel format, such as, Quattro Pro (http://www.corel.com/) or Gnome/Gnumeric (http://www.gnome.org/projects/gnumeric) ExcelWriter is supported for use with the following browsers: • Microsoft Internet Explorer 4.0, 5.0 or 5.5 or later on all 32-bit versions of Windows, including Windows '95, '98, Me, NT, 2000, XP and Macintosh. • Netscape Navigator/Communicator 4.5 or later on all 32-bit versions of Windows. Please note: Communicator for Macintosh, Unix systems, and V6.0 have not been tested at this time. SoftArtisans does not guarantee that all issues can be resolved for an unsupported browser. 2.6.1 Microsoft Excel on Win32 All 32-bit versions of Microsoft Excel 95,97, 2000 and 2002 (XP) for Windows operating systems are currently supported. If the client machine does not have Excel installed locally, the user can download and install Microsoft's free Excel 97 Viewer (http://office.microsoft.com/downloads/2000/xlviewer.aspx). formulas will appear as "0" when using the Excel 97 Viewer. Please note: All 2.6.2 Microsoft Excel on Apple Macintosh Web reports can be accessed on Macintosh clients or on Unix clients through the use of Excel 2001, Gnome / Gnumeric (http://www.gnome.org/projects/gnumeric) Office. 16 or Star 3 Excel As a Reporting Format With over 120 million licensed copies of Microsoft Excel being used around the world, Excel is easily the most popular reporting tool available. SoftArtisans ExcelWriter brings this preferred format to Web applications. ExcelWriter generates Excel files that are in the native Excel 97 Microsoft or 2000 Binary (BIFF8) format. format ExcelWriter and, for Version 2.0 backwards and newer compatibility support with the previous versions, the Excel 95 (BIFF7) format. 3.1 Advantages True full-formatted familiarity with Excel this reporting widely is used in high office demand application. by The end users richness due of to the the data visualization and the flexibility that is available when working with files received in .xls format are just a couple of the reasons why Excel is so extensively used. Excel files also provide cross-platform access. 3.1.1 Familiarity of Client As part of the Microsoft Office suite of products, Excel is the most widely used spreadsheet application. A large percentage of users already have Excel installed on their machines. And those that do not have Excel installed can always take advantage of the free Excel 97 Viewer or use an alternative application that can open and work with Excel files. The widespread familiarity with Excel prevents the need for comprehensive training on a Web reporting software package. 3.1.2 Richness ExcelWriter delivers formatting, formulas, richly formatted custom styles, native Excel charting, and files that images. contain The comprehensive ability to precisely control page layout, set page breaks, and format print options is included. This goes far beyond the static representations of data that are offered by the alternative CSV files, HTML Tables or PDF files. 3.1.3 Ease of Modification ExcelWriter generates native Excel files that provide maximum ease of interaction for the end user. No cutting and pasting is required to save the data. the client machine, the spreadsheets can be manipulated, sorted, Once received on and modified as required. Alternatively, where required, these Excel files can be secured and protected client-side, to avoid tampering or unauthorized access. 3.1.4 Upload Back to Server Excel files that have been modified client-side, can be uploaded back to the Web server and opened with the ExcelWriter (Full version only) “Cells.GetDataFromExcelSheet” method. The cell values and cell formats can be extracted for inclusion into a new Excel workbook that is formatted server-side with ExcelWriter. Alternatively, the cell values can be used to update a database via ADO. This allows the use of a pre-existing Excel file as a data source. 17 REPORTING FORMAT COMPARISON Modifiable by Users Multi-platform Support Used for Business Intelligence/ Decision Support Image Support Dynamic Chart Support Upload Back to Server Opened in Browser Rich Formatting Microsoft Excel Adobe® PDF HTML CSV Yes No No Limited Yes Yes Yes Yes Yes Yes No No Yes Yes Yes No No Yes Limited No No Yes Yes No Yes Yes No Yes 18 No Yes Yes Yes 4 Usage Scenarios SoftArtisans ExcelWriter applications make a dramatic impact on the distribution of information across an enterprise. ExcelWriter can save enormous amounts of time and effort for both application developers and end users. Users are accustomed to reports in full-function, richly formatted Excel on their desktop. SoftArtisans ExcelWriter means that standard Excel documents do not have to be compromised into HTML, flat CSV files, or any lesser format to be quickly served through the Web. Web applications seamlessly integrate with common desktop applications. SoftArtisans ExcelWriter brings the power of Microsoft Excel to the Web. Benefits of using SoftArtisans ExcelWriter and native Excel spreadsheets on the Web include: FLEXIBILITY: • Users can serve themselves data and generate Excel reports from any location that has Internet access. DELIVERY SPEED: • Concurrent users receive Excel reports faster, when they need them, without straining the Web server or their patience. PRODUCTIVITY: • Business administration can become more automated. Custom reports for different departments/regions can be automated, reducing dependency on IT department. DATA VISUALIZATION FOR EASY ANALYSIS: • Native Excel charting (2D & 3D) makes data easy to understand. CONSISTENCY: • Same data and formatting in reports across the corporation— frequently accessed reports can be saved on the server. EASE OF USE: • just specially ExcelWriter makes Web reports accessible to all end users, not trained power users. Most business people are familiar and proficient in using Microsoft Excel as compared to other Web reporting tools. TIME MANAGEMENT: Reporting via the Web reduces and eliminates meetings, • conference calls, and many customer service issues. COST EFFECTIVE: • per user costs. SoftArtisans ExcelWriter has flexible licensing—there are no If users do not have Microsoft Excel installed on their workstation, they can view the Excel spreadsheets with a free viewer. The following scenarios demonstrate just a few ways organizations can use SoftArtisans ExcelWriter. 4.1 Intranet Reporting ExcelWriter is successfully used in many password-protected intranet sites. Corporate portals can contain standard company documents online and in native Excel: • • Sales reports Inventory status 19 that are dynamically generated • • • • • Market share/competitive comparisons Status reports Organization charts Administrative forms Research information ExcelWriter is commonly used for sales reporting. With ExcelWriter, static monthly reports can provide real time, dynamic information. Executives, sales representatives, marketing departments, accounting departments, can all access sales data any time. Popular reports may be saved on the server for easy access for thousands of end users, or custom reports can be generated through dynamic Web forms and drop down lists. Sales representatives may want to view sales by region with comparative data to goals or peers. Sales managers can keep track of regional performance. Marketing can analyze trends and measure success of campaigns. Once the employees download the spreadsheet to their desktop, they can manipulate data for their own purposes. advantage of having this sales information in dynamic Excel format is that The the information becomes easily accessible anytime to employees. 4.2 B2B Commerce ExcelWriter can be used for automating many business processes such as delivering information to customers, partners, manufacturers, and others. Companies can generate Excel spreadsheets to provide account information, online invoices, instant price quotes, documents sales from leads, the Web product lets lists, clients hours—self-service applications provide hurdles. many that There are ways contacts, access a and charts. information solution e-commerce for The during many businesses ability to provide own business international business can their use ExcelWriter to deliver information to partners and clients. For instance, an online office supply store may provide services such as a customer shopping lists in Excel. Many corporations order office supplies over the Web; the online store could provide an application that allowed customers to download shopping lists based on past purchase cycles. 20 4.3 Stock Portfolio With more and more information at their fingertips, investors are hungry to access upto-the-minute information about their finances. Rather than wait for an appointment with a broker, clients could access reports on the Web. With ExcelWriter, financial services companies provide their clients Excel Web applications such as self-service calculators, planners and worksheets. The developer can set up the reports from a database with formulas and the clients can run several different hypothetical scenarios in order to assist with decisions that will help them to maximize their investments. By allowing clients to access data, companies can reduce call frequency, providing subsequent savings through decreased staffing requirements. Clients can track their portfolio and save the reports to their personal computer to track stock records and facilitate long-term planning and budgeting. Native Excel charting and graphing provides simple data visualization for easy trend analysis. 4.4 Human Resources Human Resources departments have saved a tremendous amount of staff time by making information available online. HR departments usually have a strong presence on intranet sites. Employee handbooks, policy distribution, company-wide calendar, personnel forms and payroll information can all be stored in online corporate portals as Excel files. 4.4.1 Web-based Payroll Web payroll processing is easy and convenient for both employers and employees. A business can use ExcelWriter to give employees the option to view and download their payroll information in Excel format. Employees can view payroll reports, view electronic pay stubs including tracking of vacation and sick time. They can modify the year-to-date spreadsheets to plan their personal budgets as well as review their payroll history and statements from anywhere. 21 5 Features in Depth 5.1 Excel Version Compatibility ExcelWriter generates Excel files that are in the native Microsoft Binary format. ExcelWriter is compatible with Excel 95 (BIFF7), 97, 2000 and 2002 (BIFF8). 5.2 Addressing Cells There are two methods of addressing cells contained in a spreadsheet generated by ExcelWriter: by Addressing Name cells by or by name Number is . easier to read, more intuitive and matches the cell references seen in Microsoft Excel. Addressing cells by number is significantly faster, and is easier to program if it is necessary to walk a number of cells. It is possible to employ both means of referencing cells within your code. set xlw = Server.CreateObject("SoftArtisans.ExcelWriter") set cells = xlw.worksheets(1).cells '--- By name cells("B3").value = 123 '--- Same cell by number cells(3, 2).value = 123 When referencing a cell by number, the format is cells(row, column). 5.3 Setting Cell Values An ExcelWriter-created workbook allows for the flexible assignment of cell values by various methods. Cell values can be assigned programmatically: • • On a cell-by-cell basis with data that has been parsed from a CSV file or an XML file By iterating through an ADO Recordset and assigning field values to cells on a rowby-row basis • By importing the entire contents of the Recordset in a single step with the “CopyFromRecordset” or “GetDataFromRecordset” methods • Or by extracting data from a pre-existing Excel File and copying it into the newly created Excel sheet by means of the “GetDataFromExcelSheet” method ExcelWriter allows you to format these imported cell values as virtually any data types that are supported by Excel. This includes currency, date/time, numeric data types such as integer or floating point number, strings, text, etc. Casting (or changing cell values from one data type to another) can be accomplished by means of the serverside scripting functions (i.e. VBScript’s CStr() or CINT() functions). 22 5.4 Importing From a Database As mentioned above, data can be imported into the worksheet being created from any ADO datasource, either by using the simple one-step pasting method of a rectangular block of data offered by the “CopyFromRecordset” or “GetDataFromRecordset” methods, or by walking the Recordset object and assigning values via a loop. Multiple recordsets can be added in a single worksheet or workbook. 5.4.1 ADO Data from worksheets a database via Microsoft can be made ActiveX Data accessible Object for (ADO). importing ADO into provides ExcelWriter the ability to connect to a database, and by means of a SQL query that can be formulated by using values retrieved from a client-side form, to retrieve a recordset object that contains the exact data that a user ExcelWriter. ADO can wishes to have populated in the Excel file created by be used to filter or sort the data prior to scripting it into an ExcelWriter-generated worksheet. 5.4.2 ODBC In order to import data from databases, it is recommended that you first install the latest Microsoft drivers on your machine. There are specific ODBC Drivers available that will allow you to create connections to most major databases such as Access, Oracle, or SQL Server. The driver package http://www.microsoft.com/data/. for Choose to each version download of MDAC 2.0 IIS or is free later. at MDAC includes updates to ADO, OLEDB, and related ODBC drivers. 5.5 Formatting Once cell values have been set, the accurate and easy-to-understand display of that data is dependent on properly executed formatting of the cells contained in the worksheet. Cells are formatted by the application of fonts, formats and styles. This can be done in the server-side scripting either prior to or as a follow-up to the importation of cell values in the script. Fonts determine the text representation of a cell, such as the font name, the size, the color, etc. A font can be included as a property of a style or format. Format and style share many characteristics. Both are used to set the look of text, defining properties such as alignment, text wrap and so on. However, a format is specific to one cell. A style ensures that a set of cells have the same look. If the style is changed, all cells that reference the style will automatically update with the modified formatting. A style can be used repetitively for each cell in a set of cells. Once a style is applied to a cell, it is possible to override specifics of style by using the cell's format. Updating a style will automatically update all cells where the style was applied. 23 Wherever possible, create a set of custom styles and fonts and then apply them to multiple cells rather than setting individual format properties on a per cell basis. This will help to avoid exceeding Excel’s maximum limit of approximately 4074 separate styles and formats (combined) that can be included in a workbook. The custom styles that are defined can include numerous properties that set such things as text alignment and display (mentioned above), cell patterns and color fill, cell ” borders, etc. The “Style.Number property can be included to specify how numbers and dates are to be displayed in these cells. This “Number” property is equivalent to the “Format.Number” property used when formatting on a per cell basis. This property can be set to any of the predefined choices available in the “Formatting Code” table that is part of the ExcelWriter documentation or to a customized mask that is created. 5.6 Formulas ExcelWriter supports almost all major math, string, boolean, time, statistical, database, lookup and reference formulas or functions that are part of Excel. Formulas can be inserted into any cell in a worksheet by using the “Cell.Formula” property. They can be inserted into the spreadsheet either by hard coding the address for the cell “NumRows” where the to contain (the last it return row of or by value the dynamic of pasted the coding which includes “CopyFromRecordset” recordset will be a variable method positioned in which the such as indicates worksheet) to provide a sum at the bottom of a column. In ExcelWriter, formulas can reference data across worksheets, as follows: ws3.Cells(1,1).Formula = "=sum(sheet1!A1,Sheet2!A2)" ws3.Cells(2,1).Formula = "=sum(sheet1!A1:A3)" When applying a formula to a cell, always include the entire string in double quotation marks (“”) and begin the string with an equal sign (=), as you would when creating a Microsoft Excel spreadsheet. With ExcelWriter, formulas cannot be executed server-side to retrieve values for use in the script. All formulas are executed at the time that the file is downloaded and opened in Excel. (Please note: If the downloaded files are opened client side with the free Microsoft Excel Viewer, all formulas will be rendered with “0” as the resultant value.) 5.7 Charting ExcelWriter offers the ability to create full-formatted, native Excel workbooks that can include charts in 2D or 3D format. The server edition currently supports fifteen major chart types and over seventy subtypes. (Please note: The ExcelWriterLE version available chart types are bar, column, and pie). ExcelWriter is not a charting engine and .jpeg cannot be used to produce static .gif inclusion into an HTML page. 24 or representations of charts for One or more charts can be added on the same worksheet in which the data being referenced is contained. Charts are added using the “Add” method of the “Charts” collection object and specifying the range on a worksheet in which the chart should be positioned: Set Charts = ws.Charts Set Chart = Charts.Add(ChartType, [SubType], [UpperLeftRow], [UpperLeftColumn], [LowerRightRow], [LowerRightColumn]) Once the chart type has been established and positioned within a worksheet, data can be referenced by means of the creation of a “SeriesCollection” object. The X-Axis (Category) data is added as follows: SeriesCollection.CategoryData = "A1:A3" The Y-Axis (Value) data is added by means of this object’s “Add” method as follows: Set SeriesCollection =Chart.SeriesCollection SeriesCollection.Add(Area, , [Vertical]) Area The parameter specifies the values from which to plot the data series. Area may be a range of cells (such as, "A1:C3"), or a sequence of values (such as,"{5,7,9}"). The optional parameter Vertical specifies whether to plot the series from a range of cell values by row or by column. When by row. When Vertical is set to Vertical 1, is set to 0, ExcelWriter will plot the series ExcelWriter will plot the series by column. The default value of Vertical is 0. Data can be referenced across worksheets by the use of absolute, cross-sheet ranges as follows: SheetName!$Column$Row:$Column$Row ExcelWriter allows you to create such elements as a chart title, legend, category and value axis titles and data labels, and grid lines. By first creating and then referencing custom fonts in the “TextFont” property, chart titles and legend text can be fully customized for font type, color, and size. By using the “Area” “MarkerFormat”, “AreaFormatting” object, “Wall3D”, from which and is available “ChartFrame”, automatic to for manipulating it’s custom also or the possible none, and “Series to Area”, toggle to set the the “BackgroundColor”, “ForegroundColor” or “Pattern” for the chart area, plot area, or the data series markers, and other elements of the chart. 5.8 Images The ExcelWriter Server Edition also offers the ability to import images or pictures into a workbook. The primary method for inserting a picture is by “CreateFromFile” method of the “Pictures” object: Set Pictures = ws.Pictures Pictures.CreateFromFile(UpperLeftColumn, UpperLeftRow, LowerRightColumn, LowerRightRow, FileName) 25 means of the “UpperLeftColumn”, “UpperLeftRow”, “LowerRightColumn”, and “LowerRightRow” specify the location of the picture in the worksheet. “FileName” specifies the complete path and name of the file from which you are creating a picture. Since ExcelWriter is a server-side control, it does not have the ability to adjust the display of an image based on the screen resolution of the monitor that will be used to display the worksheet and the included image. Therefore, when employing the “CreateFromFile” method to specify the range of cells in which to display the image, the image may appear somewhat distorted, when displayed at certain resolutions, from being stretched or shrunken to fill the area specified in the range. The “BorderlineType” and “BorderLineWeight” properties of the image borderline can be specified. properties: By correctly “LowerDeltaX”, manipulating “LowerDeltaY”, the horizontal and “UpperDeltaX”, and the vertical offset “UpperDeltaY”, an image can be made to overflow the boundary rows and columns or to shrink inward in order to create a buffer or white space around the image. An image can also be made to move dynamically, when required, by means of the “Move” method of the “Picture” object. 5.9 XML Import As mentioned earlier, ExcelWriter can be used to display, in an Excel worksheet, data that has been parsed from an XML file which is being used as a datasource and that is available on the Web server. 5.9.1 MSXML In order to parse data and to make it available for importing into the Excel workbook being created by ExcelWriter, an XML parser is required. Microsoft offers its own version of an XML parser with MSXML. In order to make MSXML available for use in the ASP page that contains ExcelWriter, an instance of the server-side parser must be created as follows: Set XML = Server. CreateObject(“MSXML2.DOMDocument”) Once the XML object is available, the XML source file can be accessed via the “load” method (with error handling): Xml_file = Server.MapPath(“my_xml.xml”) Dim bRet BRet = XML.Load(xml_file) If (bRet = False) Then Response.Write Err.Description End If 26 5.9.2 Excel XML DOM The XML “Document Object Model” (DOM) is a programming interface for XML documents. It defines the way a document can be read and manipulated. Once the XML file is provides a loaded means in for the the ASP page that server-side includes scripting to the ExcelWriter navigate its object, structure in this DOM order to import the data contained in the document’s various “nodes” into the Excel worksheet on a cell-by-cell basis. The DOM represents a tree view of the XML document. The documentElement is the top-level of the tree. This element has one or many childNodes that represent the branches of the tree. A Node Interface is used to read and write the individual elements in the XML node tree. The childNodes property of the documentElement can be accessed with a for/each construct to enumerate each individual node. Here’s a code snippet, continued from above, that demonstrates how to “walk” the XML DOM in order to retrieve the data to be imported into the Excel file being created by ExcelWriter: Private Sub BuildWorksheet(ByRef parent, ByRef sheet) Dim Dim Dim Dim Dim node row cell nRow nCol For Each node In parent.childNodes If node.nodeName = "Table" Then For Each row In node.childNodes If Not row.Attributes.getNamedItem("ss:Index") & _ Is Nothing Then nRow = & _ row.Attributes.getNamedItem("ss:Index").nodeValue End If For Each cell In row.childNodes If Not cell.Attributes.getNamedItem("ss:Index") & _ Is Nothing Then nCol = & _ cell.Attributes.getNamedItem("ss:Index").nodeValue End If If Not cell.firstChild Is Nothing Then sheet.Cells(nRow, nCol) = & _ cell.firstChild.firstChild.nodeValue End If nCol = nCol + 1 Next nRow = nRow + 1 Next End If Next End Sub 27 Dim XLW, XML Set XLW = Server.CreateObject("SoftArtisans.ExcelWriter") Set XML = Server. CreateObject(“MSXML2.DOMDocument”) Xml_file = Server.MapPath(“my_xml.xml”) Dim bRet bRet = XML.Load(xml_file) If (bRet = False) Then Response.Write Err.Description End If Set doc = XML.documentElement Dim strSheetName Dim node For Each node In doc.childNodes If node.nodeName = "Worksheet" Then strSheetName = & _ node.Attributes.getNamedItem("ss:Name").nodeValue XLW.Worksheets.Add strSheetName Set tempSheet = XLW.Worksheets(CStr(strSheetName)) BuildWorksheet node, tempSheet '--- Create Worksheet 1 to contain the data table Set WKS = tempSheet Set Cells = WKS.Cells End If Set tempSheet = Nothing Next 28 Once the Excel file in memory on the server has successfully imported the data, the worksheet can then be formatted, manipulated and saved or streamed using the various options available with the ExcelWriter “Save” method. Figure 3: Resulting spreadsheet for XML sample 5.10 Saving Results ExcelWriter provides a number of options for saving or streaming the Excel files that it creates with server-side scripting. The option that will best suit the requirements of the application is specified in the “Save” method of the “ExcelApplication” principal object. The “Save” method takes three parameters and returns the output file as a series of “bytes”: varBytes = xlw.Save "filename", option1, option2 “FileName” contains either the name of the file with which you wish to stream it, or the full path to the location on the server where you wish to save the file. “Option1” specifies the manner in which the file is saved or streamed: • saDefault (= 0) • saOpenInExcel (= 1) • saOpenInPlace (= 2) 29 “Option2” specifies the format in which the file is saved or streamed: • saFileFormatDefault (in V2 or later =8, in V1.x =7) • saFileFormatExcel95 (= 7) • saFileFormatExcel97 (= 8) • saFileFormatExcel2000 (= 8) 5.10.1 To Disk In order to save the file as a flat file on the Web server’s hard disk, the “Save” method will contain only the “filename” parameter with the full path of the file as it is to be saved on the server’s hard disk: xlw.Save "d:\excelreports\report1.xls" 5.10.2 To Memory If the “Save” method is followed with three empty parameters, the file will be returned as a sequence of bytes in memory (a variant of type VT_UI1 | VT_ARRAY): varBytes = xlw.Save 5.10.3 Streamed to Browser The “Save” method can be used to designate that the newly created file should be streamed to a client machine via HTTP protocol in order to be launched directly in the client’s browser. Or it can be used via a “File Download” dialog, to present the client with the choice of opening the file in a new window with Excel, or of saving the file to their hard drive. The exact method is specified by means of “Option1”. 5.10.3.1 In-place Activation When “Option1” of the “Save” method includes the “saOpenInPlace” (=2) constant, as follows: xlw.Save "report.xls", saOpenInPlace the downloaded file will be opened with Excel (or the freeware “ExcelViewer”) directly in the client browser. 30 5.10.3.2 In a Separate Window When “Option1” of the “Save” method includes the “saOpenInExcel” (=1) constant, as follows: xlw.Save "report.xls", saOpenInExcel the downloaded window. If the file will force client chooses a “File Download” dialog box to appear in the “Open this file from its current location”, the client file will launch and display in Excel (if installed) in a separate window. If “Save this file to disk” is chosen, the client will be allowed to save the file locally with the name of the file as specified in the first “filename” parameter of the “Save” method. 5.11 Read an Existing Spreadsheet* * This feature is not available in ExcelWriterLE. With ExcelWriter, you can get data from an existing Excel spreadsheet and copy it to another spreadsheet. To read from an existing sheet use the “Cells” object method GetDataFromExcelSheet. GetDataFromExcelSheet can be called more than once in the process of creating a new spreadsheet. GetDataFromExcelSheet can only retrieve cell values. To retrieve charts, formulas, macros, and VBA, use ExcelTemplate or ExcelApplication.Open. GetDataFromExcelSheet takes seven parameters, and returns a range object: Range = cells.GetDataFromExcelSheet(FileName, [Source], [IncludeFormatting], [FirstRow], [FirstCol], [MaxRows], [MaxCols]) Once the range has been imported into the new worksheet, it can be accessed via server side scripting. This enables setting formulas or charts that reference imported cell values, updating a database via ADO code that parses out the data, and adding or modifying formatting. 31 Parameter Definition Default Value [MaxRows] The name of the source file, that is, the spreadsheet from which ExcelWriter is reading. Optional. Specifies the first cell in the source range of cells. Source may include both sheet number and cell name (e.g. "Sheet2!$B$11"), or a cell name alone (e.g. "B11"). If Source does not include a sheet reference, ExcelWriter will read from the first sheet in the workbook. Optional. When set to True, ExcelWriter will copy the original formatting with the data from the existing spreadsheet. Optional. First row in the destination sheet. Optional. First column in the destination sheet. Optional. Maximum number of rows to write in the destination sheet. [MaxColumns] Optional. Maximum number of columns to write in the destination sheet. FileName [Source] [IncludeFormatting] [FirstRow] [FirstColumn] "" If you do not assign a Source value, ExcelWriter will start reading at cell A1 in the first worksheet. True 1 1 16384 in Excel 95 (BIFF7) 65536 in Excel 97/2000 (BIFF8) 256 (Limit imposed by Microsoft's BIFF7 and BIFF8 formats, not by ExcelWriter) To get data from an existing Excel workbook, 1. Use GetDataFromExcelSheet to specify the source file, and, optionally, the first source cell, the first destination cell, and the maximum numbers of rows and columns to copy. Example: To get data from C:\spreadsheets\workbook1.xls, sheet 2, starting at cell B3, without formatting, and copy to cells B3:F12 in the destination file, use, Set ResultRange = ws.Cells.GetDataFromExcelSheet ("C:\spreadsheets\workbook1.xls", "Sheet2!$B$3", False, 3, 2, 10, 5) 2. Save the destination file. Example: xlw.Save "c:\workbook2.xls" 5.11.1 Formulas Importing Formulas contained in a cell that is imported as part of the range object can be copied. However, the cell values that are the result of the execution of the formula will not be available on the server. This means, for example, that if the requirement is to obtain the "sum" of a certain set of cells server-side for reference in an ADO update to a database, the true value will not be accessible and the cell value for the cell containing the formula will read as "0". 32 5.12 Modifying an Existing Spreadsheet You can open and modify an existing spreadsheet, and save it with a new name or stream it to the browser (preserving the original file). This allows you to use a preset format for similar Alternatively, use a spreadsheets, template. To rather than determine recreate which the method is format best for for each. you, see ExcelApp.Open vs. ExcelTemplate, section 5.14. If either saOpenInPlace or saOpenInExcel is used in the Save method and the new spreadsheet is given the same name as the original file that exists on the server, the original file will not be overwritten. The original spreadsheet can include macros, VBA, charts, etc. - they will be preserved in the new spreadsheet. Note: If you open a BIFF7 (Excel 95) format spreadsheet, you cannot apply BIFF8 features to it, and ExcelWriter will save the spreadsheet in BIFF7 format. To modify an existing spreadsheet, 1. Open the spreadsheet, using the ExcelApplication object's Open method: Set objExcelApp = Server.CreateObject("SoftArtisans.ExcelWriter") objExcelApp.Open "c:\folder\file.xls Note: ExcelApplication.Open cannot open a file containing data markers (that is, a template). 2. Create at least one Worksheet, for example, set order = xlw.worksheets(1) 3. Assign cell values, for example, order.cells("A7").value = "Margaret Anderson" order.cells("A8").value = "32 Andover Lane" order.cells("A9").value = "Lawrence, NY" Save the modified file with a new name. 5.13 Using Template Spreadsheets ExcelWriter's ExcelTemplate object generates new files from template spreadsheets. ExcelTemplate imports an ADO recordset (or recordsets) to a template and generates a new spreadsheet. Note: The ExcelTemplate object supports Excel's BIFF8 (Excel 97/2000/XP) format only; ExcelTemplate does not support BIFF7 (Excel 95) format templates, and will not generate BIFF7 format files. The ExcelTemplate property object - object DataSource. model is simple includes Compared and two to methods the compact, - Open ExcelApplication making and Process object, ExcelTemplate a - and one ExcelTemplate's faster means of generating a file from an existing spreadsheet than ExcelApplication.Open. However, while the ExcelApplication object is rich in features, and can modify spreadsheets at run time, ExcelTemplate only imports recordsets. 33 An template is a file created in Microsoft Excel that contains data data marker specifies a database column to import to the spreadsheet ExcelWriter markers. A column containing the marker. The format of a data marker is: %%=Recordset.ColumnName For example, if cell B6 contains the data %%=Recordset.OrderID, marker where Recordset represents the Orders table in the database, ExcelWriter will import the OrderID column to the spreadsheet's column B. This example uses the Northwind database. Template Spreadsheet generated from template To generate a spreadsheet from a template, 1. In Microsoft Excel, create a template spreadsheet. Include data markers indicating database columns to import to the spreadsheet. For example, to insert the Products table's UnitsInStock Column in Excel column C, first row 3, enter %%=Products.UnitsInStock in cell C3. Optionally, include in the template any values, formulas, formatting, charts, pivot tables, etc. 2. In a server-side script, 1. Create an instance of the ExcelTemplate object: Set objTemplate = Server.CreateObject("SoftArtisans.ExcelTemplate") 2. Create an ADO database connection, connect to and query the database, and create a recordset, e.g., Set adoConnect = Server.CreateObject("ADODB.Connection") strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_ Server.MapPath(Application("vroot") & "northwind.mdb") sqlText = "SELECT top 20 * from Orders" adoConnect.Open strConn Set Recordset = adoConnect.Execute(sqlText) 3. Use the ExcelTemplate object's Open method to open the template: objTemplate.Open "c:\templates\template.xls" 4. Set the template's DataSource(s) to the Recordset(s) returned from the database, using any of the following formats. 34 Format Data Marker Code 1 Generic %%=DataSourceName.FieldName obj.Datasource("DataSourceName") = MyRecordset 2 Implicit Bind %%=FieldName obj.Datasource = MyRecordset %%=#1.FieldName %%=#2.FieldName obj.Datasource = MyRecordset obj.Datasource = MyRecordset1 3 Bind by order %%=DataSourceName.#1 %%=DataSourceName.#2 4 Bind by field position 2 Implicit Bind & with 3 Bind by order 1, 2, 3 & 4 obj.Datasource("DataSourceName") = MyRecordset obj.Datasource = MyRecordset obj.Datasource = MyRecordset1 or %%=FieldName %%=#2.FieldName obj.Datasource ("#1") = MyRecordset obj.Datasource ("#2") = MyRecordset1 Generic, Implicit, Bind by order, and %%=#1 Bind by field %%=#2.#2 position 5. Use the obj.Datasource = MyRecordset obj.Datasource = MyRecordset1 ExcelTemplate object's Process method to generate the spreadsheet: objTemplate.Process "c:\template_result.xls", saOpenInExcel Process takes two parameters: the name and path of the generated spreadsheet, and an optional process method. Assign the process method parameter by name or number: saProcessDefault saProcessOpenInExcel saProcessOpenInPlace saProcessOpenForScripting 0 1 2 3 35 5.14 ExcelApp.Open vs. ExcelTemplate ExcelWriter provides two means of using a preset spreadsheet format to generate a new spreadsheet: • ExcelApplication's Open method (see Modifying an Existing Spreadsheet) • ExcelTemplate (see Using Template Spreadsheets) Note: data An ExcelWriter template is a file created in Microsoft Excel that contains markers ExcelWriter template, and can be opened documentation, not a Microsoft the with term Excel the ExcelTemplate "template" template (.xlt). refers to However, object. an In the ExcelWriter ExcelWriter can open and generate both .xls and .xlt files. Use an .xlt file the same way you would an .xls file. Using ExcelApplication.Open is slower than using ExcelTemplate because the ExcelApplication object is much larger than the ExcelTemplate object. However, the ExcelApplication object is rich in features, and can modify spreadsheets at run time, while ExcelTemplate can only import recordsets. The following table summarizes the differences between the two. To determine which method is right for you, consult the decision tree below. Note: You can use ExcelTemplate and ExcelApplication together, as demonstrated in the sample Using ExcelTemplate with ExcelApplication. ExcelApp.Open ExcelTemplate BIFF7 (Excel 95) and BIFF8 (Excel 97/2000/XP). Supported Excel formats Modifications at run time Can open a file containing data markers Performance Flexibility Data Sources BIFF8 only. ExcelTemplate does not support BIFF7 format Note: If you open a BIFF7 (Excel 95) format templates, and will not generate workbook, you cannot apply BIFF8 features to BIFF7 format files. it. ExcelWriter will save the workbook in BIFF7 format. Yes No No Yes ExcelApplication's large object model makes it Because it is compact, ExcelTemplate is a faster means a slower means of modifying an existing file of modifying an existing file than than ExcelTemplate. ExcelApp.Open. ExcelApplication is rich in features (including ExcelTemplate only imports database import) which can be applied to an database recordsets existing workbook at run time ADO recordset (see GetDataFromRecordset), ADO recordset Excel workbook (see GetDataFromExcelSheet) Requires modification of an existing Excel No workbook before opening Supports Macros and VBA Yes. To use an existing Excel workbook as a template, you must add data markers to it. ExcelApplication preserves existing Macros and VBA but cannot create new Macros and VBA 36 ExcelTemplate preserves existing Macros and VBA but cannot create new Macros and VBA To determine which method of using a preset workbook format is right for you, consider the following, • Do you have an Excel file that you would like to use as a model workbook? If you do, is modifying the file an option? Using ExcelApp.Open does not require modification of the file, while using ExcelTemplate requires adding data markers to the file. • Do you want to ExcelTemplate offers an be only able to allows abundance of modify you to features the generated import at run workbook recordsets, time, while including charting, picture insertion, formatting, and many more. 5.14.1 ExcelApp.Open vs. ExcelTemplate Decision Tree 37 at run time? ExcelApplication formulas, 5.15 Data ExcelWriter offers a “GetDataFromExcelSheet” method that is part of the “Cells” object. This method provides the ability to use a pre-existing Excel file (located on the Web server or on a networked server) as a data source when creating the new Excel file with server side scripting. This functionality allows for the import of cell values and cell formatting (optional) from a range of cells that is specified in the pre-existing workbook. This range can then be pasted into the new spreadsheet in the precise location required for creation of the new file. The “GetDataFromExcelSheet” method takes seven parameters and it returns a range object, as follows: Range = cells.GetDataFromExcelSheet(FileName, [Source], [IncludeFormatting], [FirstRow], [FirstCol], [MaxRows], [MaxCols]) The first “FileName” parameter contains the full path and the name of the source file (as a string) of the spreadsheet from which ExcelWriter is reading. The second “Source” parameter specifies location of the first cell in the source range of cells. “Source” can include both the sheet number and "Sheet2!$B$11"), or the cell name alone (e.g. "B11"). If the Source cell name (e.g. does not include a sheet reference, ExcelWriter will read from the first sheet in the workbook. If you do not assign Source a value, ExcelWriter will start reading at cell “A1” in the first worksheet. The third “IncludeFormatting” parameter is optional (the default is “True”) and dictates whether to values. The “MaxCols” copy formatting following are optional from four and the source parameters: specify how sheet in “FirstRow”, to place the addition to “FirstCol”, imported importing the “MaxRows”, range object cell and in the during the destination spreadsheet. This “GetDataFromExcelSheet” method can be called more than once creation process of the new spreadsheet. Once the range has been imported into the new worksheet, it can be accessed via server side scripting. This allows the ability to set formulas or charts that reference imported cell values, update a database via ADO code that parses out the data, or to add or modify formatting. 5.15.1 Formulas The implementation current of reading from a pre-existing worksheet has one limitation relating to working with formulas that are part of the cell data imported with the “GetDataFromExcelSheet” method. 38 Formulas contained in a cell that is imported as part of the range object can be copied. However, the cell values that are the result of the execution of the formula will not be available, server-side, are not yet accessible. This means, for example, that if the requirement is to obtain the “sum” of a certain set of cells server-side for reference in an ADO update to a database, the true value will not be accessible and the cell value for the cell containing the formula will read as “0”. 5.15.2 Macros, Outlines, Pivot Tables and VBA Open a pre-existing file or template that has been created and designed directly in Excel and uploaded to the Web server. The template can then be loaded into memory on the server and made available for use in creating a new Excel workbook with ExcelWriter. In this manner, all features of the Excel template can be passed into the new Excel file and become part of the new file that can then be saved or streamed. This will include the ability directly to support supported in virtually the all features ExcelWriter and object macros, VBA, pivot tables, etc. 39 functionalities model. This of Excel includes that such are things not as 6 Comparison to Microsoft Excel ExcelWriter offers some very important advantages over the Excel object when used in a traditional client/server application (the Desktop edition) or on a Web server (ExcelWriterLE or Server editions) to generate and stream true native Excel reports. 6.1 Excel on the Web Server ExcelWriter has no dependency on the Excel object when creating native Excel files. This means that it is not necessary to have Excel installed on the server at all. This is a major benefit due to lower licensing costs and ease of deployment as well as for the performance and stability of the server when handling large volumes of concurrent requests for Excel reports. 6.1.1 Licensing ExcelWriter licensing is on a per-CPU or per-server basis (ExcelWriterLE and all developer versions). This means that there are no per-user or run-time royalty costs associated with any version of ExcelWriter. Microsoft Excel licensing requires, not only that the Web server creating Excel reports has a license for Office, but also that each client that is receiving the downloaded Excel reports must have a valid license for Excel on the local machine. Using the Excel object to generate Excel reporting on an intranet would require an enterprise level license for Office. ExcelWriter licensing provides far greater flexibility and reduced overall costs for the generation and streaming of Excel reports via the Web. 6.1.2 Performance ExcelWriter server is a stability multi-threaded when handling server-side multiple DLL that concurrent provides requests. a greater measure Instantiating of multiple copies of the Excel object can be dangerous, as the objects do not always close out when they are no longer in use. This can place a heavy load on the server that could eventually result in a server crash. The ExcelWriter .dll can be set to nothing in the ASP code that kills the current process and releases all resources. Benchmark comparisons show that ExcelWriter is capable of generating native Excel files at speeds up to 100 times faster than the Excel object. See test results at: http://www.softartisans.com/softartisans/excelwriterbenchmarks.html 6.2 Office Web Components Starting with Office 2000, Microsoft is offering a set of Office Web Components (OWC) that enable a scaled-down version of some of Excel’s key features to be integrated into a Web reporting solution. There are four principal Office Web Components: • • • • Spreadsheet Pivot Table Chart Data Source 40 These Office Web Components are COM components. This means that any COM-aware client, such as ASP, Visual Basic, and Visual C++, can use them. They are a collection of ActiveX controls which bring many of Excel’s advanced data-representation features, such as interactive spreadsheets, charts, and pivot tables to Web pages. also integrate seamlessly into many design environments, such The OWC ® as Microsoft FrontPage, Visual InterDev, and Visual Basic. The three display-oriented components (Chart, Pivot Table, and Spreadsheet) each provide powerful functionality for viewing and interacting with data while hosted within Internet Explorer. The OWC offer advanced client-side interaction. They expose several events that can be handled by client-side script. Excel can also manage data binding among the Office Web Components. This means that if you publish a chart, the Spreadsheet component will also be included in the Web page and its data will be bound to the chart so changes made to the data are reflected immediately in the chart. Microsoft, however, has crippled the use of Office Web Components for Web reporting applications with a severe licensing scheme that is not conducive to using this solution for an Internet (or intranet) site. In order to use OWC in a Web application, Microsoft currently requires a license for Office 2000 or later on both the server generating the reports and on the client machine that is used to view the reports, even in cases where the client is viewing static charting images or HTML tables. This makes the generation of reporting rather costly and dangerous, as the Web site administrators have no means for verifying that users receiving output have complied with Microsoft’s licensing requirements. When using OWC for an intranet reporting solution, the corporation must possess an Enterprise license for Office 2000 or later, or must, at least, upgrade all user licenses to Office 2000 (or later) licenses. Again, this can be rather costly. OWC cannot be used at all on the Internet. The Office Web functionality. Components differ greatly from ExcelWriter in their server-side Because they are a collection of four separate controls, they cannot be used to generate a single file with multiple objects. instance, represents a single sheet. The Spreadsheet component, for Multiple sheets cannot be created within the same component and a chart or PivotTable cannot be embedded within that spreadsheet. 41 This becomes a considerable problem when using ASP to create a file and stream it to the client. OWC contains no intrinsic support for ASP. Content cannot be streamed back to the browser, but must be first written to a file on the server’s hard drive, then read and returned to the client. This means that to return a spreadsheet and a chart to the client through ASP, multiple files must first be saved to the Web server’s hard drive, then somehow sent to the client. 1. OWC programming is much This limitation has several implications: more difficult. Unique temporary files must constantly be created and deleted. 2. Security is compromised because IUSR_machinename must have “write” access to the server’s file system. 3. Performance suffers tremendously because data must be written to and read from disk. The Office Web Components bring individual bits of Excel’s functionality to a Web page, but binding them and displaying them programmatically can be exceedingly complex. Also, the end user’s ability to manipulate spreadsheets and charts subset of Excel functionality supported by the Web Components. is limited to the For instance, the user cannot add new series to a chart or add charts to the page to see a different view of the data. In comparison, when ExcelWriter-generated files are streamed to a client machine, they can trigger the opening of an instance of Excel within the browser, offering the full functionality of the Excel application, including saving the workbook as an xls file. means that the user can edit data, reformat cell properties, and rework the This chart representation of the data. ExcelWriter files can be viewed using either Netscape or Internet Explorer browsers. This is not the case with OWC, which, as ActiveX controls, require the use of Internet Explorer 4.0 or later. ExcelWriter generates workbooks that can contain multiple worksheets in true native Excel format (BIFF8, or BIFF7 when required). This is opposed to OWC output that is XML and NOT true native Excel format. In addition, starting with version 3.0, ExcelWriter is able to open and copy complex templates, created directly with Excel, that contain such features as macros, outlines, and VBA. These features can be preserved in the workbooks that it saves or streams. This is not possible when using OWC to generate Web reporting. 42 7 Comparison to Other Alternatives 7.1 CSV Files ExcelWriter generates native Excel files (BIFF8) that contain virtually all of the features and functionality of files created directly with formatting and insertion of charting and images. Excel itself. This includes in-depth ExcelWriter-generated reports can be customized to present a rich and attractive presentation where required. This provides a vast improvement over the generation of simplified CSV files. “Comma Separated Values” files consist of nothing more than pure data that is output with no integral ability to manipulate the presentation of this data in an attractive and approachable format. 7.2 HTML Although generating Web reports as HTML tables certainly allows for a far richer presentation of data than does the generation of CSV files, it still has disadvantages. HTML output is primarily static by nature and requires complex client side scripting in order to provide users with any ability to interact with the data that has been presented to them. If the user wishes to import the data into a client side application such as Excel, itself, they will be forced to cut and paste as required. The data can be saved, but most formatting will be lost. ExcelWriter output is dynamic. The native Excel files (BIFF8) that it outputs can be downloaded and opened directly with Excel. These downloaded files contain all of the requested data along with the rich formatting elements, such as charts, formulas or images, added in the server-side creation of the file. Once the user has the opened Excel file in front of them, they are free to interact with the data and make whatever manipulations they desire. This includes updating data, modifying chart types, adding and deleting rows or columns. 7.3 Crystal Decisions Crystal Decisions allows for the presentation of data in a single proprietary format. It is important to note that with this reporting package, the reports are not output as true, native Excel. Furthermore, exporting capabilities are minimal at best. This reporting package also entails a significant learning curve prior to beginning any development efforts. ASP, C++ and VB developers will find that they are unable to carryover much of their programming knowledge and skills. ExcelWriter, in comparison, provides native Excel files (BIFF8) that are easily exported to Excel and other financial programs capable of working with this format. The object model is highly intuitive and extremely familiar to programmers who have worked with object oriented programming. ASP, C++ and VB developers will have no problem in applying their current skill set to building applications that include ExcelWriter. 43 8 Administration ExcelWriter, which consists of a single server-side DLL, offers ease of administration from the initial configuration installation process, and on the Web extending to server, the through upgrade or the Web application uninstallation process. In addition, for most typical usage scenarios for ExcelWriter, server-side security settings are simple to configure. 8.1 Security Considerations To understand the security of ExcelWriter it is necessary to have background knowledge in IIS and ASP security. In most cases where ExcelWriter is simply being used to stream files to a client machine or to return the resultant spreadsheet to memory, security context is not an issue. This is due to the fact that, in both of these cases, ExcelWriter does not write any intermediate files to the hard disk of the server. Since everything is performed in memory, security considerations are not relevant. The rest of modification generated this to section security spreadsheet deals with settings is special on written the to uses server. the hard of ExcelWriter This disk includes of the that the may case server and involve where the ExcelWriter functionality is used to open that pre-existing spreadsheet in order to extract data or reference image files for inclusion in the newly created spreadsheet in the server’s virtual memory. ASP provides three levels of authentication: • • • Anonymous Basic NT Challenge/Response When a user hits a Web page, the security of the page is verified. If there are no restrictions, such as NTFS permissions, anonymous access is used. When there are NTFS permissions in place, IIS will negotiate with the browser and determine if the user can be authenticated. IIS uses a special NT account, typically called “IUSR_MachineName”, as the default anonymous account. An administrator can change this default account. With IIS3, there was only one anonymous account for the entire server. With IIS 4 or later, it is possible to have different anonymous accounts for each virtual server or Web application on the server. With Basic and NT Challenge/Response, an authentication mechanism is in place that identifies the user who is requesting the page. With either Basic or NT Challenge/Response, IIS/ASP will actually perform an NT login for that specific user. This means that a given page is executing as a specific NT user: either “IUSR_MachineName” or the actual authenticated NT domain user. This technique is known as impersonation and is a standard feature of NT services. 44 This has strong implications for ExcelWriter if you are trying to save the generated spreadsheet on the hard disk of the Web server or to read in data or include images from files stored on the server. When ExcelWriter attempts to create, read or write files, it will be executing in the security context provided by IIS/ASP. If a non-authenticated user is creating a spreadsheet, ExcelWriter will only be able to extract data or include images from files or folders that are accessible to this “IUSR_MachineName” account with, at a minimum, “read” privileges. It will only be able to write the resultant Excel file to a folder on the Web server that has, at a minimum, “write” privileges for this account. If an authenticated user is creating a spreadsheet, ExcelWriter will only be able to write to locations determined by that specific user's NT domain permissions. The same obviously applies to attempts to extract and include data or images as noted above. For more information, see Microsoft KB Article Q207671 (http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q207671) 8.2 Configuring IIS ExcelWriter provides, as part of the integral “Save” method, an option to stream its newly generated Excel file to a client machine for viewing or saving locally. This can be in addition to or instead of saving the file to a location on the Web server. When streaming downloaded accomplished file files, ExcelWriter should simply by open using can be further directly in the the configured client “saOpenInPlace” to browser. option in specify This the is that the normally second input parameter of the “Save” method as follows: xlw.Save "report.xls", saOpenInPlace However, due to the diverse types and versions of browsers that are currently in use on prospective recipients’ machines, the browser does not always understand the “ContentType” of the file that it has received. Some browsers, rather than opening the file may, instead, pop up a “File Download” dialog box offering the user the option to launch the file in a new window with Excel. 45 If this behavior is inconvenient for the Web application, then the following method provides a simple “workaround” for browser inconsistencies that should guarantee that the spreadsheet will open directly in the browser window. To apply this workaround, you will need to, 1. Associate Excel's .xls extension with asp.dll when configuring your virtual directory: a. Open the Internet Services Manager. b. Right-click the virtual directory containing your ExcelWriter scripts, and select properties. c. Click Configuration. If the Configuration button is disabled, first click Create. d. Select the App Mappings tab. e. Click Add. f. Browse to select asp.dll, typically in c:\winnt\system32\inetsrv. g. Enter xls in the Extension text box. h. Select "All Verbs." i. j. k. 2. Do not Check "Script Engine." check "Check that file exists." Click Ok. Rename your ExcelWriter scripts with the extension .xls. For example, at the DOS command prompt, enter, "ren xlgen.asp xlgen.xls." do not If you associate the .xls extension with asp.dll within the settings of a virtual directory, save standard Excel spreadsheets in this directory. If you do, ASP will attempt to interpret these Excel spreadsheets as ASP script and will fail. 8.3 Installation / Uninstallation As noted earlier in this document, ExcelWriter can be installed in two ways: by running the automated installation that uses the Microsoft Installer (MSI), or by doing a manual installation. The automated installation is easiest to use and deploy. Simply double-click on the “ExcelWriterVxx.exe” file and follow the InstallShield Wizard instructions. For environments where server administration is strictly controlled, where auto- installers are disallowed, or where the minimal installation is required, the installation of ExcelWriter can be as easy as the simple copying of the ExcelWriter “SAEXCEL.DLL” to a properly secured folder on the server and registering it by means of the ExcelWriter was REGSVR32 utility. The upgrade and the uninstallation procedures are quite simple. If installed with the auto installer, simply use the “Add/Remove Programs” functionality of Windows to documentation unregister and samples. and If remove the ExcelWriter “SAEXCEL.DLL” and was all copied of to its the associated server and manually registered with REGSVR32, simply use this utility to unregister the .dll prior to removing it. Either uninstallation process should always version of ExcelWriter. 46 be employed prior to installing a newer 9 Case Studies 9.1 Manufacturing Company MAJOR MEDICAL MANUFACTURER INCREASES SALES BY IMPROVING CUSTOMER SATISFACTION AND INTERNAL COMMUNICATIONS USING EXCELWRITER OVERVIEW Customer: Major medical equipment manufacturer Hardware and Software: Server: Database: Clients: HP LC2000 NetServer/ Windows NT Server 4.0 Microsoft® Access 2000 150+ Internet Explorer IE 4.0, Windows NT 4.0 Business Situation: This global company needed a cost-effective, scalable, efficient reporting system for tracking and sharing customer information across departments. Solution: The company chose SoftArtisans ExcelWriter to build a dynamic reporting system on the Sales & Marketing intranet site. The server-side solution enabled them to move their system to the Web quickly and easily, and to continue using richly formatted Microsoft Excel spreadsheet and charts. Benefits: • • • • Leverage users' proficiency in Microsoft® Excel. Save months of development time. High performance and scalability. Sales force has critical customer information available 24 hours a day. COMPANY PROFILE The ExcelWriter customer is a worldwide leader in clinical measurement and diagnostic solutions that focuses on high-growth healthcare areas including portable diagnostic and monitoring related equipment, professional out-of-hospital services and support. defibrillators, To meet cardiology their sales products and and marketing objectives, the company required a cost-effective, scalable, efficient reporting system for tracking and sharing customer information across departments. They were effectively collecting hospital equipment inventory and obtaining industry market share information, but needed to improve efficiency in information for use across departments and regions. 47 updating and delivering current SITUATION To bolster a more proactive and targeted approach to their customers, the company realized that if up-to-date inventory and market share data was always available to sales representatives, the sales representatives would gain a better understanding of customers’ present and future needs. By qualifying and improving the sales approach, they could strengthen their leadership position and increase share in the high-growth U.S. market. The company's marketing department sought an affordable, efficient system for delivering current inventory and market share information to their sales force. They intranet track decided site. the The on an project, installed base online named of reporting the their application Competitive own and their for the Information Sales Matrix competitors’ & Marketing (CIM), patient would monitoring, ultrasound, and cardiology equipment at 6,800 U.S. hospitals. The sales tool would encourage more appropriate and useful recommendations to customers. SOLUTION The Best of Both Worlds: Easy for Development and Familiar to End-Users The marketing department’s Web programmer searched for a server-side solution that would provide dynamic reporting and charting functionality. Since the former reports were produced programmer in richly wanted to formatted recreate ® resource-hungry Microsoft Microsoft this Excel standard spreadsheets format on the and Web. charts, the Putting the Excel on the server was not an option; they might have 150 concurrent users and Microsoft Excel was too resource intensive. After considering other Web reporting and charting products, the programmer chose the full version of SoftArtisans ExcelWriter for the CIM project. He cites the following reasons for his decision: • ExcelWriter generates comfortable with native receiving Excel; this the sales information in force Excel was already spreadsheets familiar and and charts so there would be no need for training on new software. • ExcelWriter's high performance and scalability--hundreds of employees could access reports at once. • • ExcelWriter's logic integration for making "smart" spreadsheets. ExcelWriter provided a finished product--the sales force reacts positively to presentation-quality material. • • ExcelWriter was a cost-effective and flexible solution ExcelWriter was simple to use and the help documentation was easy to navigate and well organized. • The company was very pleased with the courteous and responsive service that they received from SoftArtisans sales and technical staff. This manufacturer is known for their dedication to innovative technology. SoftArtisans ExcelWriter was a perfect fit for the business problem at hand. 48 Charting a Course for Success The Web programmer developed the custom, real-time CIM reporting application with SoftArtisans ExcelWriter and some ASP script in a few short months. The inventory information that is collected by customer engineers continues to be entered into the Microsoft Access database. Now the database feeds the server-side application and the information is immediately available to the sales force across the country. The CIM intranet application keeps track of patient monitoring and ultrasound imaging systems and can be researched and understood by several different queries. These include a vendor display, information quantity, is an opportunity organized serial number, at the system display, hospital type, and a market department contact share level: person in display. equipment hospital Customer install date, department, and predominant vendor. The spreadsheets application is and queried charts it are uses the formatted current during data in development. the Access Each database time to the quickly populate the cells. The spreadsheets were designed with conditional formatting—color codes alert the employee to the most promising opportunities and high priorities in their district. Rather than receiving biannual reports, now employees serve themselves current information anytime. The CIM application dynamically presents information to employees function in the ® Microsoft format Excel that they are spreadsheets already and accustomed--richly charts. Sales formatted, representatives can full easily evaluate their local customers to plan an effective strategy. The polished reports do not lose any formatting and function if the user downloads the spreadsheet to the client machine. The sales person can further manipulate the data in Microsoft own machine those hospital for additional purposes--for departments that don't instance, always they have might ® Excel on their provide accessible, a service accurate to inventory records of their own. BENEFITS High Performance and Scalability SoftArtisans ExcelWriter is a scalable, high-performance solution. As the CIM project grows, the company is not limited on the amount of users or the amount of spreadsheets generated. There are no per-user costs with SoftArtisans. The intranet application was designed to strengthen their leadership, enter new areas of the market, and increase market penetration. The application is expected to provide invaluable sales support. It enables representatives to provide superior service, be attentive to customer’s needs and purchasing cycles, and increase business. The CIM application strategy. is The an important system has module been integrated previewed by with the overall marketing and sales was and met marketing with much enthusiasm. The company will measure the success and return on investment by how much the sale force accesses and uses the CIM system. The company anticipates that the improvements in customer service and substantial impact on sales. 49 internal information sharing will have a 9.2 B2B E-commerce Company FAMILIAR EXCEL REPORTS ENABLE PORTUM TO INCREASE B2B WEB APPLICATION ADOPTION RATE AMONG PROCUREMENT MANAGERS SoftArtisans ExcelWriter allows Portum to present data in a format (Excel) that is familiar and easily manipulated by non-technical users of the Portum Auction and Request for Quotes System. OVERVIEW Customer: Portum AG is a neutral B2B intermediary, providing strategic procurement and negotiation solutions for enterprises and marketplaces. Hardware and Software: Server: Database: Clients: Windows 2000 ExcelWriter FileUp SQL Server 2000 Excel 97 Excel 2000 IE4.x+ Netscape 4.0 + Business Situation: Portum needed fast, full function, formatted Excel activity reports generated from the Web without Microsoft Excel installed on the server. The Portum Internet Trading Platform (ITP) combines the Portum Auction Engine and the Portum RfX-Engine with training, a customer care team and integration services. The ITP supports the complete procurement process. It starts with supplier identification, request for information/ quotation, and the online negotiation. In addition, the Portum BidXchange can be used for contract and data transmission. Solution: Portum now uses SoftArtisans ExcelWriter as part of the Portum Internet Trading Platform hosted on their Extranet. This application is one of Portum’s main product offerings. ExcelWriter is used to generate the activity reports for procurement managers who use Portum’s product. Because most procurement managers have been using Excel for years, ExcelWriter’s ability to generate native Excel workbooks is a major benefit of the application. Benefits: • • • • • Complete Excel-generating application development in one month. Enable procurement organizations to interact with suppliers in real time, increase the competition, and reduce product costs. Standardize and automate routine procedures. Reduce time required for negotiations and contract awarding. Enable procurement managers to make targeted and objective purchasing decisions. 50 COMPANY PROFILE Portum is Europe’s leading neutral intermediary and provider for strategic sourcing and negotiation solutions for enterprises and marketplaces. Through a combination of easyto-use while consulting buyers state-of-the-art and and business sellers in Internet-based services, the Portum strategic applications increases sourcing and and the tailor-made performance procurement first-class of process. industrial The product offering includes online auctions and Internet based request-for-quotations (RFQs). SITUATION Portum’s reports product to users usually procurement are managers procurement managers. Portum delivers activity through Web. activity reports include the The complex formulas and formatting—and could be accessed by thousands of concurrent users. Because of the wide use of Microsoft Excel among procurement managers, Portum decided that their Web application should generate activity reports in Microsoft Excel format. Many procurement managers are not familiar with the technical part of Internet business transaction methods, but would be comfortable using Excel. SOLUTION Portum included considered Crystal ExcelWriter. several techniques Reports, ExcelWriter Microsoft was the only of generating Office Web solution that Excel on a Components, provided a Web server. and means These SoftArtisans for fast, full- function dynamic native Excel reports with licensing freedom and high performance for thousands of concurrent users. For the past seven months, Portum has been using SoftArtisans ExcelWriter as part of the Portum Internet Trading Platform (ITP) hosted on the Portum Extranet. ITP is one of the main product offerings of Portum and is critical to their business. SoftArtisans ExcelWriter is used to generate the activity reports for procurement managers who use Portum’s product. Portum believes that the ability to generate activity reports in fullfunction native Excel contributes to the adoption of their Web solution. Most procurement managers have been using Excel for years. Each day, the Portum ITP solution generates an estimate of 200 different reports for more than 5,000 suppliers across the globe in various industries. The reports are streamed to users’ client machines via a browser, into Excel. The activity reports that Portum generates with ExcelWriter are sometimes 50-sheet workbooks. Some of the Excel features that the activity reports use include advanced Excel formatting—font, cell, colors etc. ExcelWriter exposes the most Generation of reports is fast and consumes common Excel objects minimal server and functions. resources. Portum has ExcelWriter running on three servers. Portum is also using SoftArtisans FileUp product in order to upload auction documents. BENEFITS Easy-to-use Web Application Increases Portum Product Adoptions Because of users’ familiarity with Excel, SoftArtisans ExcelWriter contributes to the overall adoption and success of the Portum ITP product. Customers can access activity reports via the Portum extranet any time. 51 There is no need for users of the Portum ITP solution to be trained on new software— they have been using Excel for years and prefer to receive activity reports in this familiar format. Simplified, Accelerated Development With SoftArtisans ExcelWriter, Portum was able to build this functionality into their application within only a month of one developer’s time. SoftArtisans customer service and support have impressed them. “We are very pleased with the close--almost personal--support provided us during the early period of adoption. We are especially grateful for assistance given us when we encountered some difficulties supporting generated Excel files in different languages. Within two days, we were able to obtain a fix from a very helpful Technical Support person from SoftArtisans.” - Arial Sagum, Web Project Manager, Portum AG 52 9.3 Destination Hardware Sales and Manufacturing Company YAKIMA WEB TEAM CUTS REPORTING DEVELOPMENT TIME BY 75% USING SOFTARTISANS EXCELWRITER OVERVIEW Customer: Yakima Products Arcata, CA Hardware and Software: Server: Database: Client: Windows 2000 SQL Server 2000 Excel 97, 2000, XP IE and Netscape Business Situation: Yakima's Fit Team needed a cost-effective, efficient Web reporting system that would allow them to quickly access modify and share reports in the familiar Microsoft Excel format. Solution: Yakima used SoftArtisans ExcelWriter to build a dynamic reporting system for their Intranet. Their new reporting solution enabled the Fit Team to have a self-service reporting application without having Microsoft Excel or space-intensive files sitting on the server. Benefits: • • • • Saved weeks of in-house development time High user satisfaction due to familiar, flexible, easy to use Microsoft Excel format Reporting system is self-service and is available to users 24 hours a day High performance and scalable system COMPANY PROFILE Yakima builds the highest quality products for the enthusiast heading out to their favorite outdoor destination. For years, Yakima has been known as a rack company, but their thirst for new products has helped them grow into a Destination Hardware™ company. All of Yakima's products incorporate characteristics that define the company: security and a playful attitude. 53 SITUATION At Yakima, the Fit Team is charged with assuring there is a Yakima rack product that fits every make and model of vehicle. In order to accomplish this, the team must access a mass of data about vehicles and about their own products. The team originally entered all of their data into Excel manually, which was very time consuming. In an attempt to make the Fit Team's reporting more efficient and manageable, Yakima's Web Development team tried to create a solution in Web format, but viewing the data in HTML did not meet the reporting needs of the Fit Team. The team needed to manipulate the data to make it useful, so they were forced to cut and paste the data from the HTML format into Excel, which is a very messy and time consuming process, during which formatting is lost. Yakima needed a better way to provide a link between the data on their server and a familiar and flexible presentation format for the enduser. SOLUTION Yakima looked at several possible solutions to solve their reporting problem. One option was a large reporting product, which was very expensive and provided many extraneous features that Yakima would never use. Then, the development team tried to make use of macros to pull the data into Excel, but due to the complicated masses of data involved in the Fit Team Reports project, macros were not an optimal solution. After a comprehensive evaluation period, Yakima purchased ExcelWriter. The development team was impressed with the online documentation; ease of application development and by the personal support that backs every SoftArtisans product. They found that it was easy to integrate their existing database with ExcelWriter in order to produce with. the The flexible Fit Excel Team output users that their appreciated end-users the were one-click accustomed to fully to working formatted, easily customized, native Excel spreadsheets. BENEFITS SoftArtisans proved development team to be was a able very to reliable pull large solution from quantities of the very first complicated report. data from The their database and create robust, fully editable Excel reports. The Web Team at Yakima, consisting of one developer/manager and one full-time developer, estimated that the Fit List Reports project would take two developer-weeks to complete. With ExcelWriter, it only took the team two to three development days to complete the project. With the time and development ExcelWriter tool paid resources for itself. that Yakima Yakima saved plans to in use their very first ExcelWriter for project, many the other projects. The high-performance, multi-threaded ExcelWriter dynamic link library (DLL) allowed Yakima to save space and to ensure reliability on their production server. They have found that ExcelWriter serves native Excel reports with charting, formatting and formulas quickly and efficiently. The CodeWizard, included with ExcelWriter, also helped Yakima in their development. It allowed them to take existing Excel spreadsheets and create ASP code needed for their ExcelWriter formatting that application. the Fit Team Not had only did this allow already put into accelerated the development process. 54 them past to Excel capture reports, the but existing it also Now that the Fit Team Reports project is completed and other teams within Yakima have seen how fast and easy the reporting process is, they are asking the development team to create ExcelWriter applications for their departments. For Yakima, SoftArtisans ExcelWriter is the Web reporting solution of choice. Yakima Web Application With and Without ExcelWriter ExcelWriter Time to Complete Without ExcelWriter 2.5 Development Days (Resulting 10 Development Days (Resulting in in dynamic Microsoft Excel reports) static HTML reports) Development Cost (Dev. Days * 2 Developers * Industry Avg. $2,000 Salary) Report Format Flexibility All Microsoft Excel functionality $8,000 Inflexible HTML format "ExcelWriter allows any type of data to be displayed countless ways due to the flexibility of Excel being the output. Finally, database information can be arranged in an exciting and fresh way that doesn't require a lot of development time." —Tyler Thompson, Web Systems Manager, Yakima “ExcelWriter saved a lot of time because it allowed us [Web developers] to create a report quickly that was easily manageable by the end user. No longer did we have to create preformatted static Web-based reports, but instead were able to create dynamic and ever-changing Excel files.” — Brett McKinney, Web Programmer, Yakima 55 10 Performance 10.1 Benchmarks ExcelWriter Object (V2) versus Excel Object Office 2000 CRITERIA: Test variables: • • • Number of files Number of rows Number of columns Process: • • • • • Start time is recorded Iteration starts Files created based on number of files, rows and columns specified At the end of the iteration the time is recorded, equated from start time Created files are kept in folder relational to application Characteristics: • • • Two sheets per file One font per sheet applied Italic, Bold and Horizontal alignment applied to first sheet Two Styles (objects) are used with ExcelWriter. Within the styles, the font and other characteristics are applied. The style is assigned after the value is set to the cell. When creating spreadsheets using the Excel object, the font and characteristics are applied after the value is set to the cell. NOTE: HARDWARE: • • • • Operating system: Windows 2000 Server SP1 Processors: 2 x 700Mhz Memory: 128 Megs Make: Dell PowerEdge 1300 56 TEST RESULTS: Number of Files: 25 Number of Rows: 50 Number of Columns: 50 ExcelWriter: Time elapsed: Excel object: Time elapsed: Results: 9 seconds 16 min 24 seconds ExcelWriter is over 100 times faster than the Excel Object. 10.2 Scalability ExcelWriter consists of a single "SAEXCEL.DLL" installed on the server that is used to generate Excel reports. ExcelWriter is a high-performance, multi-threaded COM object built for serving thousands of concurrent users on a single server. 10.3 Performance Limitations 10.3.1 ExcelWriter LE In ExcelWriterLE, a maximum limit of 200 new workbooks can be generated during the twenty-four hour period that commences with the creation of the first spreadsheet. With subsequent requests for new spreadsheets, ExcelWriter will display a message that advises that the daily usage limit has been reached. The counter will be reset at the conclusion of this period. This limitation does not exist in the Server edition. 10.3.2 ExcelWriter Developer As noted earlier, both the ExcelWriter Developer and the ExcelWriterLE Developer versions offer the full capabilities of the corresponding ExcelWriter Server and ExcelWriterLE versions with one important exception: Developer versions are singlethreaded models and as such cannot process more than a single report request at one time. This is typical of the development environment and should not pose a problem unless stress testing is required. (In this case, it is possible to secure a full-functional multi-threaded evaluation version by contacting [email protected]) 10.3.3 ASP Threading Although ExcelWriter is capable of handling large numbers of concurrent requests for report generation, the ASP threading model that is part of IIS is still subject to the limitations. If the Web application that includes the ExcelWriter object is running on an IIS 4 server, the default (“AspProcessorThreadMax”) setting for the ASP set to is maximum a default number value of of “10”. available With IIS threads 5, the default setting is “25”. It’s important to understand that this setting can dramatically influence the scalability of Web applications, and the performance of the server in general. Since it defines the maximum number of ASP requests that can execute simultaneously, it can inhibit the performance of ExcelWriter, when used in high volume applications. 57 . If required, the value of “AspProcessorThreadMax” setting can be increased This will allow the server to create more threads to handle more concurrent requests. (Please note: If this metabase property is changed, the Web server instance must be stopped and restarted in order for the change to take effect.) Details on this setting are available at: http://msdn.microsoft.com/library/default.asp?url=/library/enus/iisref/html/psdk/asp/apro0blk.asp. 10.4 Improving Performance There are some important pointers to be aware of when attempting to maximize the performance of ExcelWriter in creating Excel files. 10.4.1 Using Styles Microsoft unique Excel formats includes contains and an styles upper limit available to 4096 of an 16 built-in and six default formats. on individual the total Excel combined File. This This further reduces to number "cap" 4074 of of 4096 the available number of total combined formats and styles available to the developer formatting an Excel file with ExcelWriter. ExcelWriter itself poses no such limitations in the creation process. It allows the creation of Excel files that can contain unlimited numbers of unique formatting. Since ExcelWriter output can be richer than Microsoft Excel is capable of reading, a common error that developers may experience when attempting to open ExcelWriter generated files with Microsoft Excel is as follows: SoftArtisans.ExcelWriter.1 error '80020009' Number of formats has exceeded Excel's limit Because of this Excel limitation, it is imperative that, when using ExcelWriter to format a native Excel understanding file of on the the fly with server-side repercussions of ASP choosing code, to the employ developer has "Cells.Format" a clear versus "Cells.Style". Attempting to format large numbers of cells by applying “Cells.Format” via looping often causes the error above, as the following sample illustrates: <% '--- Convert Recordset output to Spreadsheet input and '--- Import the data in one step, pasting from cell (2,1) with the headers appearing ‘--- in row 2 FirstRow = 2 FirstCol = 1 NumRows = cells.CopyFromRecordset(oRs, True, FirstRow, FirstCol) '--- Format, on a cell by cell basis, all rows in column 1 to "text" and all rows in '--- column 2 to "currency" 58 For r = FirstRow +1 to NumRows +2 ‘--- This value formats a cell as text ws.cells(r, FirstCol).Format.Number = 49 ‘--- This value formats a cell as currency ws.cells(r, FirstCol +1).Format.Number = 7 next %> By employing this formatting method, you will use up the pool of available formats quickly since the application of format to each cell counts as a unique instance of a format. When Excel files are created directly with Excel, the application of formatting is subject to a built-in optimization process. That makes a comparison of included formats and removes identical format objects. ExcelWriter currently does not include this same optimization technique. Currently, to avoid bumping up against this format limit, it is suggested that ".Style" be used in place of ".Format" wherever possible when applying formats to more than a single cell. A single custom style can be created and then applied to an entire row or column instance of cells of by means formatting of looping. when This considered unique style toward will the then total count as available a single pool of formats/styles. Here is a reworking of the previous formatting sample to employ a custom "TextStyle" and "CurrencyStyle" to format multiple cells: <% '--- Convert Recordset output to Spreadsheet input '--- Import the data in one step, pasting from cell (2,1) ‘--- with the headers appearing in row 2 FirstRow = 2 FirstCol = 1 NumRows = cells.CopyFromRecordset(oRs, True, FirstRow, FirstCol) '--- Create a custom Font to be used in formatting the worksheet Set Font1 = XLW.CreateFont Font1.name = "Times New Roman" Font1.size = 10 '--- Create a custom "TextStyle" which will format ‘--- cells as "text" Set TextStyle = XLW.CreateStyle TextStyle.Number = 49 TextStyle.Font = Font1 '--- Create a custom "CurrencyStyle" which will format ‘--- cells as "Currency" Set CurrencyStyle = XLW.CreateStyle CurrencyStyle.Number = 7 CurrencyStyle.Font = Font1 59 '--- Use looping to apply the custom styles ‘--- rows in column 1 and column 2 For r = FirstRow +1 to NumRows +2 ‘--- This value formats a cell ws.cells(r, FirstCol).Style = ‘--- This value formats a cell ws.cells(r, FirstCol +1).Style Next %> Please note: If you change any properties of your to all as text TextStyle as currency = CurrencyStyle custom style after making application of this style, all cells formatted with this style in your worksheet will be changed accordingly. Figure 4: Resulting spreadsheet for Style sample 60 10.4.2 Use CopyFromRecordSet or GetDataFromRecordset With ExcelWriter, ADO can be used to return a recordset from a datasource and the included field values and headers (optional) can then be imported into the Excel file that is being created. In cases where the recordset contains a rectangular block of data that could simply be pasted into the worksheet as it comes from the database, consider the following: ExcelWriter offers two very important one-step methods for copying a block of data held in the recordset object and pasting it to a specific location in the worksheet that is being built up in virtual memory on the server. The first method: worksheet, “CopyFromRecordset” including field headers is used (unless to import otherwise the recordset specified), and into to the return “NumRows”, the total number of rows that were imported. This “NumRows” value is extremely useful for such purposes as moving around the virtual worksheet in order to apply formatting to all data-filled cells in a column or locating the row that follows the end of the recordset so that formulas can be inserted as totals. “CopyFromRecordset” is used as follows: NumRows = cells.CopyFromRecordset(ADO-RecordSet, [ShowHeaders (True/False)][FirstRow], [FirstColumn], [MaxRows], [MaxColumns]) The first parameter contains a pointer to the recordset object that has been returned via ADO. This is the only required parameter. The Recordset’s Field headers will be imported unless “False” is added as a second parameter (the default is “True”). The next four optional parameters are used to specify the exact location to where the imported data will be pasted as well as how may rows and columns of data will be imported. The second method: “GetDataFromRecordset” is almost identical to the above method with one important exception. This method returns a “Range” object instead of a variable that relates the number of records returned. This “Range” object can then be auto-formatted for column width using the “Range.AutoFitWidth” method so that each column will be correctly adjusted to fit the data that is contained in the cells in that column. “GetDataFromRecordset” is used as follows: Range = cells.GetDataFromRecordset(ADO-RecordSet, [ShowFieldNames (True/False)][FirstRow], [FirstColumn], [MaxRows], [MaxColumns]) As with the previous method, the first parameter contains a pointer to the Recordset Object that Recordset’s has Field been returned headers will via be ADO. This imported is the unless only required “False” is parameter. added as a The second parameter (the default is “True”). The next four parameters are “CopyFromRecordset” method. the same as the optional parameters in the They are used to specify the exact location to where the imported data will be pasted as well as how may rows and columns of data will be imported. 61 11 Technical Support SoftArtisans Technical Services team and resources are among the best in the industry. Contact SoftArtisans by e-mail or telephone: • Send e-mail to [email protected]. Each incoming e-mail is assigned a unique tracking number. • By telephone: In the U.S. call toll-free 1-877-SOFTART (763-8278), and press “3” for Technical Support. Outside the U.S., call +1-617-738-0777, and press “3” for Technical Support. We are able to solve your problem more rapidly if you submit the following information with your problem report: • The name of your product (e.g., SoftArtisans ExcelWriter) • The exact version of the DLL (e.g., saexcelwriter.dll) • The exact version of the ASP.DLL • The exact version of the operating system and browser on client machine(s). • The exact version of the operating system and IIS that are running on the server, including any service packs. • The ASP scripts that you are using including both the form and the form processing scripts, if they are in separate files. • The exact error message that is received. • A description of the exact nature of the problem, including when in the process that the problem occurs. • Are you running samples or your own code? • Your order number, if you have one. Free Support Our dedicated and quick responding support team is happy to answer your e-mail and telephone inquiries on an as-available basis. Support is usually able to respond in less than one or two days, however there is paid, guaranteed priority support if you have an urgent issue. 11.1 Pre-sales Support Our sales engineers are eager to provide sales consultations to help you determine which ExcelWriter solution is right for you and get you started on your evaluation of the product. ExcelWriterFree is available for download on the SoftArtisans Web site. If you would like to evaluate a full version of ExcelWriter, please contact [email protected] and we will be happy to provide the full evaluation for you. 62 11.2 Maintenance Program ExcelWriter ExcelWriter ExcelWriter priority annual maintenance customers. releases support for Annual one incidents program year with is now maintenance a from available includes maintenance guaranteed to our free purchase response existing major date within one and new upgrades and on three business (3) day. ExcelWriter annual maintenance cost is 20% of the product list price. For example: • If you purchased an ExcelWriter 1.0 server license, the cost for annual maintenance would be $999. • If you purchased a 1-CPU ExcelWriter server license, the cost for annual ExcelWriter server license, the cost for annual maintenance would be $500. • If you purchased a 4-CPU maintenance would be $2,000. Please contact SoftArtisans today! By e-mail: [email protected] or telephone: 877-SOFTART or 617-738-0777. 11.3 Two-hour Priority Support Incident For each within purchased two business two-hour hours of support placing incident, your call SoftArtisans or sending guarantees your e-mail. a response There is no guarantee that we will be able to provide an immediate resolution of your problem, but we will work on it until we can come to a conclusion. We will always provide you an expected date to issue you a patch if necessary. You may purchase a two-hour priority support incident at http://www.softartisans.com/softartisans/tecsup.html 11.4 24-hour Priority Support Incident For each within purchased one business 24-hour day of support placing incident, your call SoftArtisans or sending guarantees your e-mail. a response There is no guarantee that we will be able to provide an immediate resolution of your problem, but we will work on it until we can come to a conclusion. You may purchase a 24-hour priority support incident at http://www.softartisans.com/softartisans/tecsup.html 11.5 Support Hours SoftArtisans Technical Support hours are Monday through Thursday 9:00 a.m. to 5:30 p.m., and Friday 9:00 a.m. to 4:30 p.m. Eastern Time (GMT-5 hours) 63 11.6 Self-help Support Many questions are quickly answered with SoftArtisans comprehensive support http://support.softartisans.com/. There you will find SoftArtisans products site, latest documentation, an extensive knowledge base, and frequently asked questions. 11.7 Peer-supported Discussion List Join the SoftArtisans Peer Supported Discussion List for ExcelWriter! http://discuss.softartisans.com/archives/xlw-l.html SoftArtisans offers product-specific peer support discussion lists as a great resource while you are evaluating software or developing your application. Get help from other developers using SoftArtisans ExcelWriter. This list is monitored, but not edited or reviewed, by SoftArtisans Technical Staff. SoftArtisans Technical Support will help out on an as available basis. The names of the subscribers of this list are kept confidential. 11.8 SoftArtisans Consulting Services Our skilled Web developers can assist you in developing applications that use SoftArtisans components. Our consulting service takes full of advantage of our expertise and can save you valuable time and resources. Technical representatives will provide the following services for licensed or presales customers developing Web applications for the Windows/IIS platform with ASP, ASP.NET and VB. Scope of Consulting Services For an hourly fee, SoftArtisans can provide consulting and development services for Web applications that use SoftArtisans products: • Debug any part of an application. • Write sections of code for use in a Web application. • Write entire Web applications. • Provide in-depth consultation on Windows administration and security. Please contact SoftArtisans Technical Support and Services to discuss your project: By e-mail: [email protected] By telephone: In the U.S., call toll-free 1-877-SOFTART (763-8278), and press "3" for technical services. Outside the U.S., call +1-617-738-0777, and press "3" for technical services. 64 12 For More Information 12.1 SoftArtisans Web Sites 12.1.1 Main ExcelWriter Page The main ExcelWriter page can be found at: http://www.softartisans.com/excelwriter.html 12.1.2 News and Announcements SoftArtisans maintains a monthly newsletter detailing new versions, tips, tricks and special promotions. The newsletter can be found at http://discuss.softartisans.com/archives/newsletter.html Subscribe by sending an email message to [email protected] with the following command in the BODY of your email message: SUB NEWSLETTER There is also a separate mailing list specific to ExcelWriter announcements that can be found at: http://discuss.softartisans.com/archives/excelwriter-ann.html 12.1.3 Support Site Self-service technical support, including a searchable knowledge base and Frequently Asked Questions (FAQ) can be found at: http://support.softartisans.com/ 12.1.4 Demo Site SoftArtisans maintains a comprehensive live demo site. It is regularly updated with new and interesting samples. All the source code to the live demos can be downloaded as well: http://demo.softartisans.com/ 12.1.5 Discussion Lists In addition to technical support provided by SoftArtisans, there is a peer-supported discussion list for ExcelWriter technical issues: http://discuss.softartisans.com/archives/xlw-l.html 65 12.2 Excel on the Web 12.2.1 Microsoft Excel Web Site http://www.microsoft.com/office/excel/default.htm 12.2.2 EXCEL-L Discussion List Excel Developer's Mailing List http://eva.dc.lsoft.com/archives/excel-l.html 12.3 ASP Sites 4 Guys from Rolla http://www.4guysfromrolla.com/ Wrox’s ASPToday http://www.asptoday.com/ 66 13 Other Products from SoftArtisans If you are new to SoftArtisans (http://www.softartisans.com/), you may be interested in some of our other Web server controls. SOFTARTISANS ASPSTUDIO Power Pack of Active Server Controls SoftArtisans ASPstudio is the best-selling value pack of powerful server controls designed for rapid Web application development and deployment. This comprehensive Web developers package combines the industry's most popular and powerful controls into a complete solution-at a tremendous saving. The ASP Guild International recognized ASPstudio with the prestigious Top Tool 2000 award. ASPstudio provides the simplest and fastest means to producing robust scalable Web applications. Quick development return on cycles, increased investment. This productivity, suite includes and the lower highest costs provide quality an controls immediate to help you manage all the functionality you need--file transfers, transactional file management, system administration, data validation, and Web-based email. Along with the excellent product documentation and an extensive knowledge base, a dedicated and quick- responding technical team supports ASPstudio products. All SoftArtisans products are backed with a 30-day guarantee and all minor releases are free. ASPstudio includes the following SoftArtisans components: • • • • • • • • SoftArtisans FileUp SoftArtisans JFile SoftArtisans XFile SoftArtisans Check SoftArtisans FileManagerTX , the standard in file upload and secure download. , for Java-based file uploads and downloads. , for ActiveX file uploads and downloads. , for complete form validation. SoftArtisans Admin SoftArtisans Archive SoftArtisans FileManager SoftArtisans SMTPmail SoftArtisans ImgWriter , for transactional file management. for NT system administration. , for creating and extracting ZIP and CAB archives. , providing all of your file management needs in a single, easy-to-use component. • • to send e-mail from any client. for image processing, creation, management and caching. SOFTARTISANS FILETRANSFER BUNDLE • SoftArtisans FileUp • SoftArtisans JFile • SoftArtisans XFile SOFTARTISANS .NET INITIATIVE SoftArtisans POP3 for .NET SoftArtisans TreeView for .NET includes the following components: , the standard in file upload and secure download. , for Java-based file uploads and downloads. , for ActiveX file uploads and downloads. : • • to retrieve e-mail from any POP3 server to easily navigate your .NET Web site For more information about SoftArtisans ExcelWriter, ASPstudio, or .NET products, visit the SoftArtisans Web site at http://www.softartisans.com/. 67 www.softartisans.com 1330 Beacon Street, Suite 400 Brookline, MA 02446 Toll Free (US only): 1(877)SOFTART - International: 1(617)738-0777 - Fax: 1(617)738-6278