Microsoft KB Archive/184949

= ACC97: Report May Lose Formatting When Output to HTML =

Article ID: 184949

Article Last Modified on 1/22/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q184949



Advanced: Requires expert coding, interoperability, and multiuser skills.



SYMPTOMS
When you save a Microsoft Access report to HTML format, the following problems may occur:
 * Column headers and fields may not be aligned in the same manner as in the original report.
 * OLE Objects (such as images) and lines are not present in the output.



CAUSE
Column alignment of the output can be affected by the interaction of a number of factors, including the following:
 * The TextAlign property of the text boxes in the detail section and those in the header section of the report.
 * The CanGrow and CanShrink properties of the text boxes and the detail section of the report.
 * The WindowState property of the browser.

When you save a report to HTML format, the following report controls do not appear in the resulting file:
 * Lines
 * Rectangles
 * OLE objects
 * Subforms



RESOLUTION
Save the report as a snapshot, and embed the Microsoft Snapshot Viewer ActiveX control in a Web page to display the report.



MORE INFORMATION
In order to save a report as a snapshot, you must install the Microsoft Office 97 Service Release 1 (SR-1) or Microsoft Office 97 SR-1 Enterprise Update.

For information about obtaining Microsoft Office 97 SR-1, please see the following article in the Microsoft Knowledge Base:

172475 OFF97: How to Obtain and Install MS Office 97 SR-1

To install the Snapshot Viewer ActiveX control, download the Snapshot Viewer from Microsoft's Web site.

For information about obtaining the Microsoft Snapshot Viewer, please see the following article in the Microsoft Knowledge Base:

175274 ACC97: Microsoft Snapshot Viewer Available in Download Center

The following steps demonstrate how to save a report as a snapshot and then use the Microsoft Snapshot Viewer ActiveX control to display it on a Web page. Note that the browser in which you open the Web page must support the display of ActiveX controls.

NOTE: Microsoft Product Support Services does support modification of HTML files created by Microsoft Access, Microsoft FrontPage, or any other application that generates HTML.

For more information about writing HTML, please visit Microsoft's Web site at:

http://msdn.microsoft.com/library/

WARNING: ANY USE BY YOU OF THE HTML PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this example "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

 In the Database window, select the report that you want to save to HTML format, and then click Save As/Export on the File menu. In the Save As dialog box, click To An External File or Database, and then click OK. In the Save Report dialog box, select Snapshot Format (*.snp) in the Save As Type box. Save the Snapshot to a location on the Web server. Locate the Snapshot Viewer Control file, Snapview.ocx, in the \Windows\System folder (or in the \Winnt\System32 folder if you are using Microsoft Windows NT).</li> Copy Snapview.ocx to a folder on the Web server.</li>  Open the Web page in an HTML editor. To embed the Snapshot Viewer control on the Web page by using the HTML Object tag, insert the following code:

<object CLASSID="CLSID:F0E42D60-368C-11D0-AD81-00A0C90DC8D9" width="100%" height="100%" CODEBASE="http://WEBSITE/LOCALCONTROLS/snapview.ocx"> <param name="_ExtentX" value="16722"> <param name="_ExtentY" value="11774"> <param name="_Version" value="65536"> <param name="SnapshotPath" value="http://WEBSITE/REPORTS/REPORTNAME.snp"> <param name="Zoom" value="0"> <param name="AllowContextMenu" value="-1"> <param name="ShowNavigationButtons" value="-1">

You can also embed the Snapshot Viewer control by using Microsoft ActiveX Control Pad, and you can use the ActiveX Control Editor to set the control's parameters.

For more information about the ActiveX Control Pad and developing Web pages with ActiveX controls, please visit the following Microsoft Web site:

http://www.microsoft.com/workshop/author/cpad </li> In the code in step 7, change

http://WEBSITE/REPORTS/REPORTNAME.snp

to the URL for the location of the snapshot file you saved in step 4. For example, if you saved your report in a folder called Test in the wwwroot folder of your Web Server, this URL is:

http://%3Cservername%3E/test/reportname.snp</li> In the code in step 7, change

http://WEBSITE/LOCALCONTROLS.snapview.ocx

to the URL for the location to which you copied Snapview.ocx in step 6.</li> Save the changes that you have made to the Web page.

Note that when you open the Web page in a browser, the formatting and controls that existed in the original report appear as expected.</li></ol>

<div class="references_section">