请大家帮我看看下面代码的含义
时间:2007-09-11
来源:互联网
Dim fs, txtFile, line, data, nvpair, nv
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(datafile) = False Then
WScript.Echo "File " & datafile & " doesn't exist!"
WScript.Quit
End If
Dim rootPartDic
Set rootPartDic = CreateObject("Scripting.Dictionary")
Set txtFile = fs.OpenTextFile(datafile)
line = txtFile.ReadLine()
data = Split(line, "|")
For Each nvpair In data
nv =Split(nvpair, "=")
If UBound(nv)>0 Then
rootPartDic.Add nv(0), nv(1)
End If
Next
Dim Line_Num_Per_Page
Line_Num_Per_Page = rootPartDic.Item("LineNumPerPage")
Dim lineNum, contentDic
lineNum = 1
Set contentDic = CreateObject("Scripting.Dictionary")
While Not txtFile.AtEndOfStream
line = txtFile.ReadLine()
contentDic.Add lineNum, line
lineNum = lineNum + 1
Wend
Dim i, j, n, indent, tableID, table
tableID = 1
'.Selection.InsertDateTime "h时m分s秒", False, False, wdSimplifiedChinese, wdCalendarWestern
Dim attrLenLimitArray
attrLenLimitArray = Array(16, 4, 1, 3, 13, 50, 30, 20, 1, 3, 7, 2, 20, 30)
For lineNum = 1 To contentDic.Count
If lineNum Mod Line_Num_Per_Page = 1 Then
doc.Tables(tableID).Select
.Selection.Copy
doc.Range(doc.Range.End-1, doc.Range.End-1).Select
''WScript.Echo "select end"
.Selection.InsertBreak wdPageBreak
''WScript.Echo "insert page"
.Selection.Paste
'WScript.Echo "Paste"
'.Selection.InsertFile templatefile, "", False,False,False
'WScript.Echo "Insert File"
Set table=doc.Tables(tableID)
tableID=tableID + 1
table.Cell(2,1).Select
End If
line = contentDic.Item(lineNum)
data = Split(line, ",")
indent = CInt(data(0))
'omit by yujie20060228
'n = 1
'While n < indent
' .Selection.TypeText "."
' n= n+1
'Wend
.Selection.TypeText data(0)
.Selection.MoveRight wdCell
For i = 1 To UBound(data)
data(i) = Left(rptDecodeString(data(i)), attrLenLimitArray(i))
.Selection.TypeText data(i)
.Selection.MoveRight wdCell
Next
Next
doc.Tables(tableID).Delete
doc.Range(doc.Range.End-1, doc.Range.End-1).Select
.Selection.TypeBackspace
.Selection.TypeBackspace
.Selection.TypeBackspace
.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
.Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
.Selection.TypeText "打印日期: "
.Selection.InsertDateTime "yyyy'年'M'月'd'日'", False, False, wdSimplifiedChinese, wdCalendarWestern
.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
请大家给我注释一下.我不太清楚里面的含义!
作者: andylau112 发布时间: 2007-09-11
请选择不懂的问!
作者: 老申 发布时间: 2007-09-11
If lineNum Mod Line_Num_Per_Page = 1 Then
doc.Tables(tableID).Select
.Selection.Copy
doc.Range(doc.Range.End-1, doc.Range.End-1).Select
''WScript.Echo "select end"
.Selection.InsertBreak wdPageBreak
''WScript.Echo "insert page"
.Selection.Paste
'WScript.Echo "Paste"
'.Selection.InsertFile templatefile, "", False,False,False
'WScript.Echo "Insert File"
Set table=doc.Tables(tableID)
tableID=tableID + 1
table.Cell(2,1).Select
End If
比如这段请帮忙注释!!
作者: andylau112 发布时间: 2007-09-11
高手们,是我讲的不清楚吗?在csdn上发表也没人回应,这边有没有吗?
作者: andylau112 发布时间: 2007-09-11
哎,我是彻底失望了
作者: andylau112 发布时间: 2007-09-11
觉得主要是楼主的提问技巧欠妥。这么长的代码,叫别人注释,工作量是一个方面,加上不知您的知识面,就算注释了也不知您能否看得明白,看不明白就是白费劲,所以别人不想介入。正如2楼所说,建议楼主还是提其中具体的问题,如果对代码一点也看不懂,这样的问题最好迟点再提。
作者: sylun 发布时间: 2007-09-11

作者: 人在中行 发布时间: 2011-01-09
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28