二十四史简介——金史

《金史》撰成于元代,全书一百三十五卷,其中本纪十九卷,志三十九卷,表四卷,列传七十三卷,是反映女真族所建金朝的兴衰始末的重要史籍。
《金史》是元修三史之一,最早议修于元世祖中统二年(公元1261年),以后在至元元年、十六年,以及仁宗朝、文宗朝都分别议论过修史的事,都因义例难定未付诸实行,直到元顺帝至正三年(公元1343年),才决定“各与正统”,《辽》、《金》、《宋》三史分别撰修。翌年十一月,《金史》告成,前后用了不到一年的时间。修三史的都总裁官是右丞相脱脱,参加修《金史》的有铁木尔塔识、张起岩、欧阳玄、王沂、杨宗瑞等,其中欧阳玄的贡献最为突出,他制订《金史》撰修的发凡举例,书中的论、赞、表、奏皆他属笔。

AutoCAD 的图纸 DXF 组码

-1 = 图元名称 (Entity Name)0 = 图元类型 (Entity Type)
5 = 图元句柄 (Handle)6 = 线型 (Line Type)
8 = 图层名称 (Layer Name)48 = 线型比例 (Line Type Scale)
62 = 颜色号码 (Color Number)67 = 绘图空间 (1 = 图纸空间)


弧 (ARC)

10 = 圆心点40 = 半径50 = 起点角度51 = 终点角度


圆 (CIRCLE)

10 = 圆心点40 = 半径  


注标 (DIMENSION)

1 = 注标文字2 = 图块名称3 = 文字字型10 = 定义点坐标
11 = 文字中间点坐标13 = 第1定义点坐标14 = 第2定义点坐标15 = 第3定义点坐标
50 = 注标线旋转角度53 = 文字旋转角度70 = 注标形式 

(0=线性 1=对齐式 2=角度 3=直径 4=半径 6=坐标式 70=坐标式 128=文字巳被修改)
椭圆 (ELLIPSE)

10 = 圆心点11 = 长轴端点相对于圆心的相对坐标40 = 长短轴百份比
41 = 椭圆弧起点角度42 = 椭圆弧终点角度 


填涂 (HATCH)

2 = 图样名称41 = 填涂比例5 = 角度71 = 是否为关系型

插入图块 (INSERT)

2 = 图块名称10 = 插入点41 = X方向比例42 = Y方向比例
43 = Z方向比例44 = 行间距45 = 列间距50 = 旋转角度
70 = 行数量72 = 列数量  


引线 (LEADER)

3 = 形式名称7 = 字型10 = 箭头起点坐标40 = 文字高度
41 = 文字宽度76 = 引线顶点数目  

73 = 文字字型 (0=一般  1=公差  2=图块  3=没有)
线 (LINE)

10 = 起点11 = 终点  


细聚合线 (LWPOLYLINE)

10 = 顶点坐标40 = 区段起点宽度11 = 区段终点宽度
42 = 弯曲系数(即凸度,直线为0)43 = 是否单一线宽70 = 断续线模式
90 = 顶点数目  


(SOLID)

10 = 第1点坐标11 = 第2点坐标12 = 第3点坐标14 = 第4点坐标


文字 (TEXT)

1 = 文字内容7 = 字型10 = 插入点11 = 对齐点
40 = 文字高度50 = 旋转角度41 = X方向比例系数51 = 倾斜角度

71 = 显示模式 (1=正常  2=左右颠倒  3=上下颠倒)
72 = 水平对齐模式 (0=靠左  1=中央  2=靠右  3=Align  4=Middle  5=Fit)
73 = 垂直对齐模式 (0=基线  1=底部  2=中央  3=顶部)

非图形常用DXF群码
共享DXF群码

-1 = 图元名称0 = 图元类型5 = 图元句柄70 = 位旗标


图块 (BLOCK)

1 = 外部参考路径2 = 图块名称10 = 插入点70 = 旗标

(1=匿名  2=外部从属  4=外部参考  16=巳并入外部参考 32=巳贴附外部参考  64=巳参考)
图层 (LAYER)

2 = 图层名称6 = 线型名称62 = 颜色号号70 = 旗标 (1=冻结  4=锁护)


线型 (LINETYPE)

2 = 线型名称3 = 描述文句40 = 图样总长度73 =图样元素数目

74 = 模式 (0=一般  2=包含文字  4=包含造形)
文字样式 (STYLE)

2 = 样式名称3 = 英文字檔名4 = 大字体文件名42 = 宽度系数
50 = 倾斜角度   
40 = 高度模式 (0=指定  1=不指定)71 = 显示模式 (0=正常  2=左右颠倒  4=上下颠倒


用户坐标系 (UCS)

2 = UCS名称10 = 原点坐标(WCS)11 = X轴方向(WCS)12 = Y轴方向(WCS)

二十四史简介——辽史

《辽史》撰成于元代,全书一百一十六卷,包括本纪三十卷,志三十二卷,表八卷,列传四十五卷,国语解一卷。
本书较系统地记载了我国古代契丹族建立的辽朝二百多年的历史,并兼载辽立国以前契丹的状况,以及辽灭亡后耶律大石所建西辽的概况,是研究辽和契丹、西辽的重要史籍。
辽太祖耶律阿保机建国之初,依仿汉人制度,设立监修国史官,并且仿照中原的做法,撰修《起居注》、《日历》、《实录》等。辽代曾先后四次撰修实录。
金朝建立后,很注意总结前朝的兴衰得失,着力修撰《辽史》,前后撰成两部《辽史》。第一次是熙宗皇统年间(公元1141–1149年),耶律固主持修纂,最后由萧永祺完成,此《辽史》有纪三十卷,志五卷,传四十卷,但未曾刊行。
第二次撰修《辽史》,由廉惠山海牙、王沂、陈绎曾分撰,从至正三年四月开始撰写,四年三月即告脱稿,仅仅用了十一个月的时间。这是因为前人所撰《辽史》和实录提供了良好的基础。
一般人认为,元修《辽史》失之简略,但不应否定它特有的长处。《辽史》的志、表多有特色,其中一些志、表是其它正史所没有的。

使用递归方法,遍历指定目录

Dim FolderArray(), FileArray() As String ‘全名
Dim FolderCount, FileCount As Integer

Dim I, J As Integer
SearchFiles “E:\”, “*”, True ‘查找所有文件
If IsEmptyArray(FileArray) Then Exit Sub
For I = LBound(FolderArray) To UBound(FolderArray)
Debug.Print FolderArray(I)
Next I
Debug.Print FolderCount; “Folders”
For I = LBound(FileArray) To UBound(FileArray)
Debug.Print FileArray(I)
Next I
Debug.Print FileCount; “Files”
‘调用示例(支持通配符)
‘SearchFiles “C:\Program Files\WinRAR\”, “” ‘查找所有文件 ‘SearchFiles “C:\Program Files\WinRAR\”, “.exe” ‘查找所有exe文件
‘SearchFiles “C:\Program Files\WinRAR\”, “in.exe” ‘查找文件名中包含有 in 的exe文件

Private Function SearchFiles(sTargetPath As String, sPartialName As String, Optional bAllPaths As Boolean = True)
Dim I, J As Integer
Dim SubFolderCount As Long
Dim SubFolderArray() As String ‘子文件夹全名
Dim sPath As String ‘文件名或子文件夹短名
If Right(sTargetPath, 1) <> “\” Then sTargetPath = sTargetPath & “\”
FolderCount = FolderCount + 1
ReDim Preserve FolderArray(1 To FolderCount)
FolderArray(FolderCount) = sTargetPath
sPath = Dir(GetFullName(sTargetPath, sPartialName)) ‘查找第一个文件
Do While Len(sPath) ‘循环到没有文件为止
FileCount = FileCount + 1
ReDim Preserve FileArray(1 To FileCount)
FileArray(FileCount) = sTargetPath & sPath ‘将文件目录和文件名组合,并存放到数组中
sPath = Dir ‘查找下一个文件
DoEvents ‘让出控制权
Loop
If Not bAllPaths Then Exit Function
sPath = Dir(sTargetPath, vbDirectory) ‘查找第一个文件夹
Do While Len(sPath) ‘循环到没有文件夹为止
If Left(sPath, 1) <> “.” Then ‘为了防止重复查找
If GetAttr(GetFullName(sTargetPath, sPath)) And vbDirectory Then ‘如果是文件夹则… …
SubFolderCount = SubFolderCount + 1
ReDim Preserve SubFolderArray(1 To SubFolderCount)
SubFolderArray(SubFolderCount) = GetFullName(sTargetPath, sPath) & “\” ‘将目录和文件夹名称组合形成新的目录,并存放到数组中
End If
End If
sPath = Dir ‘查找下一个文件夹
DoEvents ‘让出控制权
Loop
For I = 1 To SubFolderCount ‘使用递归方法,遍历所有目录
SearchFiles SubFolderArray(I), sPartialName
Next
End Function

Word 函数系列之一

Public Sub ReplaceWord(ByVal vWord As Variant, ByVal sOld As String, ByVal sNew As String)
Const wdReplaceAll = 2
Const wdFindStop = 0
Dim oRange As Object
Set oRange = vWord.Selection.Range
‘先判断是否有选中区域,没有选中则表示整个文档
If oRange.Start = oRange.End Then
Set oRange = vWord.ActiveDocument.Content
End If
With oRange.Find
‘批量查找替换 sOld 为 sNew
bRet = .Execute(FindText:=sOld, replacewith:=sNew, Replace:=wdReplaceAll)
‘Debug.Print bRet
‘Debug.Print oRange.Words.Count
End With
End Sub

Public Sub InsPageNumber(ByVal vWord As Variant) ‘其实是 vDocument
On Error GoTo ERR_PAGENUMBER
‘设置Word文档第一页页码
Dim oRange As Object
Set oRange = vWord.ActiveDocument.Sections(1).Footers(1).Range ‘wdHeaderFooterPrimary = 1
With oRange
.InsertAfter “第”
‘.Font.Size = 14
.Collapse Direction:=0 ‘wdCollapseEnd = 0
‘插入页码域
.Fields.Add Range:=oRange, Type:=-1, Text:=”PAGE * Arabic “, PreserveFormatting:=True ‘wdFieldEmpty = -1
.Expand Unit:=2 ‘wdWord = 2
.InsertAfter “页”
.InsertAfter “共”
.Collapse Direction:=0 ‘wdCollapseEnd = 0
‘插入页数域
.Fields.Add Range:=oRange, Type:=-1, Text:=”NUMPAGES * Arabic “, PreserveFormatting:=True ‘wdFieldEmpty = -1
.Expand Unit:=2 ‘wdWord = 2
.InsertAfter “页”
‘.InsertAfter “YagerSoft”
.ParagraphFormat.Alignment = 2 ‘wdAlignParagraphRight = 2 ‘右对齐
End With
‘隐藏页眉的横线
vWord.ActiveDocument.Sections(1).Headers(1).Range.Borders(-3).Visible = False ‘wdBorderBottom = -3
‘取得页眉的内容
‘Debug.Print vWord.ActiveDocument.Sections(1).Headers(2).Range.Text ‘wdHeaderFooterFirstPage = 2
Set oRange = Nothing
On Error GoTo 0
Exit Sub
ERR_PAGENUMBER:
On Error GoTo 0
End Sub

Public Sub InsPageBreak(ByVal vWord As Variant)
On Error GoTo ERR_BREAK
‘wdPropertyTitle = 1标题
‘wdPropertySubject = 2主题
‘wdPropertyAuthor = 3作者
‘wdPropertyKeywords = 4关键词
‘wdPropertyComments = 5批注
‘wdPropertyTemplate = 6模板
‘wdPropertyLastAuthor = 7上一个作者
‘wdPropertyRevision = 8修订次数
‘wdPropertyAppName = 9应用程序名
‘wdPropertyTimeLastPrinted = 10上次打印时间
‘wdPropertyTimeCreated = 11创建时间
‘wdPropertyTimeLastSaved = 12上次保存时间
‘wdPropertyVBATotalEdit = 13编辑时间总计
‘wdPropertyPages = 14页数
‘wdPropertyWords = 15字数
‘wdPropertyCharacters = 16字符数
‘wdPropertySecurity = 17安全性
‘wdPropertyCategory = 18类别
‘wdPropertyFormat = 19
‘wdPropertyManager = 20经理
‘wdPropertyCompany = 21公司
‘wdPropertyBytes = 22字节数
‘wdPropertyLines = 23行数
‘wdPropertyParas = 24段数(空白文档 BuiltInDocumentProperties(wdPropertyParas) = 0,而 vWord.ActiveDocument.Paragraphs.Count = 1)
‘wdPropertySlides = 25
‘wdPropertyNotes = 26注释
‘wdPropertyHiddenSlides = 27
‘wdPropertyMMClips = 28
‘wdPropertyHyperlinkBase = 29
‘wdPropertyCharsWSpaces = 30字符数(计空格)
If vWord.ActiveDocument.BuiltInDocumentProperties(15) = 0 Then Exit Sub ‘wdPropertyWords = 15
vWord.Selection.EndKey Unit:=6 ‘wdStory = 6 ‘将光标移到最后
vWord.Selection.InsertBreak Type:=7 ‘wdPageBreak = 7 ‘插入分页符
On Error GoTo 0
Exit Sub
ERR_BREAK:
On Error GoTo 0
End Sub

Public Function FindWord(ByVal vWord As Variant, ByVal sData As String) As Boolean
Dim oSelection As Object
Set oSelection = vWord.ActiveDocument.Content
‘利用FIND查找 sData ,从光标之处开始查找,查找到后选中。
With oSelection.Find
‘查找的方向向下
.Forward = True
‘取消在查找或替换操作中所指定文本的文本格式和段落格式
.ClearFormatting
‘查找操作查找仅完整单词,而不是较长单词的一部分的文本
.MatchWholeWord = True
‘查找时不区分大小写
.MatchCase = False
‘到达文档末尾时,继续从文档开头进行搜索
.Wrap = 1 ‘wdFindContinue
‘运行指定的查找操作。如果查找成功,则返回 True
.Execute FindText:=sData
End With
FindWord = oSelection.Find.Execute
End Function

Public Function GetTextSite(ByVal vWord As Variant, ByVal sText As String) As Integer ‘返回 sText 在 vWord 中首次出现的段号
‘耗时过长不宜用
Dim I As Integer, J As Integer
GetTextSite = 0
If vWord Is Nothing Then Exit Function
If vWord.Documents.Count = 0 Then Exit Function
If sText = “” Then Exit Function
For I = 1 To vWord.ActiveDocument.Paragraphs.Count
DoEvents
‘If vWord.ActiveDocument.Paragraphs(I).Range.Text = sText Then
If InStr(1, vWord.ActiveDocument.Paragraphs(I).Range.Text, sText, vbTextCompare) > 0 Then
GetTextSite = I
Exit For
End If
Next I
End Function