VB如何提取PDF文件中的内容并保存到excel中

 我来答
ld_sunny888
2016-06-18 · 知道合伙人历史行家
ld_sunny888
知道合伙人历史行家
采纳数:8337 获赞数:154378
连续获得国家励志奖学金,博览群书,爱好文学、历史

向TA提问 私信TA
展开全部
Option Explicit
'Dim xlApp As Excel.Application '定义EXCEL类
'Dim xlBook As Excel.Workbook '定义工件簿类
'Dim xlsheet As Excel.Worksheet '定义工作表类

Dim xlApp As Object
Dim xlBook As Object
Dim xlsheet As Object
'Public Const sConnect = "ODBC;DSN=LocalServer;UID=sa;PWD=sa;Database=lgz;"

Dim db As Database
Dim qdef As QueryDef
Dim rs As Recordset
Dim qdef1 As QueryDef
Dim rs1 As Recordset
Dim rs2 As Recordset
'Dim sConnect As String

Dim i, temp0, J, SourceFile, DestinationFile, gg1, gg2, gg3, temp1, gg4

Private Sub Command1_Click()

temp1 = "2006技术保障维护维修情况上报表10月.xls"
SourceFile = "f:\sql\sblr\sblrbak.xls"
'DestinationFile = "f:\sql\sblr\sblr.xls"
DestinationFile = "f:\sql\sblr\" & Combo4.Text & "年技术保障维护维修情况上报表" & Mid(Combo5.Text, 1, 2) & "月到" & Mid(Combo7.Text, 1, 2) & "月.xls"
FileCopy SourceFile, DestinationFile

Set xlApp = CreateObject("Excel.Application") '创建EXCEL应用类
xlApp.Visible = True '设置EXCEL可见
Set xlBook = xlApp.Workbooks.Open(DestinationFile) '打开EXCEL工作簿
Set xlsheet = xlBook.Worksheets(1) '打开EXCEL工作表
xlsheet.Activate '激活工作表
xlsheet.Cells(1, 1) = Combo4.Text & "年技术保障维护维修情况上报表" & Mid(Combo5.Text, 1, 2) & "月到" & Mid(Combo7.Text, 1, 2) & "月"
Adodc1.Recordset.MoveFirst
gg3 = 0
gg4 = 0
For i = 0 To Adodc1.Recordset.RecordCount - 1
gg1 = Trim(Combo4.Text) & "-" & Trim(Combo5.Text)
gg2 = Trim(Combo6.Text) & "-" & Trim(Combo7.Text)
If Trim(Adodc1.Recordset.Fields(1)) >= gg1 Then
If Trim(Adodc1.Recordset.Fields(1)) <= gg2 Then
gg3 = gg3 + 1
Text1.Text = gg3
For J = 1 To 11
gg4 = gg4 + CInt(Adodc1.Recordset.Fields(9))
temp0 = Trim(Adodc1.Recordset.Fields(J))
xlsheet.Cells(gg3 + 2, J) = temp0
Next J

End If
End If
Adodc1.Recordset.MoveNext
Next i
'xlsheet.Cells(gg3 + 4, 9) = gg4
xlsheet.Cells(gg3 + 4, 7) = "共计:" & gg3 & "件 合计:"
End Sub

Private Sub Command11_Click()

temp1 = "2006技术保障维护维修情况上报表10月.xls"
SourceFile = "f:\sql\sblr\sblrbak.xls"
'DestinationFile = "f:\sql\sblr\sblr.xls"
DestinationFile = "f:\sql\sblr\" & Combo4.Text & "nnn" & Mid(Combo5.Text, 1, 2) & "月.xls"
FileCopy SourceFile, DestinationFile

Set xlApp = CreateObject("Excel.Application") '创建EXCEL应用类
xlApp.Visible = True '设置EXCEL可见
Set xlBook = xlApp.Workbooks.Open(DestinationFile) '打开EXCEL工作簿
Set xlsheet = xlBook.Worksheets(1) '打开EXCEL工作表
xlsheet.Activate '激活工作表

Adodc1.Recordset.MoveFirst
xlsheet.Cells(1, 1) = Combo4.Text & "nnn" & Mid(Combo5.Text, 1, 2) & "月"
gg3 = 0
gg4 = 0
For i = 0 To Adodc1.Recordset.RecordCount - 1
gg1 = Trim(Combo4.Text) & "-" & Trim(Combo5.Text)
gg2 = Trim(Combo6.Text) & "-" & Trim(Combo7.Text)
If Trim(Adodc1.Recordset.Fields(1)) >= gg1 Then
If Trim(Adodc1.Recordset.Fields(1)) <= gg2 Then
gg3 = gg3 + 1
Text1.Text = gg3
For J = 1 To 11
gg4 = gg4 + CInt(Adodc1.Recordset.Fields(9))
temp0 = Trim(Adodc1.Recordset.Fields(J))
xlsheet.Cells(gg3 + 2, J) = temp0
Next J

End If
End If
Adodc1.Recordset.MoveNext
Next i
'xlsheet.Cells(gg3 + 4, 9) = gg4
xlsheet.Cells(gg3 + 4, 7) = "共计:" & gg3 & "件 合计:"
End Sub
Private Sub Command3_Click()
Adodc1.Refresh
Adodc1.Recordset.Sort = (Combo1.Text)
End Sub
匿名用户
2019-01-11
展开全部
xunjiePDF编辑器 的功能包括:
-编辑现有 PDF 文件或创建全新的PDF文件。
-以和 Adobe PDF Reader 几乎相同的效果显示 PDF 文件。
-页面缩放。
-可靠的所见即所得的编辑功能。
-插入或删除页面。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式