1.章条代号之后为两个空格

2.章编号、条编号、无标题条编号、目次内条编号、标准编号,编号与文字间自动空1个汉字格
This commit is contained in:
范强强
2023-09-06 13:38:14 +08:00
parent 275064da8b
commit dffe84dd79
3 changed files with 49 additions and 26 deletions
+29 -23
View File
@@ -148,39 +148,45 @@
const oTextPr9 = oHeading1Style6.GetParaPr() const oTextPr9 = oHeading1Style6.GetParaPr()
oTextPr9.SetSpacingAfter(10) oTextPr9.SetSpacingAfter(10)
// var oHeading1Style = oDocument.CreateStyle("Heading 1"); var oHeading1Style = oDocument.CreateStyle("Heading 1");
// const oTextPr = oHeading1Style.GetTextPr(); const oTextPr = oHeading1Style.GetTextPr();
// oTextPr.SetFontFamily("黑体"); oTextPr.SetFontFamily("黑体");
// oTextPr.SetColor(0, 0, 0); oTextPr.SetFontSize(21)
oTextPr.SetColor(0, 0, 0);
// //
// //
// var oHeading1Style1 = oDocument.CreateStyle("Heading 2"); var oHeading1Style1 = oDocument.CreateStyle("Heading 2");
// const oTextPr1 = oHeading1Style1.GetTextPr(); const oTextPr1 = oHeading1Style1.GetTextPr();
// oTextPr1.SetFontFamily("黑体"); oTextPr1.SetFontFamily("黑体");
// oTextPr1.SetColor(0, 0, 0); oTextPr1.SetFontSize(21)
oTextPr1.SetColor(0, 0, 0);
// //
// //
// var oHeading1Style2 = oDocument.CreateStyle("Heading 3"); var oHeading1Style2 = oDocument.CreateStyle("Heading 3");
// const oTextPr2 = oHeading1Style2.GetTextPr(); const oTextPr2 = oHeading1Style2.GetTextPr();
// oTextPr2.SetFontFamily("黑体"); oTextPr2.SetFontFamily("黑体");
// oTextPr2.SetColor(0, 0, 0); oTextPr2.SetFontSize(21)
oTextPr2.SetColor(0, 0, 0);
// //
// //
// var oHeading1Style3 = oDocument.CreateStyle("Heading 4"); var oHeading1Style3 = oDocument.CreateStyle("Heading 4");
// const oTextPr3 = oHeading1Style3.GetTextPr(); const oTextPr3 = oHeading1Style3.GetTextPr();
// oTextPr3.SetFontFamily("黑体"); oTextPr3.SetFontFamily("黑体");
oTextPr3.SetFontSize(21)
// oTextPr3.SetColor(0, 0, 0); // oTextPr3.SetColor(0, 0, 0);
// //
// //
// var oHeading1Style4 = oDocument.CreateStyle("Heading 5"); var oHeading1Style4 = oDocument.CreateStyle("Heading 5");
// const oTextPr4 = oHeading1Style4.GetTextPr(); const oTextPr4 = oHeading1Style4.GetTextPr();
// oTextPr4.SetFontFamily("黑体"); oTextPr4.SetFontFamily("黑体");
// oTextPr4.SetColor(0, 0, 0); oTextPr4.SetFontSize(21)
oTextPr4.SetColor(0, 0, 0);
// //
// var oHeading1Style5 = oDocument.CreateStyle("Heading 6"); var oHeading1Style5 = oDocument.CreateStyle("Heading 6");
// const oTextPr5 = oHeading1Style5.GetTextPr(); const oTextPr5 = oHeading1Style5.GetTextPr();
// oTextPr5.SetFontFamily("黑体"); oTextPr5.SetFontFamily("黑体");
// oTextPr5.SetColor(0, 0, 0); oTextPr5.SetFontSize(21)
oTextPr5.SetColor(0, 0, 0);
var oNormalStyle = oDocument.GetDefaultStyle('numbering') var oNormalStyle = oDocument.GetDefaultStyle('numbering')
+15 -3
View File
@@ -1150,7 +1150,7 @@ export default {
const oParagraph = Api.CreateParagraph() const oParagraph = Api.CreateParagraph()
var oNewDocumentStyle = oDocument.GetStyle('Heading 1') var oNewDocumentStyle = oDocument.GetStyle('Heading 1')
oParagraph.SetStyle(oNewDocumentStyle) oParagraph.SetStyle(oNewDocumentStyle)
oParagraph.AddText('范围') oParagraph.AddText(' 范围')
oParagraph.SetNumbering(oNumLvl) oParagraph.SetNumbering(oNumLvl)
oParagraph.SetFontFamily('黑体') oParagraph.SetFontFamily('黑体')
oParagraph.SetFontSize(21) oParagraph.SetFontSize(21)
@@ -1182,7 +1182,7 @@ export default {
oDocument.InsertContent([oParagraphA]) oDocument.InsertContent([oParagraphA])
const oParagraph4 = Api.CreateParagraph() const oParagraph4 = Api.CreateParagraph()
oParagraph4.AddText('规范性引用文件') oParagraph4.AddText(' 规范性引用文件')
oParagraph4.SetNumbering(oNumLvl) oParagraph4.SetNumbering(oNumLvl)
oParagraph4.SetStyle(oNewDocumentStyle) oParagraph4.SetStyle(oNewDocumentStyle)
oParagraph4.SetBold(false) oParagraph4.SetBold(false)
@@ -1238,7 +1238,7 @@ export default {
const oParagraph8 = Api.CreateParagraph() const oParagraph8 = Api.CreateParagraph()
oParagraph8.SetStyle(oNewDocumentStyle) oParagraph8.SetStyle(oNewDocumentStyle)
oParagraph8.AddText('术语和定义') oParagraph8.AddText(' 术语和定义')
oParagraph8.SetBold(false) oParagraph8.SetBold(false)
oParagraph8.SetNumbering(oNumLvl) oParagraph8.SetNumbering(oNumLvl)
oParagraph8.SetFontFamily('黑体') oParagraph8.SetFontFamily('黑体')
@@ -1793,6 +1793,18 @@ export default {
if (list && list.length > 0) { if (list && list.length > 0) {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
list[i].SetFontFamily('宋体') list[i].SetFontFamily('宋体')
if (list[i].GetText().indexOf('前 言')!= -1){
let text = list[i].GetText()
text = text.replace(/\s*/g, '')
text = text.substring(0, 2)
oDocument.SearchAndReplace({ 'searchString': '前 言 ', 'replaceString': text })
}
if (list[i].GetText().indexOf('引 言')!= -1){
let text = list[i].GetText()
text = text.replace(/\s*/g, '')
text = text.substring(0, 2)
oDocument.SearchAndReplace({ 'searchString': '引 言 ', 'replaceString': text })
}
if (list[i].GetText().indexOf('附 录') != -1 || list[i].GetText().indexOf('附录') != -1) { if (list[i].GetText().indexOf('附 录') != -1 || list[i].GetText().indexOf('附录') != -1) {
let text = list[i].GetText() let text = list[i].GetText()
text = text.replace(/\s*/g, '') text = text.replace(/\s*/g, '')
@@ -218,6 +218,7 @@
oParagraph.SetStyle(oNewDocumentStyle); oParagraph.SetStyle(oNewDocumentStyle);
oParagraph.SetFontSize(21); oParagraph.SetFontSize(21);
// oParagraph.SetJc("left"); // oParagraph.SetJc("left");
oParagraph.AddText(' ')
oParagraph.SetColor(0, 0, 0); oParagraph.SetColor(0, 0, 0);
oParagraph.SetFontFamily("黑体"); oParagraph.SetFontFamily("黑体");
oDocument.InsertContent([oParagraph]) oDocument.InsertContent([oParagraph])
@@ -488,6 +489,8 @@
oParagraph.RemoveAllElements() oParagraph.RemoveAllElements()
oParagraph.AddLineBreak(); oParagraph.AddLineBreak();
oParagraph.AddText(' '+text) oParagraph.AddText(' '+text)
}else{
oParagraph.AddText(' ')
} }
oParagraph.SetBold(false); oParagraph.SetBold(false);
oParagraph.SetFontFamily("黑体"); oParagraph.SetFontFamily("黑体");
@@ -723,6 +726,8 @@
oParagraph.RemoveAllElements() oParagraph.RemoveAllElements()
oParagraph.AddLineBreak(); oParagraph.AddLineBreak();
oParagraph.AddText(' '+text) oParagraph.AddText(' '+text)
}else{
oParagraph.AddText(' ')
} }
oParagraph.SetBold(false); oParagraph.SetBold(false);
oParagraph.SetFontSize(21); oParagraph.SetFontSize(21);