fix 无题的各条间距不对,应该是段前段后0;章节只空了1个字符,应该是两个
This commit is contained in:
+4
-2
@@ -13,8 +13,10 @@
|
|||||||
<% if (process.env.NODE_ENV === 'development' ) { %>
|
<% if (process.env.NODE_ENV === 'development' ) { %>
|
||||||
<script>
|
<script>
|
||||||
window._CONFIG = {
|
window._CONFIG = {
|
||||||
'interfaceUrl': 'http://139.9.235.66:8184',
|
// 'interfaceUrl': 'http://139.9.235.66:8184',
|
||||||
'downloadUrl': 'http://139.9.235.66:8184'
|
'interfaceUrl': 'http://10.0.1.28:8184',
|
||||||
|
// 'downloadUrl': 'http://139.9.235.66:8184'
|
||||||
|
'downloadUrl': 'http://10.0.1.28:8184'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "chapterData",
|
name: 'chapterData',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
num: 0,
|
num: 0,
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
insertChapter (val) {
|
insertChapter (val) {
|
||||||
Asc.scope.alias = val;
|
Asc.scope.alias = val
|
||||||
Asc.scope.numData = this.numData
|
Asc.scope.numData = this.numData
|
||||||
this.ctx.callCommand(() => {
|
this.ctx.callCommand(() => {
|
||||||
try {
|
try {
|
||||||
@@ -104,12 +104,12 @@
|
|||||||
let SpacingBefore
|
let SpacingBefore
|
||||||
for (let i = num - 1; i >= 0; i--) {
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
table = element
|
table = element
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if ("paragraph" === element.GetClassType()) {
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
const getNumbering = element.GetNumbering()
|
const getNumbering = element.GetNumbering()
|
||||||
const text = element.GetSpacingAfter()
|
const text = element.GetSpacingAfter()
|
||||||
if (getNumbering !== null) {
|
if (getNumbering !== null) {
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
}
|
}
|
||||||
for (let i = num - 1; i >= 0; i--) {
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
table = element
|
table = element
|
||||||
break
|
break
|
||||||
@@ -131,8 +131,8 @@
|
|||||||
}
|
}
|
||||||
const allElement = oDocument.GetElementsCount()
|
const allElement = oDocument.GetElementsCount()
|
||||||
if (table) {
|
if (table) {
|
||||||
let number = table.GetCell(0, 0).GetContent().GetElement(1);
|
let number = table.GetCell(0, 0).GetContent().GetElement(1)
|
||||||
SpacingBefore = number.GetSpacingBefore();
|
SpacingBefore = number.GetSpacingBefore()
|
||||||
}
|
}
|
||||||
if (SpacingBefore) {
|
if (SpacingBefore) {
|
||||||
if (currentNumbering) {
|
if (currentNumbering) {
|
||||||
@@ -140,11 +140,11 @@
|
|||||||
} else {
|
} else {
|
||||||
for (let i = num + 1; i < allElement; i++) {
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if ("paragraph" === element.GetClassType()) {
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
const getNumbering = element.GetNumbering()
|
const getNumbering = element.GetNumbering()
|
||||||
const text = element.GetSpacingAfter()
|
const text = element.GetSpacingAfter()
|
||||||
if (getNumbering !== null) {
|
if (getNumbering !== null) {
|
||||||
@@ -158,10 +158,10 @@
|
|||||||
if (currentNumbering) {
|
if (currentNumbering) {
|
||||||
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
} else {
|
} else {
|
||||||
let oNumbering = oDocument.CreateNumbering("numbered");
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
oNumLvl = oNumbering.GetLevel(0);
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
const sFormatString = Asc.scope.numData[SpacingBefore] + ".%1";
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1'
|
||||||
oNumLvl.SetCustomType("decimal", sFormatString, "left");
|
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -170,11 +170,11 @@
|
|||||||
} else {
|
} else {
|
||||||
for (let i = num + 1; i < allElement; i++) {
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if ("paragraph" === element.GetClassType()) {
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
const getNumbering = element.GetNumbering()
|
const getNumbering = element.GetNumbering()
|
||||||
const text = element.GetSpacingAfter()
|
const text = element.GetSpacingAfter()
|
||||||
if (getNumbering !== null) {
|
if (getNumbering !== null) {
|
||||||
@@ -188,41 +188,44 @@
|
|||||||
if (currentNumbering) {
|
if (currentNumbering) {
|
||||||
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
oNumLvl = currentNumbering.GetNumbering().GetLevel(0)
|
||||||
} else {
|
} else {
|
||||||
let oNumbering = oDocument.CreateNumbering("numbered");
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
oNumLvl = oNumbering.GetLevel(0);
|
oNumLvl = oNumbering.GetLevel(0)
|
||||||
const sFormatString = "%1";
|
const sFormatString = '%1'
|
||||||
oNumLvl.SetCustomType("decimal", sFormatString, "left");
|
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// oParagraphOne.Delete()
|
// oParagraphOne.Delete()
|
||||||
// const oParagraph = Api.CreateParagraph()
|
// const oParagraph = Api.CreateParagraph()
|
||||||
let oTextPr = oNumLvl.GetTextPr();
|
const oParagraphNew = Api.CreateParagraph()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oParagraphNew.AddText(' ' + oParagraph.GetText())
|
||||||
let oParaPr = oNumLvl.GetParaPr();
|
oParagraph.Delete()
|
||||||
oNumLvl.SetSuff("space");
|
let oTextPr = oNumLvl.GetTextPr()
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
oTextPr.SetFontFamily('黑体')
|
||||||
|
let oParaPr = oNumLvl.GetParaPr()
|
||||||
|
oNumLvl.SetSuff('none')
|
||||||
|
oParagraphNew.SetNumbering(oNumLvl)
|
||||||
if (SpacingBefore) {
|
if (SpacingBefore) {
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
oParaPr.SetIndFirstLine(20);
|
oParaPr.SetIndFirstLine(20)
|
||||||
} else {
|
} else {
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
}
|
}
|
||||||
oParagraph.SetSpacingAfter(267)
|
oParagraphNew.SetSpacingAfter(267)
|
||||||
oParagraph.SetSpacingBefore(267)
|
oParagraphNew.SetSpacingBefore(267)
|
||||||
oParagraph.SetBold(false);
|
oParagraphNew.SetBold(false)
|
||||||
const oNewDocumentStyle = oDocument.GetStyle("Heading 1");
|
const oNewDocumentStyle = oDocument.GetStyle('Heading 1')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
oParagraph.SetStyle(oNewDocumentStyle);
|
oParagraphNew.SetStyle(oNewDocumentStyle)
|
||||||
oParagraph.SetFontSize(21);
|
oParagraphNew.SetFontSize(21)
|
||||||
// oParagraph.SetJc("left");
|
// oParagraphNew.SetJc("left");
|
||||||
oParagraph.AddText(' ')
|
// oParagraphNew.AddText(' ')
|
||||||
oParagraph.SetColor(0, 0, 0);
|
oParagraphNew.SetColor(0, 0, 0)
|
||||||
oParagraph.SetFontFamily("黑体");
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraphNew])
|
||||||
let GetNext = oParagraph.GetNext()
|
let GetNext = oParagraphNew.GetNext()
|
||||||
GetNext.SetSpacingAfter(0)
|
GetNext.SetSpacingAfter(0)
|
||||||
GetNext.SetSpacingBefore(0)
|
GetNext.SetSpacingBefore(0)
|
||||||
// GetNext.Delete()
|
// GetNext.Delete()
|
||||||
@@ -232,9 +235,9 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
insertBar (val, isTrue) {
|
insertBar (val, isTrue) {
|
||||||
Asc.scope.alias = val;
|
Asc.scope.alias = val
|
||||||
Asc.scope.isTrue = isTrue;
|
Asc.scope.isTrue = isTrue
|
||||||
Asc.scope.numData = this.numData;
|
Asc.scope.numData = this.numData
|
||||||
this.ctx.callCommand(() => {
|
this.ctx.callCommand(() => {
|
||||||
try {
|
try {
|
||||||
const oDocument = Api.GetDocument()
|
const oDocument = Api.GetDocument()
|
||||||
@@ -248,12 +251,12 @@
|
|||||||
let SpacingBefore
|
let SpacingBefore
|
||||||
for (let i = num - 1; i >= 0; i--) {
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
table = element
|
table = element
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if ("paragraph" === element.GetClassType()) {
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
const getNumbering = element.GetNumbering()
|
const getNumbering = element.GetNumbering()
|
||||||
const text = element.GetSpacingAfter()
|
const text = element.GetSpacingAfter()
|
||||||
if (getNumbering !== null) {
|
if (getNumbering !== null) {
|
||||||
@@ -266,7 +269,7 @@
|
|||||||
}
|
}
|
||||||
for (let i = num - 1; i >= 0; i--) {
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
table = element
|
table = element
|
||||||
break
|
break
|
||||||
@@ -275,8 +278,8 @@
|
|||||||
}
|
}
|
||||||
const allElement = oDocument.GetElementsCount()
|
const allElement = oDocument.GetElementsCount()
|
||||||
if (table) {
|
if (table) {
|
||||||
let number = table.GetCell(0, 0).GetContent().GetElement(1);
|
let number = table.GetCell(0, 0).GetContent().GetElement(1)
|
||||||
SpacingBefore = number.GetSpacingBefore();
|
SpacingBefore = number.GetSpacingBefore()
|
||||||
}
|
}
|
||||||
if (SpacingBefore) {
|
if (SpacingBefore) {
|
||||||
if (currentNumbering) {
|
if (currentNumbering) {
|
||||||
@@ -284,11 +287,11 @@
|
|||||||
} else {
|
} else {
|
||||||
for (let i = num + 1; i < allElement; i++) {
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if ("paragraph" === element.GetClassType()) {
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
const getNumbering = element.GetNumbering()
|
const getNumbering = element.GetNumbering()
|
||||||
const text = element.GetSpacingAfter()
|
const text = element.GetSpacingAfter()
|
||||||
if (getNumbering !== null) {
|
if (getNumbering !== null) {
|
||||||
@@ -302,8 +305,8 @@
|
|||||||
if (currentNumbering) {
|
if (currentNumbering) {
|
||||||
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
} else {
|
} else {
|
||||||
let oNumbering = oDocument.CreateNumbering("numbered");
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
numbering = oNumbering.GetLevel(Asc.scope.alias);
|
numbering = oNumbering.GetLevel(Asc.scope.alias)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -312,11 +315,11 @@
|
|||||||
} else {
|
} else {
|
||||||
for (let i = num + 1; i < allElement; i++) {
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if ("paragraph" === element.GetClassType()) {
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
const getNumbering = element.GetNumbering()
|
const getNumbering = element.GetNumbering()
|
||||||
const text = element.GetSpacingAfter()
|
const text = element.GetSpacingAfter()
|
||||||
if (getNumbering !== null) {
|
if (getNumbering !== null) {
|
||||||
@@ -330,189 +333,191 @@
|
|||||||
if (currentNumbering) {
|
if (currentNumbering) {
|
||||||
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
} else {
|
} else {
|
||||||
let oNumbering = oDocument.CreateNumbering("numbered");
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
numbering = oNumbering.GetLevel(Asc.scope.alias);
|
numbering = oNumbering.GetLevel(Asc.scope.alias)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const oParagraph = Api.CreateParagraph()
|
const oParagraphNew = Api.CreateParagraph()
|
||||||
|
oParagraphNew.AddText(' ' + oParagraph.GetText())
|
||||||
|
oParagraph.Delete()
|
||||||
let oNewDocumentStyle = null
|
let oNewDocumentStyle = null
|
||||||
if (SpacingBefore) {
|
if (SpacingBefore) {
|
||||||
if (Asc.scope.alias == '1') {
|
if (Asc.scope.alias == '1') {
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2';
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(25);
|
oParaPr.SetIndFirstLine(25)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Heading 2");
|
oNewDocumentStyle = oDocument.GetStyle('Heading 2')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
oParagraph.SetFontFamily('黑体')
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
let oTextPr = numbering.GetTextPr();
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oTextPr.SetFontFamily('黑体')
|
||||||
} else if (Asc.scope.alias == '2') {
|
} else if (Asc.scope.alias == '2') {
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3';
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(25);
|
oParaPr.SetIndFirstLine(25)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Heading 3");
|
oNewDocumentStyle = oDocument.GetStyle('Heading 3')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
let oTextPr = numbering.GetTextPr();
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oTextPr.SetFontFamily('黑体')
|
||||||
} else if (Asc.scope.alias == '3') {
|
} else if (Asc.scope.alias == '3') {
|
||||||
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4';
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(25);
|
oParaPr.SetIndFirstLine(25)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Heading 4");
|
oNewDocumentStyle = oDocument.GetStyle('Heading 4')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
let oTextPr = numbering.GetTextPr();
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oTextPr.SetFontFamily('黑体')
|
||||||
} else if (Asc.scope.alias == '4') {
|
} else if (Asc.scope.alias == '4') {
|
||||||
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5';
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(25);
|
oParaPr.SetIndFirstLine(25)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Heading 5");
|
oNewDocumentStyle = oDocument.GetStyle('Heading 5')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
let oTextPr = numbering.GetTextPr();
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oTextPr.SetFontFamily('黑体')
|
||||||
} else if (Asc.scope.alias == '5') {
|
} else if (Asc.scope.alias == '5') {
|
||||||
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5.%6';
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5.%6'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(25);
|
oParaPr.SetIndFirstLine(25)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Heading 6");
|
oNewDocumentStyle = oDocument.GetStyle('Heading 6')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
let oTextPr = numbering.GetTextPr();
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oTextPr.SetFontFamily('黑体')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Asc.scope.alias == '1') {
|
if (Asc.scope.alias == '1') {
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
const sFormatString = '%1.%2';
|
const sFormatString = '%1.%2'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Heading 2");
|
oNewDocumentStyle = oDocument.GetStyle('Heading 2')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
oParagraph.SetFontFamily('黑体')
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
let oTextPr = numbering.GetTextPr();
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oTextPr.SetFontFamily('黑体')
|
||||||
} else if (Asc.scope.alias == '2') {
|
} else if (Asc.scope.alias == '2') {
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
const sFormatString = '%1.%2.%3';
|
const sFormatString = '%1.%2.%3'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Heading 3");
|
oNewDocumentStyle = oDocument.GetStyle('Heading 3')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
let oTextPr = numbering.GetTextPr();
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oTextPr.SetFontFamily('黑体')
|
||||||
} else if (Asc.scope.alias == '3') {
|
} else if (Asc.scope.alias == '3') {
|
||||||
const sFormatString = '%1.%2.%3.%4';
|
const sFormatString = '%1.%2.%3.%4'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Heading 4");
|
oNewDocumentStyle = oDocument.GetStyle('Heading 4')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
let oTextPr = numbering.GetTextPr();
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oTextPr.SetFontFamily('黑体')
|
||||||
} else if (Asc.scope.alias == '4') {
|
} else if (Asc.scope.alias == '4') {
|
||||||
const sFormatString = '%1.%2.%3.%4.%5';
|
const sFormatString = '%1.%2.%3.%4.%5'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Heading 5");
|
oNewDocumentStyle = oDocument.GetStyle('Heading 5')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
let oTextPr = numbering.GetTextPr();
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oTextPr.SetFontFamily('黑体')
|
||||||
} else if (Asc.scope.alias == '5') {
|
} else if (Asc.scope.alias == '5') {
|
||||||
const sFormatString = '%1.%2.%3.%4.%5.%6';
|
const sFormatString = '%1.%2.%3.%4.%5.%6'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Heading 6");
|
oNewDocumentStyle = oDocument.GetStyle('Heading 6')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
let oTextPr = numbering.GetTextPr();
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oTextPr.SetFontFamily('黑体')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// oParagraphOne.Delete()
|
// oParagraphOne.Delete()
|
||||||
const ParaPr = numbering.GetParaPr()
|
const ParaPr = numbering.GetParaPr()
|
||||||
ParaPr.SetStyle(oNewDocumentStyle)
|
ParaPr.SetStyle(oNewDocumentStyle)
|
||||||
ParaPr.SetSpacingAfter(140)
|
ParaPr.SetSpacingAfter(140)
|
||||||
oParagraph.SetStyle(oNewDocumentStyle);
|
oParagraphNew.SetStyle(oNewDocumentStyle)
|
||||||
oParagraph.SetNumbering(numbering)
|
oParagraphNew.SetNumbering(numbering)
|
||||||
oParagraph.SetSpacingAfter(127)
|
oParagraphNew.SetSpacingAfter(127)
|
||||||
oParagraph.SetSpacingBefore(127)
|
oParagraphNew.SetSpacingBefore(127)
|
||||||
let isTrue = false
|
// let isTrue = false
|
||||||
for (let i = num - 1; i >= 0; i--) {
|
// for (let i = num - 1; i >= 0; i--) {
|
||||||
const element = oDocument.GetElement(i)
|
// const element = oDocument.GetElement(i)
|
||||||
if ("paragraph" === element.GetClassType()) {
|
// if ('paragraph' === element.GetClassType()) {
|
||||||
let ContentControls = element.GetParaPr().GetStyle()
|
// let ContentControls = element.GetParaPr().GetStyle()
|
||||||
if (ContentControls && ContentControls.GetName() == 'Heading 1') {
|
// if (ContentControls && ContentControls.GetName() == 'Heading 1') {
|
||||||
if (element.GetText() == ' 术语和定义') {
|
// if (element.GetText() == ' 术语和定义') {
|
||||||
isTrue = true
|
// isTrue = true
|
||||||
}
|
// }
|
||||||
break;
|
// break
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (isTrue) {
|
// if (isTrue) {
|
||||||
let text = oParagraph.GetText()
|
// let text = oParagraphNew.GetText()
|
||||||
oParagraph.RemoveAllElements()
|
// oParagraphNew.RemoveAllElements()
|
||||||
oParagraph.AddLineBreak();
|
// oParagraphNew.AddLineBreak()
|
||||||
oParagraph.AddText(' '+text)
|
// oParagraphNew.AddText(' ' + text)
|
||||||
}else{
|
// } else {
|
||||||
oParagraph.AddText(' ')
|
// oParagraphNew.AddText(' ')
|
||||||
}
|
// }
|
||||||
oParagraph.SetBold(false);
|
oParagraphNew.SetBold(false)
|
||||||
oParagraph.SetFontFamily("黑体");
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
oParagraph.SetFontSize(21);
|
oParagraphNew.SetFontSize(21)
|
||||||
oParagraph.SetJc("both");
|
oParagraphNew.SetJc('both')
|
||||||
oParagraph.SetColor(0, 0, 0);
|
oParagraphNew.SetColor(0, 0, 0)
|
||||||
let GetNext = oParagraph.GetNext()
|
oDocument.InsertContent([oParagraphNew])
|
||||||
|
let GetNext = oParagraphNew.GetNext()
|
||||||
GetNext.SetSpacingAfter(0)
|
GetNext.SetSpacingAfter(0)
|
||||||
GetNext.SetSpacingBefore(0)
|
GetNext.SetSpacingBefore(0)
|
||||||
// GetNext.Delete()
|
// GetNext.Delete()
|
||||||
// oDocument.InsertContent([oParagraph])
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
insertBarOne (val, isTrue) {
|
insertBarOne (val, isTrue) {
|
||||||
Asc.scope.alias = val;
|
Asc.scope.alias = val
|
||||||
Asc.scope.isTrue = isTrue;
|
Asc.scope.isTrue = isTrue
|
||||||
Asc.scope.numData = this.numData;
|
Asc.scope.numData = this.numData
|
||||||
this.ctx.callCommand(() => {
|
this.ctx.callCommand(() => {
|
||||||
try {
|
try {
|
||||||
const oDocument = Api.GetDocument()
|
const oDocument = Api.GetDocument()
|
||||||
@@ -526,12 +531,12 @@
|
|||||||
let SpacingBefore
|
let SpacingBefore
|
||||||
for (let i = num - 1; i >= 0; i--) {
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
table = element
|
table = element
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if ("paragraph" === element.GetClassType()) {
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
const getNumbering = element.GetNumbering()
|
const getNumbering = element.GetNumbering()
|
||||||
const text = element.GetSpacingAfter()
|
const text = element.GetSpacingAfter()
|
||||||
if (getNumbering !== null) {
|
if (getNumbering !== null) {
|
||||||
@@ -544,7 +549,7 @@
|
|||||||
}
|
}
|
||||||
for (let i = num - 1; i >= 0; i--) {
|
for (let i = num - 1; i >= 0; i--) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
table = element
|
table = element
|
||||||
break
|
break
|
||||||
@@ -553,8 +558,8 @@
|
|||||||
}
|
}
|
||||||
const allElement = oDocument.GetElementsCount()
|
const allElement = oDocument.GetElementsCount()
|
||||||
if (table) {
|
if (table) {
|
||||||
let number = table.GetCell(0, 0).GetContent().GetElement(1);
|
let number = table.GetCell(0, 0).GetContent().GetElement(1)
|
||||||
SpacingBefore = number.GetSpacingBefore();
|
SpacingBefore = number.GetSpacingBefore()
|
||||||
}
|
}
|
||||||
if (SpacingBefore) {
|
if (SpacingBefore) {
|
||||||
if (currentNumbering) {
|
if (currentNumbering) {
|
||||||
@@ -562,11 +567,11 @@
|
|||||||
} else {
|
} else {
|
||||||
for (let i = num + 1; i < allElement; i++) {
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if ("paragraph" === element.GetClassType()) {
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
const getNumbering = element.GetNumbering()
|
const getNumbering = element.GetNumbering()
|
||||||
const text = element.GetSpacingAfter()
|
const text = element.GetSpacingAfter()
|
||||||
if (getNumbering !== null) {
|
if (getNumbering !== null) {
|
||||||
@@ -580,8 +585,8 @@
|
|||||||
if (currentNumbering) {
|
if (currentNumbering) {
|
||||||
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
} else {
|
} else {
|
||||||
let oNumbering = oDocument.CreateNumbering("numbered");
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
numbering = oNumbering.GetLevel(Asc.scope.alias);
|
numbering = oNumbering.GetLevel(Asc.scope.alias)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -590,11 +595,11 @@
|
|||||||
} else {
|
} else {
|
||||||
for (let i = num + 1; i < allElement; i++) {
|
for (let i = num + 1; i < allElement; i++) {
|
||||||
const element = oDocument.GetElement(i)
|
const element = oDocument.GetElement(i)
|
||||||
if ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
if (element.GetTableDescription() == 'appendix') {
|
if (element.GetTableDescription() == 'appendix') {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if ("paragraph" === element.GetClassType()) {
|
} else if ('paragraph' === element.GetClassType()) {
|
||||||
const getNumbering = element.GetNumbering()
|
const getNumbering = element.GetNumbering()
|
||||||
const text = element.GetSpacingAfter()
|
const text = element.GetSpacingAfter()
|
||||||
if (getNumbering !== null) {
|
if (getNumbering !== null) {
|
||||||
@@ -608,137 +613,139 @@
|
|||||||
if (currentNumbering) {
|
if (currentNumbering) {
|
||||||
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
} else {
|
} else {
|
||||||
let oNumbering = oDocument.CreateNumbering("numbered");
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
numbering = oNumbering.GetLevel(Asc.scope.alias);
|
numbering = oNumbering.GetLevel(Asc.scope.alias)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const oParagraph = Api.CreateParagraph()
|
const oParagraphNew = Api.CreateParagraph()
|
||||||
|
oParagraphNew.AddText(' ' + oParagraph.GetText())
|
||||||
|
oParagraph.Delete()
|
||||||
let oNewDocumentStyle = null
|
let oNewDocumentStyle = null
|
||||||
if (SpacingBefore) {
|
if (SpacingBefore) {
|
||||||
if (Asc.scope.alias == '1') {
|
if (Asc.scope.alias == '1') {
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2';
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(25);
|
oParaPr.SetIndFirstLine(25)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Normal");
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
} else if (Asc.scope.alias == '2') {
|
} else if (Asc.scope.alias == '2') {
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3';
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(25);
|
oParaPr.SetIndFirstLine(25)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Normal");
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
} else if (Asc.scope.alias == '3') {
|
} else if (Asc.scope.alias == '3') {
|
||||||
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4';
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(25);
|
oParaPr.SetIndFirstLine(25)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Normal");
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
} else if (Asc.scope.alias == '4') {
|
} else if (Asc.scope.alias == '4') {
|
||||||
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5';
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(25);
|
oParaPr.SetIndFirstLine(25)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Normal");
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
} else if (Asc.scope.alias == '5') {
|
} else if (Asc.scope.alias == '5') {
|
||||||
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5.%6';
|
const sFormatString = Asc.scope.numData[SpacingBefore] + '.%1.%2.%3.%4.%5.%6'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(25);
|
oParaPr.SetIndFirstLine(25)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Normal");
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Asc.scope.alias == '1') {
|
if (Asc.scope.alias == '1') {
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
const sFormatString = '%1.%2';
|
const sFormatString = '%1.%2'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Normal");
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
} else if (Asc.scope.alias == '2') {
|
} else if (Asc.scope.alias == '2') {
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
const sFormatString = '%1.%2.%3';
|
const sFormatString = '%1.%2.%3'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Normal");
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
} else if (Asc.scope.alias == '3') {
|
} else if (Asc.scope.alias == '3') {
|
||||||
const sFormatString = '%1.%2.%3.%4';
|
const sFormatString = '%1.%2.%3.%4'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Normal");
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
} else if (Asc.scope.alias == '4') {
|
} else if (Asc.scope.alias == '4') {
|
||||||
const sFormatString = '%1.%2.%3.%4.%5';
|
const sFormatString = '%1.%2.%3.%4.%5'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Normal");
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
} else if (Asc.scope.alias == '5') {
|
} else if (Asc.scope.alias == '5') {
|
||||||
const sFormatString = '%1.%2.%3.%4.%5.%6';
|
const sFormatString = '%1.%2.%3.%4.%5.%6'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "left");
|
numbering.SetCustomType('decimal', sFormatString, 'left')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('none')
|
||||||
let oParaPr = numbering.GetParaPr();
|
let oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(0);
|
oParaPr.SetIndFirstLine(0)
|
||||||
oNewDocumentStyle = oDocument.GetStyle("Normal");
|
oNewDocumentStyle = oDocument.GetStyle('Normal')
|
||||||
oParagraph.SetIndLeft(0);
|
oParagraphNew.SetIndLeft(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// oParagraphOne.Delete()
|
// oParagraphOne.Delete()
|
||||||
let oTextPr = numbering.GetTextPr();
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily("黑体");
|
oTextPr.SetFontFamily('黑体')
|
||||||
const ParaPr = numbering.GetParaPr()
|
const ParaPr = numbering.GetParaPr()
|
||||||
ParaPr.SetStyle(oNewDocumentStyle)
|
ParaPr.SetStyle(oNewDocumentStyle)
|
||||||
ParaPr.SetSpacingAfter(140)
|
ParaPr.SetSpacingAfter(140)
|
||||||
oParagraph.SetStyle(oNewDocumentStyle);
|
oParagraphNew.SetStyle(oNewDocumentStyle)
|
||||||
oParagraph.SetNumbering(numbering)
|
oParagraphNew.SetNumbering(numbering)
|
||||||
oParagraph.SetSpacingAfter(127)
|
oParagraphNew.SetSpacingAfter(0)
|
||||||
oParagraph.SetSpacingBefore(127)
|
oParagraphNew.SetSpacingBefore(0)
|
||||||
oParagraph.SetFontFamily("宋体");
|
oParagraphNew.SetFontFamily('宋体')
|
||||||
let isTrue = false
|
let isTrue = false
|
||||||
for (let i = num - 1; i >= 0; i--) {
|
// for (let i = num - 1; i >= 0; i--) {
|
||||||
const element = oDocument.GetElement(i)
|
// const element = oDocument.GetElement(i)
|
||||||
if ("paragraph" === element.GetClassType()) {
|
// if ('paragraph' === element.GetClassType()) {
|
||||||
let ContentControls = element.GetParaPr().GetStyle()
|
// let ContentControls = element.GetParaPr().GetStyle()
|
||||||
if (ContentControls && ContentControls.GetName() == 'Heading 1') {
|
// if (ContentControls && ContentControls.GetName() == 'Heading 1') {
|
||||||
if (element.GetText() == ' 术语和定义') {
|
// if (element.GetText() == ' 术语和定义') {
|
||||||
isTrue = true
|
// isTrue = true
|
||||||
}
|
// }
|
||||||
break;
|
// break
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (isTrue) {
|
// if (isTrue) {
|
||||||
let text = oParagraph.GetText()
|
// let text = oParagraphNew.GetText()
|
||||||
oParagraph.RemoveAllElements()
|
// oParagraphNew.RemoveAllElements()
|
||||||
oParagraph.AddLineBreak();
|
// oParagraphNew.AddLineBreak()
|
||||||
oParagraph.AddText(' '+text)
|
// oParagraphNew.AddText(' ' + text)
|
||||||
}else{
|
// } else {
|
||||||
oParagraph.AddText(' ')
|
// oParagraphNew.AddText(' ')
|
||||||
}
|
// }
|
||||||
oParagraph.SetBold(false);
|
oParagraphNew.SetBold(false)
|
||||||
oParagraph.SetFontSize(21);
|
oParagraphNew.SetFontSize(21)
|
||||||
oParagraph.SetJc("left");
|
oParagraphNew.SetJc('left')
|
||||||
oParagraph.SetColor(0, 0, 0);
|
oParagraphNew.SetColor(0, 0, 0)
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraphNew])
|
||||||
let GetNext = oParagraph.GetNext()
|
let GetNext = oParagraphNew.GetNext()
|
||||||
GetNext.SetSpacingAfter(0)
|
GetNext.SetSpacingAfter(0)
|
||||||
GetNext.SetSpacingBefore(0)
|
GetNext.SetSpacingBefore(0)
|
||||||
// GetNext.Delete()
|
// GetNext.Delete()
|
||||||
@@ -748,7 +755,7 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
adjustTo (val) {
|
adjustTo (val) {
|
||||||
Asc.scope.alias = val.key;
|
Asc.scope.alias = val.key
|
||||||
this.ctx.callCommand(() => {
|
this.ctx.callCommand(() => {
|
||||||
try {
|
try {
|
||||||
const oDocument = Api.GetDocument()
|
const oDocument = Api.GetDocument()
|
||||||
@@ -757,12 +764,12 @@
|
|||||||
let currentNumbering = null
|
let currentNumbering = null
|
||||||
for (let index = 0; index < allElement; index++) {
|
for (let index = 0; index < allElement; index++) {
|
||||||
const element = oDocument.GetElement(index)
|
const element = oDocument.GetElement(index)
|
||||||
if ("paragraph" === element.GetClassType()) {
|
if ('paragraph' === element.GetClassType()) {
|
||||||
const getNumbering = element.GetNumbering()
|
const getNumbering = element.GetNumbering()
|
||||||
if (getNumbering !== null) {
|
if (getNumbering !== null) {
|
||||||
currentNumbering = getNumbering
|
currentNumbering = getNumbering
|
||||||
} else {
|
} else {
|
||||||
currentNumbering = element.CreateNumbering("numbered");
|
currentNumbering = element.CreateNumbering('numbered')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -770,16 +777,16 @@
|
|||||||
if (currentNumbering) {
|
if (currentNumbering) {
|
||||||
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
numbering = currentNumbering.GetNumbering().GetLevel(Asc.scope.alias)
|
||||||
} else {
|
} else {
|
||||||
const numberingIndex = oDocument.CreateNumbering("numbered");
|
const numberingIndex = oDocument.CreateNumbering('numbered')
|
||||||
numbering = numberingIndex.GetLevel(0);
|
numbering = numberingIndex.GetLevel(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const oParagraph = Api.CreateParagraph()
|
const oParagraph = Api.CreateParagraph()
|
||||||
oParagraph.SetNumbering(numbering)
|
oParagraph.SetNumbering(numbering)
|
||||||
oParagraph.SetIndLeft(360);
|
oParagraph.SetIndLeft(360)
|
||||||
oParagraph.SetBold(false);
|
oParagraph.SetBold(false)
|
||||||
oParagraph.SetFontSize(21);
|
oParagraph.SetFontSize(21)
|
||||||
oParagraph.SetFontFamily("黑体");
|
oParagraph.SetFontFamily('黑体')
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
@@ -791,8 +798,8 @@
|
|||||||
},
|
},
|
||||||
upgradeClick () {
|
upgradeClick () {
|
||||||
|
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user