fix 项一、项二不更新文本格式问题;更新数据添加日志

This commit is contained in:
赵霄
2024-04-29 15:52:33 +08:00
parent 3d2fc6c024
commit 659e03373b
2 changed files with 22 additions and 8 deletions
@@ -22,11 +22,19 @@ export default {
let oNumbering = oDocument.CreateNumbering('numbered')
const oNumLvl = oNumbering.GetLevel(0)
oNumLvl.SetCustomType('decimalZero', '——', 'right')
oNumLvl.SetSuff('tab')
var oParaPr = oNumLvl.GetParaPr()
oNumLvl.SetSuff('none')
const oTextPr = oNumLvl.GetTextPr()
oTextPr.SetFontFamily('宋体')
oTextPr.SetFontSize(21)
const oParaPr = oNumLvl.GetParaPr()
oParaPr.SetSpacingLine(280, 'auto')
oParaPr.SetIndFirstLine(0)
const oParagraphTemp = Api.CreateParagraph()
oDocument.InsertContent([oParagraphTemp])
const oParagraph = Api.CreateParagraph()
oParagraph.AddText(oParagraphTemp.GetText())
oParagraphTemp.Delete()
oParagraph.SetNumbering(oNumLvl)
oParagraph.SetContextualSpacing(true)
oParagraph.SetFontFamily('宋体')
@@ -71,8 +79,8 @@ export default {
aSearch[0].SetFontSize(10.5)
}
}
let GetNext = oParagraph.GetNext()
GetNext.Delete()
// let GetNext = oParagraph.GetNext()
// GetNext.Delete()
} catch (error) {
console.error(error)
}
@@ -87,8 +95,12 @@ export default {
let oNumbering = oDocument.CreateNumbering('bullet')
const oNumLvl = oNumbering.GetLevel(0)
oNumLvl.SetSuff('none')
const oParagraphTemp = Api.CreateParagraph()
oDocument.InsertContent([oParagraphTemp])
const oParagraph = Api.CreateParagraph()
var oParaPr = oNumLvl.GetParaPr()
oParagraph.AddText(' ' + oParagraphTemp.GetText().replace(' ', ''))
oParagraphTemp.Delete()
const oParaPr = oNumLvl.GetParaPr()
oParaPr.SetSpacingLine(280, 'auto')
oParagraph.SetNumbering(oNumLvl)
oParagraph.SetContextualSpacing(true)
@@ -96,7 +108,6 @@ export default {
oParagraph.SetFontSize(21)
oParagraph.SetIndLeft(1270)
oParagraph.SetHighlight(255, 255, 0)
oParagraph.AddText(' ')
oDocument.InsertContent([oParagraph])
let text = oParagraph.GetText()
if (text) {
@@ -106,8 +117,8 @@ export default {
aSearch[0].SetFontSize(10.5)
}
}
let GetNext = oParagraph.GetNext()
GetNext.Delete()
// let GetNext = oParagraph.GetNext()
// GetNext.Delete()
} catch (error) {
console.error(error)
}
+3
View File
@@ -1165,6 +1165,7 @@ export default {
Asc.scope.standardNumberPrefix = this.form.standardNumberPrefix || 'X/XX'
window.Asc.plugin.callCommand(() => {
try {
console.log('更新数据', Asc.scope.issueDate, Asc.scope.impDate)
const oDocument = Api.GetDocument()
// 封面只创建一次
const AllContentControls = oDocument.GetAllContentControls()
@@ -1230,6 +1231,7 @@ export default {
}
}
if (AllContentControls[i].GetAlias() === 'foton.issueDate') {
console.log('更新发布日期', Asc.scope.issueDate)
let parentParagraph = AllContentControls[i].GetParentParagraph()
if (Asc.scope.issueDate) {
const oRunStandENName = Api.CreateRun()
@@ -1241,6 +1243,7 @@ export default {
}
}
if (AllContentControls[i].GetAlias() === 'foton.impDate') {
console.log('更新实施日期', Asc.scope.impDate)
let parentParagraph = AllContentControls[i].GetParentParagraph()
if (Asc.scope.impDate) {
const oRunStandENName = Api.CreateRun()