[update] 增加术语,修改图题段前行距和段后行距保持一致
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
<a-divider>初始化</a-divider>
|
<a-divider>初始化</a-divider>
|
||||||
<Init />
|
<Init />
|
||||||
<a-divider>正文</a-divider>
|
<a-divider>正文</a-divider>
|
||||||
|
<terminology />
|
||||||
<chapterData />
|
<chapterData />
|
||||||
<first-level-listing />
|
<first-level-listing />
|
||||||
<SaicFunc />
|
<SaicFunc />
|
||||||
@@ -71,6 +72,7 @@ import SaicExample from './saicComponents/SaicExample'
|
|||||||
import SaicFile from './saicComponents/SaicFile'
|
import SaicFile from './saicComponents/SaicFile'
|
||||||
import RevisInformation from './saicComponents/RevisInformation'
|
import RevisInformation from './saicComponents/RevisInformation'
|
||||||
import Appendix from './saicComponents/Appendix'
|
import Appendix from './saicComponents/Appendix'
|
||||||
|
import Terminology from './saicComponents/Terminology'
|
||||||
import chapterData from './saicComponents/chapterData'
|
import chapterData from './saicComponents/chapterData'
|
||||||
import Chapter from './saicComponents/Chapter'
|
import Chapter from './saicComponents/Chapter'
|
||||||
import _axios from '@/plugins/axios2'
|
import _axios from '@/plugins/axios2'
|
||||||
@@ -94,6 +96,7 @@ export default {
|
|||||||
SaicFile,
|
SaicFile,
|
||||||
RevisInformation,
|
RevisInformation,
|
||||||
Appendix,
|
Appendix,
|
||||||
|
Terminology,
|
||||||
chapterData,
|
chapterData,
|
||||||
Chapter
|
Chapter
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -419,6 +419,7 @@ export default {
|
|||||||
oParagraph.SetFontSize(21)
|
oParagraph.SetFontSize(21)
|
||||||
oParagraph.SetStyle(oNewDocumentStyle)
|
oParagraph.SetStyle(oNewDocumentStyle)
|
||||||
oParagraph.SetFontFamily('黑体')
|
oParagraph.SetFontFamily('黑体')
|
||||||
|
oParagraph.SetSpacingBefore(34, false)
|
||||||
oParagraph.SetSpacingAfter(34, false)
|
oParagraph.SetSpacingAfter(34, false)
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
|
|||||||
@@ -0,0 +1,161 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<a-button-group style="margin-bottom: 10px">
|
||||||
|
<a-button @click="terminology">术语</a-button>
|
||||||
|
</a-button-group>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "Terminology",
|
||||||
|
methods: {
|
||||||
|
terminology () {
|
||||||
|
this.ctx.callCommand(() => {
|
||||||
|
try {
|
||||||
|
// DE.controllers.Toolbar.api.put_ListType(2, 2)
|
||||||
|
const oDocument = Api.GetDocument()
|
||||||
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
oDocument.InsertContent([oParagraph])
|
||||||
|
let num = oParagraph.GetPosInParent()
|
||||||
|
let oNumLvl
|
||||||
|
let currentNumbering
|
||||||
|
let table
|
||||||
|
let SpacingBefore
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
table = element
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allElement = oDocument.GetElementsCount()
|
||||||
|
if (table) {
|
||||||
|
let number = table.GetCell(0, 0).GetContent().GetElement(1)
|
||||||
|
SpacingBefore = number.GetSpacingBefore()
|
||||||
|
}
|
||||||
|
if (SpacingBefore) {
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1 '
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
|
const element = oDocument.GetElement(i)
|
||||||
|
if ('table' === element.GetClassType()) {
|
||||||
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
|
const getNumbering = element.GetNumbering()
|
||||||
|
const text = element.GetSpacingAfter()
|
||||||
|
if (getNumbering !== null) {
|
||||||
|
if (text == 267) {
|
||||||
|
currentNumbering = getNumbering
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentNumbering) {
|
||||||
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
|
} else {
|
||||||
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
|
const sFormatString = '%1 '
|
||||||
|
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// oParagraphOne.Delete()
|
||||||
|
// const oParagraph = Api.CreateParagraph()
|
||||||
|
const oParagraphNew = Api.CreateParagraph()
|
||||||
|
oParagraphNew.AddText(oParagraph.GetText())
|
||||||
|
oParagraph.Delete()
|
||||||
|
let oTextPr = oNumLvl.GetTextPr()
|
||||||
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
let oParaPr = oNumLvl.GetParaPr()
|
||||||
|
oNumLvl.SetSuff('none')
|
||||||
|
// oParagraphNew.SetNumbering(oNumLvl)
|
||||||
|
if (SpacingBefore) {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
oParaPr.SetIndFirstLine(20)
|
||||||
|
} else {
|
||||||
|
oParagraphNew.SetIndLeft(0)
|
||||||
|
oParaPr.SetIndFirstLine(0)
|
||||||
|
}
|
||||||
|
oParagraphNew.SetSpacingAfter(267)
|
||||||
|
oParagraphNew.SetSpacingBefore(267)
|
||||||
|
oParagraphNew.SetBold(false)
|
||||||
|
const oNewDocumentStyle = oDocument.GetStyle('Heading 1')
|
||||||
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
oParagraphNew.SetStyle(oNewDocumentStyle)
|
||||||
|
oParagraphNew.SetFontSize(21)
|
||||||
|
oParagraphNew.SetColor(0, 0, 0)
|
||||||
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
|
oDocument.InsertContent([oParagraphNew])
|
||||||
|
let GetNext = oParagraphNew.GetNext()
|
||||||
|
GetNext.SetSpacingAfter(0)
|
||||||
|
GetNext.SetSpacingBefore(0)
|
||||||
|
// GetNext.Delete()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user