fix 初始化延时;正文后面加一个分页,保证老文件不会重叠显示

This commit is contained in:
赵霄
2024-04-23 15:57:30 +08:00
parent 073c5a9101
commit dd4e68ed04
+16 -12
View File
@@ -967,8 +967,10 @@ export default {
oDocument.InsertContent([oParagraph20]) oDocument.InsertContent([oParagraph20])
oDocument.CreateSection(oParagraph20) oDocument.CreateSection(oParagraph20)
let oSectionNext = oDocument.GetSections()[2] let oSectionNext = oDocument.GetSections()[2]
oSectionNext.SetTitlePage(false)
oSectionNext.SetPageMargins(1415, 1415, 849, 1132) oSectionNext.SetPageMargins(1415, 1415, 849, 1132)
// oSectionNext.SetHeaderDistance(1315) oSectionNext.SetHeaderDistance(1315)
oSectionNext.SetFooterDistance(1315)
let oHeaderText = oSectionNext.GetHeader('even', true) let oHeaderText = oSectionNext.GetHeader('even', true)
const oParagraphText = oHeaderText.GetElement(0) const oParagraphText = oHeaderText.GetElement(0)
oParagraphText.AddText(Asc.scope.standCode) oParagraphText.AddText(Asc.scope.standCode)
@@ -1131,18 +1133,25 @@ export default {
oParagraph9.SetSpacingAfter(0) oParagraph9.SetSpacingAfter(0)
oParagraph9.SetSpacingBefore(17) oParagraph9.SetSpacingBefore(17)
oParagraph9.SetColor(0, 0, 0) oParagraph9.SetColor(0, 0, 0)
oParagraph9.AddPageBreak()
oDocument.InsertContent([oParagraph9]) oDocument.InsertContent([oParagraph9])
Api.GoToFooter(1)
Api.asc_SetSectionStartPage(1)
let timerNew = setTimeout(() => { let timerNew = setTimeout(() => {
Api.GoToFooter(1) console.log('页码操作start')
Api.asc_SetSectionStartPage(1)
Api.GoToFooter(4) Api.GoToFooter(4)
Api.asc_SetSectionStartPage(1) Api.asc_SetSectionStartPage(1)
// Api.GoToFooter(1)
Api.ExitHeader_Footer(4) Api.ExitHeader_Footer(4)
clearTimeout(timerNew) clearTimeout(timerNew)
timerNew = null timerNew = null
}, 800) console.log('页码操作end')
}, 900)
let timerTwo = setTimeout(() => {
Api.asc_UpdateTableOfContents()
}, 1100)
console.log('初始化正文,end') console.log('初始化正文,end')
} catch (e) { } catch (e) {
console.log(e) console.log(e)
@@ -1154,7 +1163,7 @@ export default {
this.initReferences() this.initReferences()
clearTimeout(timer) clearTimeout(timer)
timer = null timer = null
}, 1200) }, 1600)
}, },
replaceData () { replaceData () {
Asc.scope.standCode = this.form.standCode || 'X/XX xxxx-xxxx' Asc.scope.standCode = this.form.standCode || 'X/XX xxxx-xxxx'
@@ -1868,11 +1877,6 @@ export default {
} }
} }
if (ContentsPr) { if (ContentsPr) {
// 文档中没有标题
const tempList = ContentsPr.GetAllParagraphs()
if (tempList.some(tt => tt.GetText().indexOf('文档中没有标题') !== -1)) {
Api.asc_UpdateTableOfContents()
}
const list = ContentsPr.GetAllParagraphs() const list = ContentsPr.GetAllParagraphs()
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++) {
@@ -2479,7 +2483,7 @@ export default {
this.form = Object.assign(query, businessInfo) this.form = Object.assign(query, businessInfo)
console.log(this.form) console.log(this.form)
this.handleCreateCover() this.handleCreateCover()
}, 6000) }, 12000)
} }
} }
</script> </script>