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)
}