Microsoft KB Archive/262827

= FILE: OWCHelpr.exe Demonstrates Automation to Excel for Printing a PivotTable Component on a Web Page =

Article ID: 262827

Article Last Modified on 8/23/2005

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition
 * Microsoft Office PivotTable Component 9.0 1.0

-



This article was previously published under Q262827



SUMMARY
OWCHelpr.exe is a sample that illustrates how you can use Automation to Microsoft Excel to print a PivotTable component on a Web page. OWCHelpr.exe contains an ActiveX DLL that copies a PivotTable to the clipboard, pastes it to a new Microsoft Excel workbook, and formats the workbook for printing.

OWCHelpr.exe is a sample that demonstrates how you can overcome some of the printing limitations you might encounter while printing a PivotTable component from Internet Explorer. A common problem is printing a PivotTable that is wider than the width of a page; in this situation, the portion of the PivotTable that exceeds the page width is often omitted in the printed output. You can avoid this by using Automation to Excel to print the contents of the PivotTable.

NOTE: For your clients to use this helper DLL for PivotTable printing, they must have Microsoft Excel installed.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

OWCHelpr.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

Files Included with OWCHelpr.exe
OWCHelpr.exe contains the following files:
 * The Source files for the OWCHelper ActiveX DLL: OWCHelper.vbp and XLPrint.cls
 * An Internet Package for the OWCHelper ActiveX DLL: OWCHelper.cab
 * A Sample Web Page: PrintPivotInXL.htm

How to Use the Sample Files
The sample Web page (PrintPivotInXL.htm) that is included with this download illustrates how you can use the OWCHelper ActiveX DLL from a Web page containing a PivotTable component. The steps below walk you through a demonstration by using the sample Web page:
 * 1) Create a new folder named OWCHelper on your Web server. (Note: The Web server root is C:\Inetpub\wwwroot, by default.)
 * 2) Download and extract the contents of OWCHelpr.exe to the folder you created.
 * 3) Start Internet Explorer and navigate to:

http://ServerName/OWCHelper/PrintPivotInXL.htm

(where ServerName is the name of your Web server). A Web page containing a PivotTable is rendered.
 * 1) Filter, expand, or collapse fieldsets in the PivotTable on the Web page as you want.
 * 2) Select either the Portrait or Landscape option for the page orientation.
 * 3) Click Print or Print Preview.
 * 4) * If you click Print, the OWCHelper ActiveX dll transfers the contents of the PivotTable to a new Excel worksheet and then prints the worksheet. Excel is not made visible and quits when the print job is complete.
 * 5) * If you click Print Preview, the OWCHelper ActiveX dll transfers the contents of the PivotTable to a new Excel worksheet and the worksheet is displayed in print preview mode. In print preview mode, you can make changes to the page setup for the worksheet if you want. With Excel page setup, you can choose settings to scale the data to fit the page width, you can change the margins, or you can add page headers and footers. When you close print preview (or print the document), the worksheet generated by the OWCHelper ActiveX dll is displayed in Excel.

Additional Notes
If you prefer, you can incorporate script directly on your Web page that enables you to accomplish printing with Excel in much the same way as does the OWCHelper ActiveX DLL. However, because Microsoft Excel is an Automation server that is not marked safe, clients might receive a security warning when viewing your Web page. By using an ActiveX DLL to perform the Automation to Excel, you can avoid this warning.

The .cab file included with this download was packaged using the Package and Deployment Wizard that ships with Microsoft Visual Studio 6.0. It is marked Safe for Scripting and Safe for Initialization.

(c) Microsoft Corporation 2000, All Rights Reserved. Contributions by Dave Stearns, Microsoft Corporation.

