2019独角兽企业重金招聘Python工程师标准>>>

  1. word自带:审阅-比较
  • 只能比较差不多的文档
  1. beyond compare
  • 只能比较差不多的文档 3、vba,功能强大,代码见下(包括文字、图片、表格)

NewMacros.bas

Sub 检查雷同64()
'
' 检查雷同 宏
'
'UserForm_x64.Show vbModelessEnd SubSub 检查雷同()
'
' 检查雷同 宏
'
'UserForm_x86.Show vbModelessEnd Sub

UserForm_x86.frm

'在2013版本下开发,2010与2016版本测试OK,其他版本应该也可以但未测试不能保证正常使用Option Explicit'//适用与32位环境
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function SetFocus Lib "user32" (ByVal hWnd As Long) As Long'//适用与64位office
'Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
'Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
'Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
'Private Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
'Private Declare PtrSafe Function SetFocus Lib "user32" (ByVal hWnd As Long) As LongPrivate Const GWL_STYLE As Long = (-16)
Private Const GWL_EXSTYLE = (-20)
Private Const WS_THICKFRAME As Long = &H40000 '(恢复大小)
Private Const WS_MINIMIZEBOX As Long = &H20000 '(最小化)
Private Const WS_MAXIMIZEBOX As Long = &H10000 '(最大化)
Private Const SW_SHOW As Long = 5
Private Const WS_CAPTION As Long = &HC00000
Private Const WS_EX_APPWINDOW As Long = &H40000Dim hWndForm As Long, IStyle As Long
Dim hMin As Long, hBar As Long, hTaskbar As Long
Dim ADoc As Document, BDoc As Document, CDoc As Document
Dim HighlightFinder As Boolean
Dim started As BooleanPrivate Sub CommandButton8_Click()
On Error GoTo Err
Dim i As Long, icount As Long
Dim apage As Long
Dim Amap As New Collection, Bmap As New Collection
Dim ftest As String
Dim myFind As Find
Dim bfind As Boolean
Dim txtRange As Range
Dim myStart As Long, myEnd As LongLabel4.Caption = "0%"If ADoc Is Nothing ThenMsgBox "请选择并打开主文件!"Exit Sub
End IfIf Dir("c:\方案检查\行政区(不要删).txt") = Empty ThenMsgBox "请检查c:\方案检查\行政区(不要删).txt是否存在!"Exit Sub
End Ifstarted = Not started
If started ThenCommandButton8.Caption = "正在检查,点击停止"
ElseCommandButton8.Caption = "检查行政区名"
End IfOpen "c:\方案检查\行政区(不要删).txt" For Input As #1
Do While Not EOF(1)Line Input #1, ftestftest = Trim(ftest)If Len(ftest) > 0 Then Amap.Add ftestDoEventsIf Not started ThenClose #1started = Not startedExit SubEnd If
Loop
Close #1
For i = 1 To Amap.Countapage = 0ftest = Amap.Item(i)Set myFind = ADoc.Content.FindDo While myFind.Execute(ftest, False, False, False, False, False, True, wdFindStop, False)Set txtRange = myFind.Parentapage = myFind.Parent.Information(wdActiveEndPageNumber)myStart = txtRange.StartmyEnd = txtRange.EndtxtRange.Start = txtRange.Start - 20txtRange.End = txtRange.End + 30Bmap.Add (ftest + vbTab + "P" + Str(apage) + vbTab + txtRange.Text)txtRange.Start = myStarttxtRange.End = myEndDoEventsLoopLabel4.Caption = Str(Int(i * 100 / Amap.Count)) + "%"DoEventsIf Not started Then i = Amap.Count
NextIf Dir("c:\方案检查\", vbDirectory) = "" Then MkDir "c:\方案检查\"Open "c:\方案检查\查到的行政区.txt" For Output As #1Print #1, "查到的行政区文字如下:"For i = 1 To Bmap.CountPrint #1, Bmap.Item(i)NextClose #1If MsgBox("请查看 c:\方案检查\查到的行政区.txt", vbOKCancel) = vbOK Then Shell "Explorer.exe c:\方案检查\查到的行政区.txt", vbNormalFocusstarted = Not startedIf started ThenCommandButton8.Caption = "正在检查,点击停止"ElseCommandButton8.Caption = "检查行政区名"End If
Exit SubErr:MsgBox "出错了!" & vbCrLf & "错误编号:" & Err.Number & " 错误描述:" & Err.DescriptionClose #1started = FalseCommandButton8.Caption = "检查行政区名"
'Resume NextEnd SubPrivate Sub UserForm_Initialize()hWndForm = FindWindow("ThunderDFrame", Me.Caption)
IStyle = GetWindowLong(hWndForm, GWL_STYLE)
'IStyle = IStyle Or WS_THICKFRAME '还原
'IStyle = IStyle Or WS_MINIMIZEBOX '最小化
'IStyle = IStyle Or WS_MAXIMIZEBOX '最大化
'SetWindowLong hWndForm, GWL_STYLE, IStyle
SetFocus hWndForm
started = False
End SubPrivate Sub UserForm_Terminate()ThisDocument.Application.Visible = True
End SubFunction FindLB(ByVal test As String, apage As Long) As Boolean
Dim myFind As Find
Set myFind = ADoc.Content.Find
If CDoc Is Nothing ThenFindLB = myFind.Execute(test, False, False, False, False, False, True, wdFindContinue, False)If FindLB Thenapage = myFind.Parent.Information(wdActiveEndPageNumber)If HighlightFinder Then myFind.Parent.HighlightColorIndex = wdYellowEnd If
ElseIf CDoc.Content.Find.Execute(test, False, False, False, False, False, True, wdFindContinue, False) ThenFindLB = FalseElseFindLB = myFind.Execute(test, False, False, False, False, False, True, wdFindContinue, False)If FindLB Thenapage = myFind.Parent.Information(wdActiveEndPageNumber)If HighlightFinder Then myFind.Parent.HighlightColorIndex = wdYellowEnd IfEnd If
End If
End FunctionSub GMap()
On Error GoTo Err
Dim i As Long, icount As Long, p As Long, s As Long, ls As Long
Dim apage As Long, bpage As Long
Dim Bmap As New Collection
Dim strRange As String, ftest As String
Dim fRange As Range, iRange As Rangeicount = BDoc.Paragraphs.Count
For i = 1 To icountSet iRange = BDoc.Paragraphs(i).Range
'    strRange = Trim(iRange.Text)strRange = Trim(Replace(iRange.Text, ",", "。"))
'大与3个字符才检查ls = Len(strRange)If ls > 3 Thenp = 0Do While p < lsIf started = False Then Exit Subs = p + 1p = InStr(s, strRange, "。")'字符数控制在4~254If p = 0 Then p = ls + 1If p - s > 255 Then p = s + 255If p - s > 3 Thenftest = Mid(strRange, s, p - s)If FindLB(ftest, apage) ThenIf HighlightFinder ThenSet fRange = BDoc.Range(Start:=iRange.Start + s - 1, End:=iRange.Start + p - 1)fRange.HighlightColorIndex = wdYellowEnd Ifbpage = iRange.Information(wdActiveEndPageNumber)Bmap.Add ("P" + Str(apage) + "——>P" + Str(bpage) + vbTab + ftest)End IfEnd IfDoEventsLoopEnd IfLabel4.Caption = Str(Int(i * 100 / BDoc.Paragraphs.Count)) + "%"
NextIf Bmap.Count = 0 ThenMsgBox "没有找到雷同内容"
ElseIf Dir("c:\方案检查\", vbDirectory) = "" Then MkDir "c:\方案检查\"Open "c:\方案检查\查重.txt" For Output As #1Print #1, "可能雷同内容如下:"Print #1, "主文件位置" + vbTab + "对比文件位置" + vbTab + "雷同内容"For i = 1 To Bmap.CountPrint #1, Bmap.Item(i)NextClose #1
'    MsgBox "请查看 c:\方案检查\查重.txt"If MsgBox("请查看 c:\方案检查\查重.txt", vbOKCancel) = vbOK Then Shell "Explorer.exe c:\方案检查\查重.txt", vbNormalFocus
End If
Exit Sub
Err:MsgBox "出错了!" & vbCrLf & "错误编号:" & Err.Number & " 错误描述:" & Err.Description
'Resume Next
End SubFunction ExtractShape(Mdoc As Document) As Boolean
On Error GoTo Err
Dim sDoc As Document
Dim Mshape As InlineShape
Dim sRange As Range
Dim i As Long, EndPos As Long
i = 0If Not Mdoc Is Nothing ThenSet sDoc = Documents.AddEndPos = sDoc.Paragraphs(sDoc.Paragraphs.Count).Range.End - 1Set sRange = sDoc.Range(Start:=EndPos, End:=EndPos)sRange.InsertAfter "图片来自:" + Mdoc.Name + Chr(10) + Chr(13)For Each Mshape In Mdoc.InlineShapesWith sRangeEndPos = sDoc.Paragraphs(sDoc.Paragraphs.Count).Range.End - 1.SetRange EndPos, EndPos.InsertAfter "P" + Trim(Str(Mshape.Range.Information(wdActiveEndPageNumber))) + Chr(10)EndPos = sDoc.Paragraphs(sDoc.Paragraphs.Count).Range.End - 1.SetRange EndPos, EndPosMshape.Range.Copy.PasteEndPos = sDoc.Paragraphs(sDoc.Paragraphs.Count).Range.End - 1.SetRange EndPos, EndPos.InsertAfter Chr(10) + Chr(13)End Withi = i + 1Label4.Caption = Str(Int(i * 100 / Mdoc.InlineShapes.Count)) + "%"DoEventsNextIf Dir("c:\方案检查\", vbDirectory) = "" Then MkDir "c:\方案检查\"sDoc.SaveAs2 "c:\方案检查\图片来自" + Mdoc.NameExtractShape = True
ElseExtractShape = False
End If
Exit Function
Err:ExtractShape = FalseMsgBox "出错了!" & vbCrLf & "错误编号:" & Err.Number & " 错误描述:" & Err.Description
End FunctionFunction ExtractTable(Mdoc As Document) As Boolean
On Error GoTo Err
Dim sDoc As Document
Dim Mtable As Table
Dim sRange As Range
Dim i As Long, EndPos As Long
i = 0
If Not Mdoc Is Nothing ThenSet sDoc = Documents.AddEndPos = sDoc.Paragraphs(sDoc.Paragraphs.Count).Range.End - 1Set sRange = sDoc.Range(Start:=EndPos, End:=EndPos)sRange.InsertAfter "表格来自:" + Mdoc.Name + Chr(10) + Chr(13)For Each Mtable In Mdoc.TablesWith sRangeEndPos = sDoc.Paragraphs(sDoc.Paragraphs.Count).Range.End - 1.SetRange EndPos, EndPos.InsertAfter "P" + Trim(Str(Mtable.Range.Information(wdActiveEndPageNumber))) + Chr(10)EndPos = sDoc.Paragraphs(sDoc.Paragraphs.Count).Range.End - 1.SetRange EndPos, EndPosMtable.Range.Copy.PasteEndPos = sDoc.Paragraphs(sDoc.Paragraphs.Count).Range.End - 1.SetRange EndPos, EndPos.InsertAfter Chr(10) + Chr(13)End Withi = i + 1Label4.Caption = Str(Int(i * 100 / Mdoc.InlineShapes.Count)) + "%"DoEventsNextIf Dir("c:\方案检查\", vbDirectory) = "" Then MkDir "c:\方案检查\"sDoc.SaveAs2 "c:\方案检查\表格来自" + Mdoc.NameExtractTable = True
ElseExtractTable = False
End If
Exit Function
Err:ExtractTable = FalseMsgBox "出错了!" & vbCrLf & "错误编号:" & Err.Number & " 错误描述:" & Err.Description
End FunctionPrivate Sub CommandButton1_Click()With Application.FileDialog(msoFileDialogFilePicker).AllowMultiSelect = False.Filters.Clear.Filters.Add "Word文件", "*.doc;*.docx".Filters.Add "All Files", "*.*"If .Show = -1 Then'FileDialog 对象的 Show 方法显示对话框,并且返回 -1(如果您按 OK)和 0(如果您按 Cancel)。TextBox1.Text = .SelectedItems(1)End IfEnd WithIf Trim(TextBox1.Text) <> "" ThenSet BDoc = Documents.Open(FileName:=TextBox1.Text, Visible:=False)SetFocus hWndFormEnd If
End SubPrivate Sub CommandButton2_Click()With Application.FileDialog(msoFileDialogFilePicker).AllowMultiSelect = False.Filters.Clear.Filters.Add "Word文件", "*.doc;*.docx".Filters.Add "All Files", "*.*"If .Show = -1 Then'FileDialog 对象的 Show 方法显示对话框,并且返回 -1(如果您按 OK)和 0(如果您按 Cancel)。TextBox2.Text = .SelectedItems(1)End IfEnd WithIf Trim(TextBox2.Text) <> "" ThenSet CDoc = Documents.Open(FileName:=TextBox2.Text, Visible:=False)SetFocus hWndFormEnd If
End SubPrivate Sub CommandButton3_Click()
Dim Atrack As Boolean, Btrack As BooleanIf ADoc Is Nothing ThenMsgBox "请选择并打开主文件!"Exit SubElseAtrack = ADoc.TrackRevisionsADoc.TrackRevisions = FalseEnd IfIf BDoc Is Nothing ThenMsgBox "请选择并打开对比文件!"Exit SubElseBtrack = BDoc.TrackRevisionsBDoc.TrackRevisions = FalseEnd IfHighlightFinder = CheckBox1.Value
'    Application.Visible = FalseADoc.TrackRevisions = Falsestarted = Not startedIf started ThenCommandButton3.Caption = "正在检查,点击停止"GMapstarted = Not startedCommandButton3.Caption = "开始文字雷同检查"ElseCommandButton3.Caption = "开始文字雷同检查"End IfADoc.TrackRevisions = AtrackBDoc.TrackRevisions = BtrackApplication.Visible = True
End SubPrivate Sub CommandButton4_Click()With Application.FileDialog(msoFileDialogFilePicker).AllowMultiSelect = False.Filters.Clear.Filters.Add "Word文件", "*.doc;*.docx".Filters.Add "All Files", "*.*"If .Show = -1 Then'FileDialog 对象的 Show 方法显示对话框,并且返回 -1(如果您按 OK)和 0(如果您按 Cancel)。TextBox3.Text = .SelectedItems(1)End IfEnd WithIf Trim(TextBox3.Text) <> "" ThenSet ADoc = Documents.Open(FileName:=TextBox3.Text, Visible:=False)SetFocus hWndFormEnd If
End SubPrivate Sub CommandButton5_Click()With Application.FileDialog(msoFileDialogFilePicker).AllowMultiSelect = False.Filters.Clear.Filters.Add "Word文件", "*.doc;*.docx".Filters.Add "All Files", "*.*"If .Show = -1 Then'FileDialog 对象的 Show 方法显示对话框,并且返回 -1(如果您按 OK)和 0(如果您按 Cancel)。TextBox4.Text = .SelectedItems(1)End IfEnd WithIf Trim(TextBox4.Text) <> "" ThenSet ADoc = Documents.Open(FileName:=TextBox3.Text, Visible:=False)SetFocus hWndFormEnd If
End SubPrivate Sub CommandButton6_Click()Application.ScreenUpdating = FalseIf ExtractShape(ADoc) Or ExtractShape(BDoc) ThenMsgBox "抽取完成,请查看对比图片文件"ElseMsgBox "抽取没有正常完成!"End IfApplication.Visible = TrueApplication.ScreenUpdating = True
End SubPrivate Sub CommandButton7_Click()Application.ScreenUpdating = FalseIf ExtractTable(ADoc) Or ExtractTable(BDoc) ThenMsgBox "抽取完成,请查看对比表格文件"ElseMsgBox "抽取没有正常完成!"End IfApplication.Visible = TrueApplication.ScreenUpdating = TrueEnd Sub

转载于:https://my.oschina.net/u/2464371/blog/3037367

[office]word2010、word2013、word2016比较查重软件相关推荐

  1. 毕业论文查重软件如何论文查重?

    现在网络上搜索的毕业论文查重软件会出现很多的论文查重软件.其他的论文查重软件小编也不知道要如何进行论文的查重操作.因为小编只使用过一个论文查重软件,它就是新出的paperpaper论文查重软件.接下来 ...

  2. 有什么好的论文查重软件?两分钟让你知道

    在我们的大学的学习中,相信大多数的小伙伴都需要写毕业论文,而每个人的毕业设计论文研究都是要经过查重检测的,当你论文的重复率过高的话,那么对于毕业也就会有一定的影响.所以我们就可以提前做好论文查重的工作 ...

  3. 技术职称论文查重用什么论文查重软件?

    在明确了大学毕业论文的主题后,立即进行的一项工作是找到与本论文主题相似的参考资料.免费论文检测手机软件给我们几个方面的材料选择建议,我希望能帮助您: 技术职称论文检测用什么论文查重软件? (1)选择紧 ...

  4. 论文查重软件查重时需要注意的问题有哪些?

    论文查重是完成论文后必须进行的一步,只有通过查重稿,重复率符合要求,才能正常参加论文答辩.下面就如何使用论文查重软件进行查重进行了分享. 欲查重论文,就得选择论文查重网站,所以首先要选择一个安全可靠的 ...

  5. 哪个论文查重软件能保证查重效果?

    如果能在学校检测前知道本科论文查重用什么系统检测,那么可以提前做好检测,并把自己的论文检查率降到很低,那么以后提交论文肯定不会有问题.但如今网上查重系统如此之多,我们该如何选择?哪个论文查重软件能保证 ...

  6. 比较权威的论文查重软件有那些?

    最权威的论文查重软件就是学校的论文查重系统了.我们会选择自己进行论文的查重最终的目的是为了通过学校的论文查重标准,那么这样看来最权威的就是学校所选择的论文查重工具了. 小编在自己进行论文查重的时候使用 ...

  7. 免费论文检测 论文查重 软件 系统 论文免费检测 论文抄袭检测大师

    现在论文抄袭.学术打假成为学术界.媒体关注的话题.有的学者心存侥幸,有的学者对学术严谨性未加重视等,以至于被相关人士揭发举报,最终身败名裂.而许多毕业生因为种种原因,并未对论文抄袭现象加以重视,最后不 ...

  8. Nature:学术造假者瑟瑟发抖,论文图像查重AI技术重拳出击!

    2020-09-18 14:27 导语:人在做,AI在看 作者 | 青  暮 编辑 | 丛 末 来自纽约雪城大学的机器学习研究人员Daniel Acuna开发了一款论文图像查重软件,他用这款软件检查了 ...

  9. word文档查重_「毕业之家」揭秘:大学生知网论文查重的规则及查重原理

    大家好,我是毕业之家小毕同学.后续会持续为大家更新毕业论文写作.修改.降重,记得关注哟. 说道大学生学位论文查重,大家不得不提起知网.知网真的是强劲的学术软件和查重软件.知网的功能很多,仅仅这个名字就 ...

最新文章

  1. 张宏江:开源时代如何解决人的思维孤岛
  2. 亚马逊首席技术官预测2021年将改变世界的八大技术趋势
  3. idea2019配置gradle详解_Java学习之——Gradle的安装配置、IDEA中创建Gradle的Java项目...
  4. Medoo入门:安装和配置-Medoo使用指南
  5. c语言局部变量存在什么区_C语言程序设计变量运用指南 C语言局部变量的存储方式和生存期...
  6. python parser count_8 个 Python 实用脚本,早掌握早下班!
  7. [CQOI2018] 解锁屏幕(状压dp)
  8. 数据库引索的简单了解
  9. python列表索引 end start_Pandas:在Pandas数据帧中查找连续索引的startend值
  10. 我的春Phone之行
  11. ROS学习笔记5(理解ROS节点)
  12. 排序算法浅析(一)比较排序算法
  13. 拓端tecdat|R语言分类回归决策树交互式修剪和更美观地可视化分析细胞图像分割数据集
  14. 5个CSS3技术实现设计增强
  15. STM32F107各种接口程序合集工程文件
  16. 韩语在线翻译图片识别_3个OCR文字识别工具,最后一个许多人都不知道!
  17. 2019 Java 全栈工程师进阶路线图,一定要收藏!
  18. 【黄啊码】微信小程序外卖项目显示骑手位置
  19. 微信小程序和微信小游戏的区别体现在哪?
  20. 127.0.0.1:3000端口已被占用

热门文章

  1. 无线通信原理及应用--阅读笔记一
  2. 几种生成验证码的方式以及计算表达式的计算
  3. 水星UD6S网卡Linux驱动,水星UD6S驱动程序官方版
  4. H264学习二:H.264/AVC编码标准
  5. 浅谈消防应急照明系统在建筑电气设计领域的实践
  6. 李航《统计学习方法》第2版 第2章课后习题答案
  7. centos7安装ftp服务登录不上的坑总结
  8. 6个思维导图工具精通一款让你的效率大大提升,快他不止一步!
  9. 数据仓库和数据集市的区别
  10. 10小时入门大数据视频教程