fix 保存后编号空格问题

This commit is contained in:
赵霄
2024-04-24 11:47:50 +08:00
parent e402f62fcd
commit c96d4371a8
5 changed files with 51 additions and 257 deletions
@@ -13,7 +13,7 @@
<script>
export default {
methods: {
handleClickOne() {
handleClickOne () {
window.Asc.scope.guid = window.Asc.plugin.info.guid
window.Asc.scope.suffType = ''
this.ctx.callCommand(() => {
@@ -22,7 +22,7 @@ export default {
let oNumbering = oDocument.CreateNumbering('numbered')
const oNumLvl = oNumbering.GetLevel(0)
oNumLvl.SetCustomType('decimalZero', '——', 'right')
oNumLvl.SetSuff('none')
oNumLvl.SetSuff('tab')
var oParaPr = oNumLvl.GetParaPr()
oParaPr.SetSpacingLine(280, 'auto')
oParaPr.SetIndFirstLine(0)
@@ -43,30 +43,20 @@ export default {
aSearch[0].SetFontSize(10.5)
}
}
// let GetNext = oParagraph.GetNext()
// GetNext.Delete()
let GetNext = oParagraph.GetNext()
GetNext.Delete()
} catch (error) {
console.error(error)
}
}, false)
},
paragraphClick() {
paragraphClick () {
window.Asc.scope.guid = window.Asc.plugin.info.guid
window.Asc.scope.suffType = ''
this.ctx.callCommand(() => {
try {
const oDocument = Api.GetDocument()
// let oNumbering = oDocument.CreateNumbering('numbered')
// const oNumLvl = oNumbering.GetLevel(0)
// oNumLvl.SetCustomType('decimalZero', " ", "left")
// oNumLvl.SetSuff("space");
// var oParaPr = oNumLvl.GetParaPr();
// oParaPr.SetSpacingLine(280, "auto");
// oParaPr.SetJc("both");
// oParaPr.SetIndFirstLine(-500);
// // oParaPr.SetIndLeft(366)
const oParagraph = Api.CreateParagraph()
// oParagraph.SetNumbering(oNumLvl)
oParagraph.SetContextualSpacing(true)
oParagraph.SetFontFamily('宋体')
oParagraph.SetFontSize(21)
@@ -81,14 +71,14 @@ export default {
aSearch[0].SetFontSize(10.5)
}
}
// let GetNext = oParagraph.GetNext()
// GetNext.Delete()
let GetNext = oParagraph.GetNext()
GetNext.Delete()
} catch (error) {
console.error(error)
}
}, false)
},
handleClickTwo1() {
handleClickTwo1 () {
window.Asc.scope.guid = window.Asc.plugin.info.guid
window.Asc.scope.suffType = ''
this.ctx.callCommand(() => {
@@ -96,19 +86,16 @@ export default {
const oDocument = Api.GetDocument()
let oNumbering = oDocument.CreateNumbering('bullet')
const oNumLvl = oNumbering.GetLevel(0)
oNumLvl.SetSuff('none')
oNumLvl.SetSuff('tab')
const oParagraph = Api.CreateParagraph()
var oParaPr = oNumLvl.GetParaPr()
oParaPr.SetSpacingLine(280, 'auto')
// oParaPr.SetIndRight(80)
// oParaPr.SetIndFirstLine(120);
oParagraph.SetNumbering(oNumLvl)
oParagraph.SetContextualSpacing(true)
oParagraph.SetFontFamily('宋体')
oParagraph.SetFontSize(21)
oParagraph.SetIndLeft(1270)
oParagraph.SetHighlight(255, 255, 0)
oParagraph.AddText(' ')
oDocument.InsertContent([oParagraph])
let text = oParagraph.GetText()
if (text) {
@@ -118,14 +105,14 @@ export default {
aSearch[0].SetFontSize(10.5)
}
}
// let GetNext = oParagraph.GetNext()
// GetNext.Delete()
let GetNext = oParagraph.GetNext()
GetNext.Delete()
} catch (error) {
console.error(error)
}
}, false)
},
handleClick(suffType) {
handleClick (suffType) {
window.Asc.scope.guid = window.Asc.plugin.info.guid
window.Asc.scope.suffType = ''
this.ctx.callCommand(() => {
@@ -135,21 +122,21 @@ export default {
let oNumbering = oDocument.CreateNumbering('numbered')
numbering = oNumbering.GetLevel(0)
numbering.SetTemplateType('a)')
numbering.SetSuff('none')
const oParagraph = Api.CreateParagraph()
// oParagraph.SetSpacingLine(400, "auto");
let oTextPr = numbering.GetTextPr()
oTextPr.SetFontFamily('宋体')
var oParaPr = numbering.GetParaPr()
oParaPr.SetSpacingLine(240, 'auto')
oParaPr.SetJc('none')
oParaPr.SetJc('tab')
oParaPr.SetIndFirstLine(-420)
// oParaPr.SetIndFirstLine(0);
oParagraph.SetNumbering(numbering)
oParagraph.SetContextualSpacing(true)
oParagraph.SetFontFamily('宋体')
oParagraph.SetIndLeft(840)
oParagraph.SetFontSize(21)
oParagraph.SetHighlight(255, 255, 0)
oParagraph.AddText(' ')
oDocument.InsertContent([oParagraph])
let text = oParagraph.GetText()
if (text) {
@@ -159,15 +146,12 @@ export default {
aSearch[0].SetFontSize(10.5)
}
}
// let GetNext = oParagraph.GetNext()
// GetNext.Delete()
// oNumbering = oParagraph.GetNumbering().GetNumbering()
} catch (error) {
console.error(error)
}
}, false)
},
handleClickTwo() {
handleClickTwo () {
window.Asc.scope.guid = window.Asc.plugin.info.guid
window.Asc.scope.suffType = ''
this.ctx.callCommand(() => {
@@ -185,7 +169,6 @@ export default {
numbering.SetCustomType('decimal', '%1)', 'left')
}
}
numbering.SetSuff('none')
let oTextPr = numbering.GetTextPr()
oTextPr.SetFontFamily('宋体')
const oParaPr = numbering.GetParaPr()
@@ -200,7 +183,6 @@ export default {
oParagraph.SetFontSize(21)
oParagraph.SetIndLeft(1260)
oParagraph.SetHighlight(255, 255, 0)
oParagraph.AddText(' ')
oDocument.InsertContent([oParagraph])
let text = oParagraph.GetText()
if (text) {
@@ -210,8 +192,6 @@ export default {
aSearch[0].SetFontSize(10.5)
}
}
// let GetNext = oParagraph.GetNext()
// GetNext.Delete()
} catch (error) {
console.error(error)
}
+1 -2
View File
@@ -406,7 +406,7 @@ export default {
}
}
}
oNumLvl.SetSuff('none')
oNumLvl.SetSuff('tab')
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
const oTextPr3 = oNewDocumentStyle.GetTextPr()
oTextPr3.SetFontFamily('黑体')
@@ -421,7 +421,6 @@ export default {
oParagraph.SetFontFamily('黑体')
oParagraph.SetSpacingAfter(34, false)
oParagraph.SetNumbering(oNumLvl)
oParagraph.AddText(' ')
oDocument.InsertContent([oParagraph])
// let GetNext = oParagraph.GetNext()
// GetNext.Delete()
+7 -13
View File
@@ -939,12 +939,6 @@ export default {
try {
console.log('初始化正文,start')
const oDocument = Api.GetDocument()
// 处理编号格式,.SetSuff('none')为关键代码,不然会出现标题后面的空格变大的问题
const aNumberedParagraphs = oDocument.GetAllNumberedParagraphs()
// for (let i = 0; i < aNumberedParagraphs.length; i++) {
// const oNumLvl = aNumberedParagraphs[i].GetNumbering()
// oNumLvl.SetSuff('none')
// }
const AllContentControls = oDocument.GetAllContentControls()
let flag = false
for (let i = 0; i < AllContentControls.length; i++) {
@@ -1014,15 +1008,15 @@ export default {
let oNumbering = oDocument.CreateNumbering('numbered')
const oNumLvl = oNumbering.GetLevel(0)
const sFormatString = '%1'
const sFormatString = '%1 '
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
oNumLvl.SetSuff('space')
var oParaPr = oNumLvl.GetParaPr()
oNumLvl.SetSuff('none')
const oParaPr = oNumLvl.GetParaPr()
oParaPr.SetIndFirstLine(0)
const oParagraph = Api.CreateParagraph()
var oNewDocumentStyle = oDocument.GetStyle('Heading 1')
const oNewDocumentStyle = oDocument.GetStyle('Heading 1')
oParagraph.SetStyle(oNewDocumentStyle)
oParagraph.AddText(' 范围')
oParagraph.AddText('范围')
oParagraph.SetNumbering(oNumLvl)
oParagraph.SetFontFamily('黑体')
oParagraph.SetFontSize(21)
@@ -1054,7 +1048,7 @@ export default {
oDocument.InsertContent([oParagraphA])
const oParagraph4 = Api.CreateParagraph()
oParagraph4.AddText(' 规范性引用文件')
oParagraph4.AddText('规范性引用文件')
oParagraph4.SetNumbering(oNumLvl)
oParagraph4.SetStyle(oNewDocumentStyle)
oParagraph4.SetBold(false)
@@ -1109,7 +1103,7 @@ export default {
const oParagraph8 = Api.CreateParagraph()
oParagraph8.SetStyle(oNewDocumentStyle)
oParagraph8.AddText(' 术语和定义')
oParagraph8.AddText('术语和定义')
oParagraph8.SetBold(false)
oParagraph8.SetNumbering(oNumLvl)
oParagraph8.SetFontFamily('黑体')
+2 -136
View File
@@ -133,149 +133,15 @@ export default {
cellEle.SetSpacingAfter(10)
cellEle.SetFontSize(18)
cellEle.SetColor(0, 0, 0)
// if (i === 0) {
// oTable
// .GetRow(i)
// .GetCell(j)
// .SetCellBorderTop("single", 0, 0, 255, 255, 255);
// oTable
// .GetRow(i)
// .GetCell(j)
// .SetCellBorderRight("single", 0, 0, 255, 255, 255);
// oTable
// .GetRow(i)
// .GetCell(j)
// .SetCellBorderBottom("single", 0, 0, 255, 255, 255);
// oTable
// .GetRow(i)
// .GetCell(j)
// .SetCellBorderLeft("single", 0, 0, 255, 255, 255);
// // cellEle.SetFontFamily("宋体");
// } else
// 表头
// if (i === 0) {
// oTable
// .GetRow(i)
// .GetCell(j)
// .SetCellBorderTop("single", 9, 0, 0, 0, 0);
// oTable
// .GetRow(i)
// .GetCell(j)
// .SetCellBorderRight("single", 6, 0, 0, 0, 0);
// oTable
// .GetRow(i)
// .GetCell(j)
// .SetCellBorderBottom("single", 9, 0, 0, 0, 0);
// oTable
// .GetRow(i)
// .GetCell(j)
// .SetCellBorderLeft("single", 6, 0, 0, 0, 0);
// cellEle.SetFontFamily("宋体");
// } else if (i === oRowsCount - 2) {
// oTable
// .GetRow(i)
// .GetCell(j)
// .SetCellBorderBottom("single", 9, 0, 0, 0, 0);
// } else {
// cellEle.SetFontFamily("宋体");
// }
cellEle.SetFontSize(18)
}
}
// const oParagraph = oDocument.Document.GetCurrentParagraph(
// undefined,
// undefined,
// { CheckDocContent: true }
// );
// const newParagraph = Api.CreateParagraph();
// newParagraph.SetParagraphWx(oParagraph);
// var oRow = oTable.GetRow(0);
// oRow.MergeCells();
// const oCell = oTable.GetRow(0).GetCell(0);
// const oInlineLvlSdt = Api.CreateInlineLvlSdt();
// oInlineLvlSdt.SetAlias("smtc.table");
// let oNumbering = null,
// oNumLvl = null;
//
// // 获取全部控件,找到smtc.table,从而得到编号
// const AllControl = oDocument.GetAllContentControls();
// for (let i = 0; i < AllControl.length; i++) {
// if (AllControl[i].GetAlias() === "smtc.table") {
// const tableContent = AllControl[i]
// .GetElement(0)
// .GetParentTableCell()
// .GetContent();
// const count = tableContent.GetElementsCount();
// for (let j = 0; j < count; j++) {
// const ele = tableContent.GetElement(j);
// if (
// ele &&
// ele.GetClassType() === "paragraph" &&
// ele.GetNumbering() &&
// ele.GetNumbering().GetLevelIndex() === 0
// ) {
// oNumLvl = ele.GetNumbering();
// break;
// }
// }
// }
// }
// if (!oNumLvl) {
// oNumbering = oDocument.CreateNumbering("numbered");
// oNumLvl = oNumbering.GetLevel(0);
// const sFormatString = "表 %1 ";
// oNumLvl.SetCustomType("decimal", sFormatString, "center");
// }
// var textPr = oNumLvl.GetTextPr();
// textPr.SetFontFamily("黑体");
// textPr.SetFontSize(21)
// const CNParagraph = Api.CreateParagraph();
// CNParagraph.SetJc("center");
// CNParagraph.AddText("企业技术标准类别及代号");
// CNParagraph.SetFontSize(21);
// CNParagraph.SetFontFamily("黑体");
// CNParagraph.SetSpacingAfter(0)
// CNParagraph.AddInlineLvlSdt(oInlineLvlSdt);
// CNParagraph.SetNumbering(oNumLvl);
// oCell.AddElement(1, CNParagraph);
// 获取编号文本
// const tableNum = CNParagraph.Paragraph.GetNumberingText();
// const Unit = Api.CreateParagraph();
// Unit.SetJc("right");
// const UnitCN = Api.CreateRun();
// UnitCN.AddText("单位为XXX");
// UnitCN.SetFontSize(21);
// UnitCN.SetFontFamily("SimHei");
// Unit.AddElement(UnitCN);
// oCell.AddElement(1, Unit);
// oCell.AddElement(2, oTable);
// 表格注
const oLastRow = oTable.GetRow(oTable.GetRowsCount() - 1)
oLastRow.MergeCells()
oLastRow.SetHeight('atLeast', 540)
// const noteNumbering = oDocument.CreateNumbering("numbered");
// const noteNumLevel = noteNumbering.GetLevel(0);
// const sFormatString = "注%1:";
// noteNumLevel.SetCustomType("decimal", sFormatString, "center");
// for (let i = 0; i < 3; i++) {
// const noteParagraph = Api.CreateParagraph();
// noteParagraph.SetNumbering(noteNumLevel);
// noteParagraph.AddText("XXX");
// noteParagraph.SetSpacingAfter(10);
// noteParagraph.SetFontFamily('宋体')
// noteParagraph.SetFontSize(23)
// noteParagraph.SetColor(49, 36, 19);
// if (i > 0) {
// oLastRow.GetCell(0).AddElement(i * 2, noteParagraph);
// } else {
// oLastRow.GetCell(0).AddElement(0, noteParagraph);
// }
// }
} catch (e) {
console.log(e)
}
@@ -593,7 +459,7 @@ export default {
}
}
}
oNumLvl.SetSuff('none')
oNumLvl.SetSuff('tab')
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
const oTextPr3 = oNewDocumentStyle.GetTextPr()
oTextPr3.SetFontFamily('黑体')
@@ -607,7 +473,7 @@ export default {
oParagraph.SetSpacingAfter(75, false)
oParagraph.SetSpacingBefore(73.5, false)
oParagraph.SetNumbering(oNumLvl)
oParagraph.AddText(' XXX')
oParagraph.AddText('XXX')
oDocument.InsertContent([oParagraph])
let GetNext = oParagraph.GetNext()
GetNext.SetSpacingAfter(0)
+25 -70
View File
@@ -160,7 +160,7 @@ export default {
} else {
let oNumbering = oDocument.CreateNumbering('numbered')
oNumLvl = oNumbering.GetLevel(0)
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1'
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1 '
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
}
}
@@ -190,7 +190,7 @@ export default {
} else {
let oNumbering = oDocument.CreateNumbering('numbered')
oNumLvl = oNumbering.GetLevel(0)
const sFormatString = '%1'
const sFormatString = '%1 '
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
}
}
@@ -198,7 +198,7 @@ export default {
// oParagraphOne.Delete()
// const oParagraph = Api.CreateParagraph()
const oParagraphNew = Api.CreateParagraph()
oParagraphNew.AddText(' ' + oParagraph.GetText())
oParagraphNew.AddText(oParagraph.GetText())
oParagraph.Delete()
let oTextPr = oNumLvl.GetTextPr()
oTextPr.SetFontFamily('黑体')
@@ -220,8 +220,6 @@ export default {
oTextPr3.SetFontFamily('黑体')
oParagraphNew.SetStyle(oNewDocumentStyle)
oParagraphNew.SetFontSize(21)
// oParagraphNew.SetJc("left");
// oParagraphNew.AddText(' ')
oParagraphNew.SetColor(0, 0, 0)
oParagraphNew.SetFontFamily('黑体')
oDocument.InsertContent([oParagraphNew])
@@ -340,13 +338,13 @@ export default {
}
const oParagraphNew = Api.CreateParagraph()
oParagraphNew.AddText(' ' + oParagraph.GetText())
oParagraphNew.AddText(oParagraph.GetText())
oParagraph.Delete()
let oNewDocumentStyle = null
if (SpacingBefore) {
if (Asc.scope.alias == '1') {
oParagraphNew.SetIndLeft(0)
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2'
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -359,7 +357,7 @@ export default {
oTextPr.SetFontFamily('黑体')
} else if (Asc.scope.alias == '2') {
oParagraphNew.SetIndLeft(0)
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3'
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -370,7 +368,7 @@ export default {
let oTextPr = numbering.GetTextPr()
oTextPr.SetFontFamily('黑体')
} else if (Asc.scope.alias == '3') {
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4'
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -382,7 +380,7 @@ export default {
let oTextPr = numbering.GetTextPr()
oTextPr.SetFontFamily('黑体')
} else if (Asc.scope.alias == '4') {
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5'
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -394,7 +392,7 @@ export default {
let oTextPr = numbering.GetTextPr()
oTextPr.SetFontFamily('黑体')
} else if (Asc.scope.alias == '5') {
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5.%6'
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5.%6 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -409,7 +407,7 @@ export default {
} else {
if (Asc.scope.alias == '1') {
oParagraphNew.SetIndLeft(0)
const sFormatString = '%1.%2'
const sFormatString = '%1.%2 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -422,7 +420,7 @@ export default {
oTextPr.SetFontFamily('黑体')
} else if (Asc.scope.alias == '2') {
oParagraphNew.SetIndLeft(0)
const sFormatString = '%1.%2.%3'
const sFormatString = '%1.%2.%3 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -433,7 +431,7 @@ export default {
let oTextPr = numbering.GetTextPr()
oTextPr.SetFontFamily('黑体')
} else if (Asc.scope.alias == '3') {
const sFormatString = '%1.%2.%3.%4'
const sFormatString = '%1.%2.%3.%4 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -445,7 +443,7 @@ export default {
let oTextPr = numbering.GetTextPr()
oTextPr.SetFontFamily('黑体')
} else if (Asc.scope.alias == '4') {
const sFormatString = '%1.%2.%3.%4.%5'
const sFormatString = '%1.%2.%3.%4.%5 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -457,7 +455,7 @@ export default {
let oTextPr = numbering.GetTextPr()
oTextPr.SetFontFamily('黑体')
} else if (Asc.scope.alias == '5') {
const sFormatString = '%1.%2.%3.%4.%5.%6'
const sFormatString = '%1.%2.%3.%4.%5.%6 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -470,7 +468,6 @@ export default {
oTextPr.SetFontFamily('黑体')
}
}
// oParagraphOne.Delete()
const ParaPr = numbering.GetParaPr()
ParaPr.SetStyle(oNewDocumentStyle)
ParaPr.SetSpacingAfter(140)
@@ -478,27 +475,6 @@ export default {
oParagraphNew.SetNumbering(numbering)
oParagraphNew.SetSpacingAfter(127)
oParagraphNew.SetSpacingBefore(127)
// let isTrue = false
// for (let i = num - 1; i >= 0; i--) {
// const element = oDocument.GetElement(i)
// if ('paragraph' === element.GetClassType()) {
// let ContentControls = element.GetParaPr().GetStyle()
// if (ContentControls && ContentControls.GetName() == 'Heading 1') {
// if (element.GetText() == ' 术语和定义') {
// isTrue = true
// }
// break
// }
// }
// }
// if (isTrue) {
// let text = oParagraphNew.GetText()
// oParagraphNew.RemoveAllElements()
// oParagraphNew.AddLineBreak()
// oParagraphNew.AddText(' ' + text)
// } else {
// oParagraphNew.AddText(' ')
// }
oParagraphNew.SetBold(false)
oParagraphNew.SetFontFamily('黑体')
oParagraphNew.SetFontSize(21)
@@ -620,13 +596,13 @@ export default {
}
const oParagraphNew = Api.CreateParagraph()
oParagraphNew.AddText(' ' + oParagraph.GetText())
oParagraphNew.AddText(oParagraph.GetText())
oParagraph.Delete()
let oNewDocumentStyle = null
if (SpacingBefore) {
if (Asc.scope.alias == '1') {
oParagraphNew.SetIndLeft(0)
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2'
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -634,14 +610,14 @@ export default {
oNewDocumentStyle = oDocument.GetStyle('Normal')
} else if (Asc.scope.alias == '2') {
oParagraphNew.SetIndLeft(0)
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3'
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
oParaPr.SetIndFirstLine(25)
oNewDocumentStyle = oDocument.GetStyle('Normal')
} else if (Asc.scope.alias == '3') {
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4'
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -649,7 +625,7 @@ export default {
oNewDocumentStyle = oDocument.GetStyle('Normal')
oParagraphNew.SetIndLeft(0)
} else if (Asc.scope.alias == '4') {
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5'
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -657,7 +633,7 @@ export default {
oNewDocumentStyle = oDocument.GetStyle('Normal')
oParagraphNew.SetIndLeft(0)
} else if (Asc.scope.alias == '5') {
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5.%6'
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5.%6 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -668,7 +644,7 @@ export default {
} else {
if (Asc.scope.alias == '1') {
oParagraphNew.SetIndLeft(0)
const sFormatString = '%1.%2'
const sFormatString = '%1.%2 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -676,14 +652,14 @@ export default {
oNewDocumentStyle = oDocument.GetStyle('Normal')
} else if (Asc.scope.alias == '2') {
oParagraphNew.SetIndLeft(0)
const sFormatString = '%1.%2.%3'
const sFormatString = '%1.%2.%3 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
oParaPr.SetIndFirstLine(0)
oNewDocumentStyle = oDocument.GetStyle('Normal')
} else if (Asc.scope.alias == '3') {
const sFormatString = '%1.%2.%3.%4'
const sFormatString = '%1.%2.%3.%4 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -691,7 +667,7 @@ export default {
oNewDocumentStyle = oDocument.GetStyle('Normal')
oParagraphNew.SetIndLeft(0)
} else if (Asc.scope.alias == '4') {
const sFormatString = '%1.%2.%3.%4.%5'
const sFormatString = '%1.%2.%3.%4.%5 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -699,7 +675,7 @@ export default {
oNewDocumentStyle = oDocument.GetStyle('Normal')
oParagraphNew.SetIndLeft(0)
} else if (Asc.scope.alias == '5') {
const sFormatString = '%1.%2.%3.%4.%5.%6'
const sFormatString = '%1.%2.%3.%4.%5.%6 '
numbering.SetCustomType('decimal', sFormatString, 'left')
numbering.SetSuff('none')
let oParaPr = numbering.GetParaPr()
@@ -719,27 +695,6 @@ export default {
oParagraphNew.SetSpacingAfter(0)
oParagraphNew.SetSpacingBefore(0)
oParagraphNew.SetFontFamily('宋体')
let isTrue = false
// for (let i = num - 1; i >= 0; i--) {
// const element = oDocument.GetElement(i)
// if ('paragraph' === element.GetClassType()) {
// let ContentControls = element.GetParaPr().GetStyle()
// if (ContentControls && ContentControls.GetName() == 'Heading 1') {
// if (element.GetText() == ' 术语和定义') {
// isTrue = true
// }
// break
// }
// }
// }
// if (isTrue) {
// let text = oParagraphNew.GetText()
// oParagraphNew.RemoveAllElements()
// oParagraphNew.AddLineBreak()
// oParagraphNew.AddText(' ' + text)
// } else {
// oParagraphNew.AddText(' ')
// }
oParagraphNew.SetBold(false)
oParagraphNew.SetFontSize(21)
oParagraphNew.SetJc('left')