2011-07-23 43 views
6

当我使用导出到html函数与报表时,Access生成多个html页面(每个页面大约有30行左右的数据)。如何将报告导出为一个单一的html文件?

如何强制Access为整个报表生成一个单一的html文件?谢谢。

+0

您是否尝试过构建查询,然后将其导出为HTML?结果将是一个HTML表格,并且没有分页符和只有一个文档。 –

回答

1

无法完成。纸张尺寸必须根据打印机驱动程序进行设置。即使页面设置中存在此选项,Access也不允许使用用户定义的纸张大小。

3

我创建了一个可能有助于他人的功能。它需要一个文件路径,然后遵循链接,直到文档完成。您需要将报告导出为HTML文件,然后在该功能中使用该路径。我用它为Outlook创建消息。 这需要Windows脚本宿主对象模型

Public Function fReadFile(strFile As String) As String 
On Error GoTo ErrHandler 

Dim FSO As FileSystemObject 
Dim tsInput As TextStream 
Dim strLine, strMessage As String 
Dim strNextFile As String 
Dim blnEnd As Boolean 

Do While Not blnEnd 
    Set FSO = New FileSystemObject 
    Set tsInput = FSO.OpenTextFile(strFile, 1) 
    Do While Not tsInput.AtEndOfStream 
     strLine = tsInput.ReadLine 
     If InStr(1, strLine, ">First<", vbTextCompare) > 0 And InStr(1, strLine, ">Previous<", vbTextCompare) > 0 And InStr(1, strLine, ">Next<", vbTextCompare) > 0 And InStr(1, strLine, ">Last<", vbTextCompare) > 0 Then 
      Debug.Print strLine 
      strNextFile = Mid(strLine, InStr(1, strLine, ">Previous</A> <A HREF=", vbTextCompare) + 23, InStr(1, strLine, """>Next<", vbTextCompare) - (InStr(1, strLine, ">Previous</A> <A HREF=", vbTextCompare) + 23)) 
      rem put the directory back in the file name 
      strNextFile = IIf(strNextFile <> "#", Mid(strFile, 1, (InStrRev(strFile, "\"))) & strNextFile, strFile) 
      blnEnd = (strNextFile = strFile) 
     Else 
      strMessage = strMessage & strLine 
     End If 
    Loop 
    tsInput.Close 
    Set FSO = Nothing 
    strFile = strNextFile 
Loop 
fReadFile = strMessage 
Exit Function 
ErrHandler: 
    Debug.Print Err.Description & " " & "fReadFile" 
    Resume Next 
End Function 
2

以及它是怎样的一个有趣的解决办法,但你可以导出为.rtf,然后在Word中打开和保存为一个名为.htm参考。瞧!

相关问题