fix 编辑-附录无法正常生成目录的问题
This commit is contained in:
@@ -1776,6 +1776,20 @@ export default {
|
|||||||
that.ctx.callCommand(() => {
|
that.ctx.callCommand(() => {
|
||||||
try {
|
try {
|
||||||
const oDocument = Api.GetDocument()
|
const oDocument = Api.GetDocument()
|
||||||
|
const tables = oDocument.GetAllTables()
|
||||||
|
if (tables && tables.length > 0) {
|
||||||
|
for (let i = 0; i < tables.length; i++) {
|
||||||
|
const cell = tables[i].GetCell(0, 0)
|
||||||
|
const cellContent = cell.GetContent().GetContent()
|
||||||
|
for (let j = 0; j < cellContent.length; j++) {
|
||||||
|
const text = cellContent[j].GetText()
|
||||||
|
if (text.indexOf('附') !== -1 && text.indexOf('录') !== -1) {
|
||||||
|
let oNewDocumentStyle = oDocument.GetStyle('Heading 1')
|
||||||
|
cellContent[j].SetStyle(oNewDocumentStyle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const allElement = oDocument.GetElementsCount()
|
const allElement = oDocument.GetElementsCount()
|
||||||
let ContentsPr = null
|
let ContentsPr = null
|
||||||
for (let index = 0; index < allElement; index++) {
|
for (let index = 0; index < allElement; index++) {
|
||||||
@@ -1817,11 +1831,11 @@ export default {
|
|||||||
element.SetFontSize(21)
|
element.SetFontSize(21)
|
||||||
element.SetFontFamily(element.GetFontNames()[0])
|
element.SetFontFamily(element.GetFontNames()[0])
|
||||||
}
|
}
|
||||||
// 二级
|
// 二级及以下
|
||||||
const serialNumber = element.GetText().split(' ')[0]
|
const serialNumber = element.GetText().split(' ')[0]
|
||||||
const serialNumberList = serialNumber.split('.')
|
const serialNumberList = serialNumber.split('.')
|
||||||
if (text === 127 && serialNumberList.length === 2) {
|
if (text === 127) {
|
||||||
const oNewDocumentStyle = oDocument.GetStyle('Heading 2')
|
const oNewDocumentStyle = oDocument.GetStyle('Heading ' + serialNumberList.length)
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily('黑体')
|
oTextPr3.SetFontFamily('黑体')
|
||||||
element.SetStyle(oNewDocumentStyle)
|
element.SetStyle(oNewDocumentStyle)
|
||||||
|
|||||||
Reference in New Issue
Block a user