Office中国论坛/Access中国论坛
标题: [推荐]老外的+我的改進=直接生成完美的PDF報表 [打印本页]
作者: chajiangliang 时间: 2006-5-27 19:21
标题: [推荐]老外的+我的改進=直接生成完美的PDF報表
老外的好東東
http://www.lebans.comeporttopdf.htm
我的改進:
Public Function ConvertReportToPDF( _
Optional RptName As String = "", _
Optional SnapshotName As String = "", _
Optional OutputPDFname As String = "", _
Optional ShowSaveFileDialog As Boolean = False, _
Optional StartPDFViewer As Boolean = True, _
Optional CompressionLevel As Long = 0, _
Optional PasswordOwner As String = "", _
Optional PasswordOpen As String = "", _
Optional PasswordRestrictions As Long = 0, _
Optional PDFNoFontEmbedding As Long = 0, Optional Wherecon As String) As Boolean
' RptName is the name of a report contained within this MDB
' SnapshotName is the name of an existing Snapshot file
' OutputPDFname is the name you select for the output PDF file
' ShowSaveFileDialog is a boolean param to specify whether or not to display
' the standard windows File Dialog window to select an exisiting Snapshot file
' CompressionLevel - not hooked up yet
' PasswordOwner - not hooked up yet
' PasswordOpen - not hooked up yet
' PasswordRestrictions - not hooked up yet
' PDFNoFontEmbedding - Do not Embed fonts in PDF. Set to 1 to stop the
' default process of embedding all fonts in the output PDF. If you are
' using ONLY - any of the standard Windows fonts
' using ONLY - any of the standard 14 Fonts natively supported by the PDF spec
'The 14 Standard Fonts
'All version of Adobe's Acrobat support 14 standard fonts. These fonts are always available
'independent whether they're embedded or not.
'Family name PostScript name Style
'Courier Courier fsNone
'Courier Courier-Bold fsBold
'Courier Courier-Oblique fsItalic
'Courier Courier-BoldOblique fsBold + fsItalic
'Helvetica Helvetica fsNone
'Helvetica Helvetica-Bold fsBold
'Helvetica Helvetica-Oblique fsItalic
'Helvetica Helvetica-BoldOblique fsBold + fsItalic
'Times Times-Roman fsNone
'Times Times-Bold fsBold
'Times Times-Italic fsItalic
'Times Times-BoldItalic fsBold + fsItalic
'Symbol Symbol fsNone, other styles are emulated only
'ZapfDingbats ZapfDingbats fsNone, other styles are emulated only
Dim s As String
Dim blRet As Boolean
' Let's see if the DynaPDF.DLL is available.
blRet = LoadLib()
If blRet = False Then
' Cannot find DynaPDF.dll or StrStorage.dll file
Exit Function
End If
On Error GoTo ERR_CREATSNAP
Dim strPath As String
Dim strPathandFileName As String
Dim strEMFUncompressed As String
Dim sOutFile As String
Dim lngRet As Long
' Init our string buffer
strPath = Space(Pathlen)
'Save the ReportName to a local var
mReportName = RptName
' Let's kill any existing Temp SnapShot file
If Len(mUncompressedSnapFile & vbNullString) > 0 Then
Kill mUncompressedSnapFile
mUncompressedSnapFile = ""
End If
' If we have been passed the name of a Snapshot file then
' skip the Snapshot creation process below
If Len(SnapshotName & vbNullString) = 0 Then
' Make sure we were passed a ReportName
If Len(RptName & vbNullString) = 0 Then
' No valid parameters - FAIL AND EXIT!!
ConvertReportToPDF = ""
Exit Function
End If
' Get the Systems Temp path
' Returns Length of path(num characters in path)
lngRet = GetTempPath(Pathlen, strPath)
' Chop off NULLS and trailing "\"
strPath = Left(strPath, lngRet) & Chr(0)
' Now need a unique Filename
' locked from a previous aborted attemp.
' Needs more work!
strPathandFileName = GetUniqueFilename(strPath, "SNP" & Chr(0), "snp")
' Export the selected Report to SnapShot format
<FONT color=#f73809> DoCmd.Echo False
DoCmd.OpenReport RptName, acViewPreview, , Wherecon
Reports(RptName).Visible = False
作者: fan0217 时间: 2006-5-27 19:34
- Public Function ConvertReportToPDF( _
- Optional RptName As String = "", _
- Optional SnapshotName As String = "", _
- Optional OutputPDFname As String = "", _
- Optional ShowSaveFileDialog As Boolean = False, _
- Optional StartPDFViewer As Boolean = True, _
- Optional CompressionLevel As Long = 0, _
- Optional PasswordOwner As String = "", _
- Optional PasswordOpen As String = "", _
- Optional PasswordRestrictions As Long = 0, _
- Optional PDFNoFontEmbedding As Long = 0, Optional Wherecon As String) As Boolean
- ' RptName is the name of a report contained within this MDB
- ' SnapshotName is the name of an existing Snapshot file
- ' OutputPDFname is the name you select for the output PDF file
- ' ShowSaveFileDialog is a boolean param to specify whether or not to display
- ' the standard windows File Dialog window to select an exisiting Snapshot file
- ' CompressionLevel - not hooked up yet
- ' PasswordOwner - not hooked up yet
- ' PasswordOpen - not hooked up yet
- ' PasswordRestrictions - not hooked up yet
- ' PDFNoFontEmbedding - Do not Embed fonts in PDF. Set to 1 to stop the
- ' default process of embedding all fonts in the output PDF. If you are
- ' using ONLY - any of the standard Windows fonts
- ' using ONLY - any of the standard 14 Fonts natively supported by the PDF spec
- 'The 14 Standard Fonts
- 'All version of Adobe's Acrobat support 14 standard fonts. These fonts are always available
- 'independent whether they're embedded or not.
- 'Family name PostScript name Style
- 'Courier Courier fsNone
- 'Courier Courier-Bold fsBold
- 'Courier Courier-Oblique fsItalic
- 'Courier Courier-BoldOblique fsBold + fsItalic
- 'Helvetica Helvetica fsNone
- 'Helvetica Helvetica-Bold fsBold
- 'Helvetica Helvetica-Oblique fsItalic
- 'Helvetica Helvetica-BoldOblique fsBold + fsItalic
- 'Times Times-Roman fsNone
- 'Times Times-Bold fsBold
- 'Times Times-Italic fsItalic
- 'Times Times-BoldItalic fsBold + fsItalic
- 'Symbol Symbol fsNone, other styles are emulated only
- 'ZapfDingbats ZapfDingbats fsNone, other styles are emulated only
- Dim s As String
- Dim blRet As Boolean
- ' Let's see if the DynaPDF.DLL is available.
- blRet = LoadLib()
- If blRet = False Then
- ' Cannot find DynaPDF.dll or StrStorage.dll file
- Exit Function
- End If
- On Error GoTo ERR_CREATSNAP
- Dim strPath As String
- Dim strPathandFileName As String
- Dim strEMFUncompressed As String
- Dim sOutFile As String
- Dim lngRet As Long
- ' Init our string buffer
- strPath = Space(Pathlen)
- 'Save the ReportName to a local var
- mReportName = RptName
- ' Let's kill any existing Temp SnapShot file
- If Len(mUncompressedSnapFile & vbNullString) > 0 Then
- Kill mUncompressedSnapFile
- mUncompressedSnapFile = ""
- End If
- ' If we have been passed the name of a Snapshot file then
- ' skip the Snapshot creation process below
- If Len(SnapshotName & vbNullString) = 0 Then
- ' Make sure we were passed a ReportName
- If Len(RptName & vbNullString) = 0 Then
- ' No valid parameters - FAIL AND EXIT!!
- ConvertReportToPDF = ""
- Exit Function
- End If
- ' Get the Systems Temp path
- ' Returns Length of path(num characters in path)
- lngRet = GetTempPath(Pathlen, strPath)
- ' Chop off NULLS and trailing ""
- strPath = Left(strPath, lngRet) & Chr(0)
- ' Now need a unique Filename
- ' locked from a previous aborted attemp.
- ' Needs more work!
- strPathandFileName = GetUniqueFilename(strPath, "SNP" & Chr(0), "snp")
- ' Export the selected Report to SnapShot format
- DoCmd.Echo False
- DoCmd.OpenReport RptName, acViewPreview, , Wherecon
- Reports(RptName).Visible = False
复制代码 先睹为快!
作者: tmtony 时间: 2006-5-27 19:37
leban的东东都是精品,我也在用这个工具哦. 谢谢改进与分享.拿来就用了
作者: shala 时间: 2006-5-27 19:43
see
作者: kevindeng 时间: 2006-5-27 20:53
看看
作者: LucasLynn 时间: 2006-5-27 21:01
能否解释下和使用Acrobat Professional效果有何不同?
作者: ey1001 时间: 2006-5-27 21:15
1
作者: Benjamin_luk 时间: 2006-5-27 21:20
梦里寻他千百回,得来全不费功夫.
谢谢分享
作者: liw99814 时间: 2006-5-27 22:16
谢谢
作者: sgrshh29 时间: 2006-5-27 22:19
谢谢分享
作者: xlonger 时间: 2006-5-27 22:36
地地道道
作者: 情比金坚 时间: 2006-5-27 22:41
精品噢
作者: tsilon 时间: 2006-5-27 22:41
let me see.
作者: 付谦 时间: 2006-5-27 22:59
???????
作者: ququ 时间: 2006-5-28 01:49
谢
作者: wu8313 时间: 2006-5-28 02:33
我拷贝了 dll文件,和楼主的代码,选择导出报表 ,却报错 "报表损坏,选择另外",不知道什么原因?
同样选择导出 快照,还是同样的报错信息。
[attach]18079[/attach]
[此贴子已经被作者于2006-5-28 8:25:23编辑过]
作者: 王维a780 时间: 2006-5-28 03:24
谢谢分享
作者: 阿智 时间: 2006-5-28 05:56
T
作者: 宿命的风 时间: 2006-5-28 06:02
以下是引用liw99814在2006-5-27 14:16:00的发言:
谢谢
作者: t360103 时间: 2006-5-28 06:02
标题: see
作者: 宿命的风 时间: 2006-5-28 06:43
我怎么运行不成功呢?
作者: shenlan 时间: 2006-5-28 09:47
好的,我们就喜欢,好的就要学习,谢谢
作者: sgrshh29 时间: 2006-5-28 14:24
以下是引用LucasLynn在2006-5-27 13:01:00的发言:
能否解释下和使用Acrobat Professional效果有何不同?
作者: duanpeng@ 时间: 2006-5-28 15:21
[em01]
作者: laiguiyou 时间: 2006-5-28 15:53
see
作者: skylark 时间: 2006-5-28 16:45
感谢分享,版主辛苦,有它的用处,目前我的报表都是以快照保存的.
作者: LucasLynn 时间: 2006-5-28 19:56
以下是引用skylark在2006-5-28 8:45:00的发言:
感谢分享,版主辛苦,有它的用处,目前我的报表都是以快照保存的.
Adobe Acrobat 7.0 Professional 支持 Access 2003
作者: chul72 时间: 2006-5-28 21:07
看过
作者: dhwx 时间: 2006-5-28 23:17
好東東
作者: XWQ2000 时间: 2006-5-29 00:29
veer
作者: zxzx2733 时间: 2006-5-29 00:57
1
作者: china007 时间: 2006-5-29 01:08
谢谢分享,呵呵
作者: LIXIANACCP 时间: 2006-5-29 01:56
11
作者: wwwwa 时间: 2006-5-29 15:55
look
作者: 5988143 时间: 2006-5-29 15:55
謝謝!好東西呀!
作者: tonywong 时间: 2006-5-29 17:09
来晚了
作者: winner 时间: 2006-5-29 17:38
seesee
作者: vince 时间: 2006-5-29 20:39
先看再学。
作者: huanghai 时间: 2006-5-29 22:29
下载来试试
作者: xslxr 时间: 2006-5-29 22:41
谢谢.看一下.
作者: 真主 时间: 2006-5-29 22:44
我先看看,谢谢
作者: andymark 时间: 2006-5-30 01:01
谢谢分享!!
作者: yodong 时间: 2006-5-30 01:15
55
作者: djhong 时间: 2006-5-30 01:54
[em02][em02]
作者: 付谦 时间: 2006-5-30 03:10
多此一举
作者: stanleypan 时间: 2006-5-30 03:26
Just have a look
作者: xiaoyouzi5555 时间: 2006-5-30 18:39
谢谢分享
作者: xthand 时间: 2006-5-30 19:03
kk
作者: WDLRCZT 时间: 2006-5-30 20:27
看看
作者: 17373925 时间: 2006-5-30 20:54
了解一下
作者: videochat 时间: 2006-5-30 21:09
看看,谢谢
作者: myhome810 时间: 2006-5-31 06:33
ok
作者: df 时间: 2006-5-31 16:13
ok
作者: 轻风 时间: 2006-5-31 16:31
谢谢
作者: CHENARLAI 时间: 2006-5-31 17:44
让我下
作者: Sagittarius 时间: 2006-5-31 18:19
see
作者: wzh 时间: 2006-5-31 19:29
好東東
作者: zyz218 时间: 2006-5-31 19:40
good
作者: bloom 时间: 2006-5-31 20:30
[em02]
作者: ly 时间: 2006-5-31 20:58
先睹为快
作者: t360103 时间: 2006-6-1 00:49
标题: 生成完美的PDF報表
以下是引用fan0217在2006-5-27 11:34:00的发言:
先睹为快!
作者: t360103 时间: 2006-6-1 00:51
标题: 生成完美的PDF報表
作者: qdjqx 时间: 2006-6-1 03:00
谢谢共享!!!
作者: tonny007 时间: 2006-6-2 20:41
1
作者: glw 时间: 2006-6-2 20:46
look
作者: K仔 时间: 2006-6-2 22:20
看看先啊~
作者: suve 时间: 2006-6-3 01:58
看看
作者: eddieliu 时间: 2006-6-4 17:33
回复了
作者: 08a91lk 时间: 2006-6-4 18:13
提示: 作者被禁止或删除 内容自动屏蔽
作者: sxgaobo 时间: 2006-6-4 22:53
学习!
作者: ACCESS新新手 时间: 2006-6-5 02:42
谢谢
作者: artbao 时间: 2006-6-8 02:28
好东东
作者: cbc 时间: 2006-6-8 18:00
看看
作者: 付谦 时间: 2006-6-9 03:07
Q
作者: Grant 时间: 2006-6-9 09:14
谢谢分享~!
作者: rewq2581 时间: 2006-6-9 16:43
谢谢改进与分享
作者: lfxwolf 时间: 2006-6-9 21:34
学习学习呀[em13]
作者: smile1998 时间: 2006-6-10 18:21
i want to see!
作者: chenjun86666 时间: 2006-6-12 06:23
[em02][em02][em02][em02][em02][em02][em02]
作者: julwind1977 时间: 2006-6-12 18:56
先看看:)
作者: qlm 时间: 2006-6-12 20:17
[em02]
PDF有什么好呢?
[此贴子已经被作者于2006-6-12 12:19:47编辑过]
作者: zsj1101 时间: 2006-6-12 23:14
扛著ak47為樓主守著。
作者: duzili 时间: 2006-6-13 05:26
谢谢分享
作者: jd0595 时间: 2006-6-13 19:24
好东东,看看
Thanks!
作者: Nicole_20051 时间: 2006-6-14 03:39
Thanks a lot!
作者: walker-dong 时间: 2006-6-14 17:01
呵呵,回复先!
作者: jellings 时间: 2006-6-14 17:46
看看
作者: office_pop 时间: 2006-6-14 17:55
感谢楼主分享
作者: office_pop 时间: 2006-6-14 17:55
发重了,编辑掉
作者: pxsj 时间: 2006-6-14 19:43
谢谢啦。
作者: tsilon 时间: 2006-6-14 21:46
dinbfg
作者: 枫叶飘零 时间: 2006-6-15 16:03
看一下
作者: moyi 时间: 2006-6-15 18:21
看一下,应该是个不错的东东
作者: esnake 时间: 2006-6-16 00:27
太好了,正需要
作者: merryhappy 时间: 2006-6-16 03:21
I will appreciate you always!Thank you for your free date.
作者: swllking 时间: 2006-6-16 03:31
我渴望学习Access!
作者: kennylee 时间: 2006-6-16 17:03
SEE
作者: kennylee 时间: 2006-6-16 17:04
SEE
作者: flydeer 时间: 2006-6-16 18:11
let me see
作者: lingjiang 时间: 2006-6-17 06:07
先睹为快!
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) |
Powered by Discuz! X3.3 |