-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdoc_str.py
More file actions
30 lines (27 loc) · 751 Bytes
/
doc_str.py
File metadata and controls
30 lines (27 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
vbs_header = '''Option Explicit
Sub Main()
Dim oWord, oDoc
Set oWord = CreateObject("Word.Application")
Set oDoc = oWord.Documents.Add()
Dim regStrings(3)
Dim fieldStrings(5)
'''
vbs_reg = '''
' Reg {num}
regStrings(0) = "{desc}"
regStrings(1) = "{name}"
regStrings(2) = "{offset}"
InsertRegTable oWord, oDoc.Paragraphs.Last.Range, regStrings
'''
vbs_field = ''' ' Field {num}
fieldStrings(0) = "{name}"
fieldStrings(1) = "[{bits}]"
fieldStrings(2) = "{type}"
fieldStrings(3) = {default}
fieldStrings(4) = "{desc}"
InsertFieldRow oDoc.Range.Tables(oDoc.Range.Tables.Count), fieldStrings
'''
vbs_footer = '''
oDoc.SaveAs("D:\\regs\svn\\test_doc.docx")
oWord.Quit
End Sub'''