【发布时间】:2011-10-11 11:32:04
【问题描述】:
当我使用报表的导出到html功能时,Access会生成多页html(每页大约有30行左右的数据)。
如何强制 Access 为整个报告生成一个 html 文件?谢谢。
【问题讨论】:
-
您是否尝试过构建查询,然后将其导出为 HTML?结果将是一个 HTML 表格,没有分页符,只有一个文档。
标签: html ms-access pagination report
当我使用报表的导出到html功能时,Access会生成多页html(每页大约有30行左右的数据)。
如何强制 Access 为整个报告生成一个 html 文件?谢谢。
【问题讨论】:
标签: html ms-access pagination report
我创建了一个可能对其他人有帮助的功能。它采用文件路径,然后跟随链接,直到文档完成。您需要将报告导出到 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
【讨论】:
这是一种有趣的解决方法,但您可以导出为 .rtf,然后在 word 中打开并另存为 .htm。瞧!
【讨论】:
做不到。必须根据打印机驱动程序设置纸张尺寸。即使页面设置中存在此选项,Access 也不允许用户定义的纸张尺寸。
【讨论】: