fix 保存后编号空格问题
This commit is contained in:
@@ -6,330 +6,219 @@
|
|||||||
<a-button @click="handleClickTwo1()">项二</a-button>
|
<a-button @click="handleClickTwo1()">项二</a-button>
|
||||||
<a-button @click="handleClick('space')">字母列项</a-button>
|
<a-button @click="handleClick('space')">字母列项</a-button>
|
||||||
<a-button @click="handleClickTwo">数字列项</a-button>
|
<a-button @click="handleClickTwo">数字列项</a-button>
|
||||||
<!-- <a-button @click="handleClick('tab')">插入一级列项('tab')</a-button>-->
|
|
||||||
<!-- <a-button @click="handleClick('none')">插入一级列项('none')</a-button>-->
|
|
||||||
</a-button-group>
|
</a-button-group>
|
||||||
<!-- <a-button-group>-->
|
|
||||||
<!-- <a-button @click="handleClickEn">插入一级列项(英)</a-button>-->
|
|
||||||
<!-- </a-button-group>-->
|
|
||||||
<!-- <a-button-group>-->
|
|
||||||
<!-- <a-button @click="handleTestChapter">添加章节测试</a-button>-->
|
|
||||||
<!-- </a-button-group>-->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
handleClickOne() {
|
handleClickOne() {
|
||||||
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
window.Asc.scope.suffType = ''
|
window.Asc.scope.suffType = ''
|
||||||
this.ctx.callCommand(() => {
|
this.ctx.callCommand(() => {
|
||||||
try {
|
try {
|
||||||
const oDocument = Api.GetDocument()
|
const oDocument = Api.GetDocument()
|
||||||
let oNumbering = oDocument.CreateNumbering('numbered')
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
const oNumLvl = oNumbering.GetLevel(0)
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
oNumLvl.SetCustomType('decimalZero', "——", "right")
|
oNumLvl.SetCustomType('decimalZero', '——', 'right')
|
||||||
oNumLvl.SetSuff("tab");
|
oNumLvl.SetSuff('none')
|
||||||
var oParaPr = oNumLvl.GetParaPr();
|
var oParaPr = oNumLvl.GetParaPr()
|
||||||
oParaPr.SetSpacingLine(280, "auto");
|
oParaPr.SetSpacingLine(280, 'auto')
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
const oParagraph = Api.CreateParagraph()
|
const oParagraph = Api.CreateParagraph()
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
oParagraph.SetContextualSpacing(true)
|
oParagraph.SetContextualSpacing(true)
|
||||||
oParagraph.SetFontFamily('宋体')
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
|
||||||
oParagraph.SetFontSize(21)
|
oParagraph.SetFontSize(21)
|
||||||
oParagraph.SetHighlight(255, 255, 0);
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
oParagraph.SetIndLeft(840);
|
oParagraph.SetIndLeft(840)
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
let text = oParagraph.GetText()
|
let text = oParagraph.GetText()
|
||||||
if (text){
|
if (text) {
|
||||||
let aSearch = oParagraph.Search(text);
|
let aSearch = oParagraph.Search(text)
|
||||||
if (aSearch && aSearch.length > 0){
|
if (aSearch && aSearch.length > 0) {
|
||||||
aSearch[0].SetFontFamily('宋体')
|
aSearch[0].SetFontFamily('宋体')
|
||||||
aSearch[0].SetFontSize(10.5)
|
aSearch[0].SetFontSize(10.5)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let GetNext = oParagraph.GetNext()
|
|
||||||
GetNext.Delete()
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
}
|
||||||
}, false)
|
// let GetNext = oParagraph.GetNext()
|
||||||
},
|
// GetNext.Delete()
|
||||||
paragraphClick(){
|
} catch (error) {
|
||||||
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
console.error(error)
|
||||||
window.Asc.scope.suffType = ''
|
}
|
||||||
this.ctx.callCommand(() => {
|
}, false)
|
||||||
try {
|
},
|
||||||
const oDocument = Api.GetDocument()
|
paragraphClick() {
|
||||||
// let oNumbering = oDocument.CreateNumbering('numbered')
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
// const oNumLvl = oNumbering.GetLevel(0)
|
window.Asc.scope.suffType = ''
|
||||||
// oNumLvl.SetCustomType('decimalZero', " ", "left")
|
this.ctx.callCommand(() => {
|
||||||
// oNumLvl.SetSuff("space");
|
try {
|
||||||
// var oParaPr = oNumLvl.GetParaPr();
|
const oDocument = Api.GetDocument()
|
||||||
// oParaPr.SetSpacingLine(280, "auto");
|
// let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
// oParaPr.SetJc("both");
|
// const oNumLvl = oNumbering.GetLevel(0)
|
||||||
// oParaPr.SetIndFirstLine(-500);
|
// oNumLvl.SetCustomType('decimalZero', " ", "left")
|
||||||
// // oParaPr.SetIndLeft(366)
|
// oNumLvl.SetSuff("space");
|
||||||
const oParagraph = Api.CreateParagraph()
|
// var oParaPr = oNumLvl.GetParaPr();
|
||||||
// oParagraph.SetNumbering(oNumLvl)
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
oParagraph.SetContextualSpacing(true)
|
// oParaPr.SetJc("both");
|
||||||
oParagraph.SetFontFamily('宋体')
|
// oParaPr.SetIndFirstLine(-500);
|
||||||
oParagraph.SetFontSize(21)
|
// // oParaPr.SetIndLeft(366)
|
||||||
oParagraph.SetHighlight(255, 255, 0);
|
const oParagraph = Api.CreateParagraph()
|
||||||
oParagraph.SetIndFirstLine(420);
|
// oParagraph.SetNumbering(oNumLvl)
|
||||||
oDocument.InsertContent([oParagraph])
|
oParagraph.SetContextualSpacing(true)
|
||||||
let text = oParagraph.GetText()
|
oParagraph.SetFontFamily('宋体')
|
||||||
if (text){
|
oParagraph.SetFontSize(21)
|
||||||
let aSearch = oParagraph.Search(text);
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
if (aSearch && aSearch.length > 0){
|
oParagraph.SetIndFirstLine(420)
|
||||||
aSearch[0].SetFontFamily('宋体')
|
oDocument.InsertContent([oParagraph])
|
||||||
aSearch[0].SetFontSize(10.5)
|
let text = oParagraph.GetText()
|
||||||
}
|
if (text) {
|
||||||
|
let aSearch = oParagraph.Search(text)
|
||||||
|
if (aSearch && aSearch.length > 0) {
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(10.5)
|
||||||
}
|
}
|
||||||
let GetNext = oParagraph.GetNext()
|
|
||||||
GetNext.Delete()
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
}
|
||||||
}, false)
|
// let GetNext = oParagraph.GetNext()
|
||||||
},
|
// GetNext.Delete()
|
||||||
handleClickTwo1() {
|
} catch (error) {
|
||||||
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
console.error(error)
|
||||||
window.Asc.scope.suffType = ''
|
}
|
||||||
this.ctx.callCommand(() => {
|
}, false)
|
||||||
try {
|
},
|
||||||
const oDocument = Api.GetDocument()
|
handleClickTwo1() {
|
||||||
let oNumbering = oDocument.CreateNumbering('bullet')
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
const oNumLvl = oNumbering.GetLevel(0)
|
window.Asc.scope.suffType = ''
|
||||||
oNumLvl.SetSuff('tab')
|
this.ctx.callCommand(() => {
|
||||||
const oParagraph = Api.CreateParagraph()
|
try {
|
||||||
var oParaPr = oNumLvl.GetParaPr();
|
const oDocument = Api.GetDocument()
|
||||||
oParaPr.SetSpacingLine(280, "auto");
|
let oNumbering = oDocument.CreateNumbering('bullet')
|
||||||
// oParaPr.SetIndRight(80)
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
// oParaPr.SetIndFirstLine(120);
|
oNumLvl.SetSuff('none')
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
const oParagraph = Api.CreateParagraph()
|
||||||
oParagraph.SetContextualSpacing(true)
|
var oParaPr = oNumLvl.GetParaPr()
|
||||||
oParagraph.SetFontFamily('宋体')
|
oParaPr.SetSpacingLine(280, 'auto')
|
||||||
oParagraph.SetFontSize(21)
|
// oParaPr.SetIndRight(80)
|
||||||
oParagraph.SetIndLeft(1270);
|
// oParaPr.SetIndFirstLine(120);
|
||||||
oParagraph.SetHighlight(255, 255, 0);
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
oDocument.InsertContent([oParagraph])
|
oParagraph.SetContextualSpacing(true)
|
||||||
let text = oParagraph.GetText()
|
oParagraph.SetFontFamily('宋体')
|
||||||
if (text){
|
oParagraph.SetFontSize(21)
|
||||||
let aSearch = oParagraph.Search(text);
|
oParagraph.SetIndLeft(1270)
|
||||||
if (aSearch && aSearch.length > 0){
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
aSearch[0].SetFontFamily('宋体')
|
oParagraph.AddText(' ')
|
||||||
aSearch[0].SetFontSize(10.5)
|
oDocument.InsertContent([oParagraph])
|
||||||
}
|
let text = oParagraph.GetText()
|
||||||
|
if (text) {
|
||||||
|
let aSearch = oParagraph.Search(text)
|
||||||
|
if (aSearch && aSearch.length > 0) {
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(10.5)
|
||||||
}
|
}
|
||||||
let GetNext = oParagraph.GetNext()
|
|
||||||
GetNext.Delete()
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
}
|
||||||
}, false)
|
// let GetNext = oParagraph.GetNext()
|
||||||
},
|
// GetNext.Delete()
|
||||||
handleClick(suffType) {
|
} catch (error) {
|
||||||
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
console.error(error)
|
||||||
window.Asc.scope.suffType = ''
|
}
|
||||||
this.ctx.callCommand(() => {
|
}, false)
|
||||||
try {
|
},
|
||||||
const oDocument = Api.GetDocument()
|
handleClick(suffType) {
|
||||||
// const allElement = oDocument.GetElementsCount()
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
let numbering = null
|
window.Asc.scope.suffType = ''
|
||||||
// let currentNumbering = null
|
this.ctx.callCommand(() => {
|
||||||
// for (let index = 0; index < allElement; index++) {
|
try {
|
||||||
// const element = oDocument.GetElement(index)
|
const oDocument = Api.GetDocument()
|
||||||
// if ("paragraph" === element.GetClassType()) {
|
let numbering = null
|
||||||
// const getNumbering = element.GetNumbering()
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
// const text = element.GetSpacingBefore()
|
numbering = oNumbering.GetLevel(0)
|
||||||
// if (getNumbering !== null) {
|
numbering.SetTemplateType('a)')
|
||||||
// if (text == 1) {
|
numbering.SetSuff('none')
|
||||||
// currentNumbering = getNumbering
|
const oParagraph = Api.CreateParagraph()
|
||||||
// break
|
let oTextPr = numbering.GetTextPr()
|
||||||
// }
|
oTextPr.SetFontFamily('宋体')
|
||||||
// }
|
var oParaPr = numbering.GetParaPr()
|
||||||
// }
|
oParaPr.SetSpacingLine(240, 'auto')
|
||||||
// }
|
oParaPr.SetJc('none')
|
||||||
// if (!numbering) {
|
oParaPr.SetIndFirstLine(-420)
|
||||||
// if (currentNumbering) {
|
oParagraph.SetNumbering(numbering)
|
||||||
// numbering = currentNumbering.GetNumbering().GetLevel(0)
|
oParagraph.SetContextualSpacing(true)
|
||||||
// } else {
|
oParagraph.SetFontFamily('宋体')
|
||||||
// let oNumbering = oDocument.CreateNumbering('numbered')
|
oParagraph.SetIndLeft(840)
|
||||||
// numbering = oNumbering.GetLevel(0)
|
oParagraph.SetFontSize(21)
|
||||||
// numbering.SetTemplateType('a)')
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
// }
|
oParagraph.AddText(' ')
|
||||||
// }
|
oDocument.InsertContent([oParagraph])
|
||||||
let oNumbering = oDocument.CreateNumbering('numbered')
|
let text = oParagraph.GetText()
|
||||||
numbering = oNumbering.GetLevel(0)
|
if (text) {
|
||||||
numbering.SetTemplateType('a)')
|
let aSearch = oParagraph.Search(text)
|
||||||
const oParagraph = Api.CreateParagraph()
|
if (aSearch && aSearch.length > 0) {
|
||||||
// oParagraph.SetSpacingLine(400, "auto");
|
aSearch[0].SetFontFamily('宋体')
|
||||||
let oTextPr = numbering.GetTextPr();
|
aSearch[0].SetFontSize(10.5)
|
||||||
oTextPr.SetFontFamily("宋体");
|
|
||||||
var oParaPr = numbering.GetParaPr();
|
|
||||||
oParaPr.SetSpacingLine(240, "auto");
|
|
||||||
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);
|
|
||||||
oDocument.InsertContent([oParagraph])
|
|
||||||
let text = oParagraph.GetText()
|
|
||||||
if (text){
|
|
||||||
let aSearch = oParagraph.Search(text);
|
|
||||||
if (aSearch && aSearch.length > 0){
|
|
||||||
aSearch[0].SetFontFamily('宋体')
|
|
||||||
aSearch[0].SetFontSize(10.5)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let GetNext = oParagraph.GetNext()
|
|
||||||
GetNext.Delete()
|
|
||||||
// oNumbering = oParagraph.GetNumbering().GetNumbering()
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
}
|
||||||
}, false)
|
// let GetNext = oParagraph.GetNext()
|
||||||
},
|
// GetNext.Delete()
|
||||||
handleClickTwo() {
|
// oNumbering = oParagraph.GetNumbering().GetNumbering()
|
||||||
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
} catch (error) {
|
||||||
window.Asc.scope.suffType = ''
|
console.error(error)
|
||||||
this.ctx.callCommand(() => {
|
}
|
||||||
try {
|
}, false)
|
||||||
const oDocument = Api.GetDocument()
|
},
|
||||||
const allElement = oDocument.GetElementsCount()
|
handleClickTwo() {
|
||||||
let numbering = null
|
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
||||||
let currentNumbering = null
|
window.Asc.scope.suffType = ''
|
||||||
// for (let index = 0; index < allElement; index++) {
|
this.ctx.callCommand(() => {
|
||||||
// const element = oDocument.GetElement(index)
|
try {
|
||||||
// if ("paragraph" === element.GetClassType()) {
|
const oDocument = Api.GetDocument()
|
||||||
// const getNumbering = element.GetNumbering()
|
const allElement = oDocument.GetElementsCount()
|
||||||
// const text = element.GetSpacingBefore()
|
let numbering = null
|
||||||
// if (getNumbering !== null) {
|
let currentNumbering = null
|
||||||
// if (text == 2) {
|
if (!numbering) {
|
||||||
// currentNumbering = getNumbering;
|
if (currentNumbering) {
|
||||||
// break
|
numbering = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (!numbering) {
|
|
||||||
if (currentNumbering) {
|
|
||||||
numbering = currentNumbering.GetNumbering().GetLevel(0)
|
|
||||||
} else {
|
|
||||||
let oNumbering = oDocument.CreateNumbering('numbered')
|
|
||||||
numbering = oNumbering.GetLevel(0)
|
|
||||||
// numbering.SetTemplateType('1)')
|
|
||||||
numbering.SetCustomType('decimal', "%1)", "left")
|
|
||||||
// numbering.SetSuff('tab')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let oTextPr = numbering.GetTextPr();
|
|
||||||
oTextPr.SetFontFamily("宋体");
|
|
||||||
const oParaPr = numbering.GetParaPr();
|
|
||||||
// oParaPr.SetIndLeft(1310)
|
|
||||||
oParaPr.SetJc("left");
|
|
||||||
oParaPr.SetSpacingLine(240, "auto");
|
|
||||||
oParaPr.SetIndFirstLine(-420);
|
|
||||||
const oParagraph = Api.CreateParagraph()
|
|
||||||
oParagraph.SetNumbering(numbering)
|
|
||||||
oParagraph.SetContextualSpacing(true)
|
|
||||||
oParagraph.SetFontFamily('宋体')
|
|
||||||
oParagraph.SetFontSize(21)
|
|
||||||
oParagraph.SetIndLeft(1260);
|
|
||||||
oParagraph.SetHighlight(255, 255, 0);
|
|
||||||
oDocument.InsertContent([oParagraph])
|
|
||||||
let text = oParagraph.GetText()
|
|
||||||
if (text){
|
|
||||||
let aSearch = oParagraph.Search(text);
|
|
||||||
if (aSearch && aSearch.length > 0){
|
|
||||||
aSearch[0].SetFontFamily('宋体')
|
|
||||||
aSearch[0].SetFontSize(10.5)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let GetNext = oParagraph.GetNext()
|
|
||||||
GetNext.Delete()
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
|
||||||
}, false)
|
|
||||||
},
|
|
||||||
handleClickEn() {
|
|
||||||
window.Asc.scope.guid = window.Asc.plugin.info.guid
|
|
||||||
this.ctx.callCommand(() => {
|
|
||||||
try {
|
|
||||||
const oDocument = Api.GetDocument()
|
|
||||||
let oNumbering = oDocument.CreateNumbering('numbered')
|
|
||||||
const oNumLvl = oNumbering.GetLevel(0)
|
|
||||||
oNumLvl.SetTemplateType('a)')
|
|
||||||
oNumLvl.SetSuff('space')
|
|
||||||
for (let nLvl = 1; nLvl < 4; nLvl++) {
|
|
||||||
const oParagraph = Api.CreateParagraph()
|
|
||||||
oParagraph.AddText('Custom numbered')
|
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
|
||||||
oParagraph.SetContextualSpacing(true)
|
|
||||||
oParagraph.SetFontFamily('Arial')
|
|
||||||
oParagraph.SetFontSize(21)
|
|
||||||
oDocument.InsertContent([oParagraph])
|
|
||||||
oNumbering = oParagraph.GetNumbering().GetNumbering()
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
|
||||||
}, false)
|
|
||||||
},
|
|
||||||
handleClick2() {
|
|
||||||
this.ctx.executeMethod('InputText', ['wx', 'wx2'])
|
|
||||||
},
|
|
||||||
|
|
||||||
handleTestChapter() {
|
|
||||||
this.ctx.callCommand(() => {
|
|
||||||
try {
|
|
||||||
const oDocument = Api.GetDocument()
|
|
||||||
const allParagraph = oDocument.Document.GetAllNumberedParagraphs()
|
|
||||||
console.log(allParagraph)
|
|
||||||
let oNumbering
|
|
||||||
if (allParagraph.length > 0) {
|
|
||||||
// oNumbering = oDocument.CreateNumbering('numbered')
|
|
||||||
const currentParagraph = allParagraph[0]
|
|
||||||
console.log(currentParagraph)
|
|
||||||
oNumbering = currentParagraph.GetCurrentParagraph()
|
|
||||||
console.log(oNumbering)
|
|
||||||
} else {
|
} else {
|
||||||
oNumbering = oDocument.CreateNumbering('numbered')
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
console.log('创建的:', oNumbering)
|
numbering = oNumbering.GetLevel(0)
|
||||||
|
numbering.SetCustomType('decimal', '%1)', 'left')
|
||||||
}
|
}
|
||||||
const oParagraph = Api.CreateParagraph()
|
|
||||||
|
|
||||||
oNumLvl = oNumbering.GetLevel(oNumbering.GetLevel(0).GetLevelIndex());
|
|
||||||
oNumLvl.SetRestart(false)
|
|
||||||
oParagraph.AddText('Custom numbered')
|
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
|
||||||
oDocument.InsertContent([oParagraph])
|
|
||||||
let text = oParagraph.GetText()
|
|
||||||
if (text){
|
|
||||||
let aSearch = oParagraph.Search(text);
|
|
||||||
if (aSearch && aSearch.length > 0){
|
|
||||||
aSearch[0].SetFontFamily('宋体')
|
|
||||||
aSearch[0].SetFontSize(10.5)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let GetNext = oParagraph.GetNext()
|
|
||||||
GetNext.Delete()
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
}
|
}
|
||||||
})
|
numbering.SetSuff('none')
|
||||||
}
|
let oTextPr = numbering.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('宋体')
|
||||||
|
const oParaPr = numbering.GetParaPr()
|
||||||
|
// oParaPr.SetIndLeft(1310)
|
||||||
|
oParaPr.SetJc('left')
|
||||||
|
oParaPr.SetSpacingLine(240, 'auto')
|
||||||
|
oParaPr.SetIndFirstLine(-420)
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oParagraph.SetNumbering(numbering)
|
||||||
|
oParagraph.SetContextualSpacing(true)
|
||||||
|
oParagraph.SetFontFamily('宋体')
|
||||||
|
oParagraph.SetFontSize(21)
|
||||||
|
oParagraph.SetIndLeft(1260)
|
||||||
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
|
oParagraph.AddText(' ')
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let text = oParagraph.GetText()
|
||||||
|
if (text) {
|
||||||
|
let aSearch = oParagraph.Search(text)
|
||||||
|
if (aSearch && aSearch.length > 0) {
|
||||||
|
aSearch[0].SetFontFamily('宋体')
|
||||||
|
aSearch[0].SetFontSize(10.5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// let GetNext = oParagraph.GetNext()
|
||||||
|
// GetNext.Delete()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -406,6 +406,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
oNumLvl.SetSuff('none')
|
||||||
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
|
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily('黑体')
|
oTextPr3.SetFontFamily('黑体')
|
||||||
@@ -420,6 +421,7 @@ export default {
|
|||||||
oParagraph.SetFontFamily('黑体')
|
oParagraph.SetFontFamily('黑体')
|
||||||
oParagraph.SetSpacingAfter(34, false)
|
oParagraph.SetSpacingAfter(34, false)
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
oParagraph.AddText(' ')
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
// let GetNext = oParagraph.GetNext()
|
// let GetNext = oParagraph.GetNext()
|
||||||
// GetNext.Delete()
|
// GetNext.Delete()
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a-button-group style="margin-bottom: 10px">
|
<a-button-group style="margin-bottom: 10px">
|
||||||
<!-- <a-button @click="handleCreateCover">封面</a-button>-->
|
|
||||||
<a-button @click="catalogueClick">插入ics</a-button>
|
<a-button @click="catalogueClick">插入ics</a-button>
|
||||||
<a-button @click="terminationLine">终止线</a-button>
|
<a-button @click="terminationLine">终止线</a-button>
|
||||||
<!-- <a-button @click="handleInit">初始化正文</a-button>-->
|
|
||||||
<!-- <a-button @click="handleReplace">数据替换</a-button>-->
|
|
||||||
<!-- <a-button @click="addSeal">添加发布认可章</a-button>-->
|
|
||||||
</a-button-group>
|
</a-button-group>
|
||||||
|
|
||||||
<a-button-group style="margin-bottom: 10px">
|
<a-button-group style="margin-bottom: 10px">
|
||||||
@@ -945,10 +941,10 @@ export default {
|
|||||||
const oDocument = Api.GetDocument()
|
const oDocument = Api.GetDocument()
|
||||||
// 处理编号格式,.SetSuff('none')为关键代码,不然会出现标题后面的空格变大的问题
|
// 处理编号格式,.SetSuff('none')为关键代码,不然会出现标题后面的空格变大的问题
|
||||||
const aNumberedParagraphs = oDocument.GetAllNumberedParagraphs()
|
const aNumberedParagraphs = oDocument.GetAllNumberedParagraphs()
|
||||||
for (let i = 0; i < aNumberedParagraphs.length; i++) {
|
// for (let i = 0; i < aNumberedParagraphs.length; i++) {
|
||||||
const oNumLvl = aNumberedParagraphs[i].GetNumbering()
|
// const oNumLvl = aNumberedParagraphs[i].GetNumbering()
|
||||||
oNumLvl.SetSuff('none')
|
// oNumLvl.SetSuff('none')
|
||||||
}
|
// }
|
||||||
const AllContentControls = oDocument.GetAllContentControls()
|
const AllContentControls = oDocument.GetAllContentControls()
|
||||||
let flag = false
|
let flag = false
|
||||||
for (let i = 0; i < AllContentControls.length; i++) {
|
for (let i = 0; i < AllContentControls.length; i++) {
|
||||||
|
|||||||
@@ -593,6 +593,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
oNumLvl.SetSuff('none')
|
||||||
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
|
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily('黑体')
|
oTextPr3.SetFontFamily('黑体')
|
||||||
@@ -606,7 +607,7 @@ export default {
|
|||||||
oParagraph.SetSpacingAfter(75, false)
|
oParagraph.SetSpacingAfter(75, false)
|
||||||
oParagraph.SetSpacingBefore(73.5, false)
|
oParagraph.SetSpacingBefore(73.5, false)
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
oParagraph.AddText('XXX')
|
oParagraph.AddText(' XXX')
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
let GetNext = oParagraph.GetNext()
|
let GetNext = oParagraph.GetNext()
|
||||||
GetNext.SetSpacingAfter(0)
|
GetNext.SetSpacingAfter(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user