fix 章、条(一到五),无题(一到五)左缩进为0,字母列项左/悬挂缩进0.74,数字列项左缩进1.48,悬挂缩进0.74

This commit is contained in:
赵霄
2023-09-06 14:27:32 +08:00
parent dffe84dd79
commit b387486965
3 changed files with 28 additions and 26 deletions
@@ -173,6 +173,7 @@
var oParaPr = numbering.GetParaPr(); var oParaPr = numbering.GetParaPr();
oParaPr.SetSpacingLine(290, "auto"); oParaPr.SetSpacingLine(290, "auto");
oParaPr.SetJc("tab"); oParaPr.SetJc("tab");
oParaPr.SetIndFirstLine(-420);
// oParaPr.SetIndFirstLine(0); // oParaPr.SetIndFirstLine(0);
oParagraph.SetNumbering(numbering) oParagraph.SetNumbering(numbering)
oParagraph.SetContextualSpacing(true) oParagraph.SetContextualSpacing(true)
@@ -237,13 +238,14 @@
// oParaPr.SetIndLeft(1310) // oParaPr.SetIndLeft(1310)
oParaPr.SetJc("left"); oParaPr.SetJc("left");
oParaPr.SetSpacingLine(290, "auto"); oParaPr.SetSpacingLine(290, "auto");
oParaPr.SetIndFirstLine(-420);
const oParagraph = Api.CreateParagraph() const oParagraph = Api.CreateParagraph()
oParagraph.SetNumbering(numbering) oParagraph.SetNumbering(numbering)
oParagraph.SetContextualSpacing(true) oParagraph.SetContextualSpacing(true)
oParagraph.SetFontFamily('宋体') oParagraph.SetFontFamily('宋体')
oParagraph.SetSpacingBefore(2) oParagraph.SetSpacingBefore(2)
oParagraph.SetFontSize(21) oParagraph.SetFontSize(21)
oParagraph.SetIndLeft(1270); oParagraph.SetIndLeft(1260);
oParagraph.SetHighlight(255, 255, 0); oParagraph.SetHighlight(255, 255, 0);
oDocument.InsertContent([oParagraph]) oDocument.InsertContent([oParagraph])
let text = oParagraph.GetText() let text = oParagraph.GetText()
+3 -3
View File
@@ -1157,7 +1157,7 @@ export default {
oParagraph.SetSpacingAfter(267) oParagraph.SetSpacingAfter(267)
oParagraph.SetJc('left') oParagraph.SetJc('left')
oParagraph.SetColor(0, 0, 0) oParagraph.SetColor(0, 0, 0)
oParagraph.SetIndLeft(20) oParagraph.SetIndLeft(0)
oParagraph.SetBold(false) oParagraph.SetBold(false)
oDocument.InsertContent([oParagraph]) oDocument.InsertContent([oParagraph])
@@ -1192,7 +1192,7 @@ export default {
oParagraph4.SetSpacingBefore(267) oParagraph4.SetSpacingBefore(267)
oParagraph4.SetJc('left') oParagraph4.SetJc('left')
oParagraph4.SetColor(0, 0, 0) oParagraph4.SetColor(0, 0, 0)
oParagraph4.SetIndLeft(20) oParagraph4.SetIndLeft(0)
oDocument.InsertContent([oParagraph4]) oDocument.InsertContent([oParagraph4])
const oParagraph5 = Api.CreateParagraph() const oParagraph5 = Api.CreateParagraph()
@@ -1247,7 +1247,7 @@ export default {
oParagraph8.SetSpacingBefore(267) oParagraph8.SetSpacingBefore(267)
oParagraph8.SetJc('left') oParagraph8.SetJc('left')
oParagraph8.SetColor(0, 0, 0) oParagraph8.SetColor(0, 0, 0)
oParagraph8.SetIndLeft(20) oParagraph8.SetIndLeft(0)
oDocument.InsertContent([oParagraph8]) oDocument.InsertContent([oParagraph8])
const oParagraph9 = Api.CreateParagraph() const oParagraph9 = Api.CreateParagraph()
+22 -22
View File
@@ -203,10 +203,10 @@
oNumLvl.SetSuff("space"); oNumLvl.SetSuff("space");
oParagraph.SetNumbering(oNumLvl) oParagraph.SetNumbering(oNumLvl)
if (SpacingBefore) { if (SpacingBefore) {
oParagraph.SetIndLeft(20); oParagraph.SetIndLeft(0);
oParaPr.SetIndFirstLine(20); oParaPr.SetIndFirstLine(20);
} else { } else {
oParagraph.SetIndLeft(20); oParagraph.SetIndLeft(0);
oParaPr.SetIndFirstLine(0); oParaPr.SetIndFirstLine(0);
} }
oParagraph.SetSpacingAfter(267) oParagraph.SetSpacingAfter(267)
@@ -338,7 +338,7 @@
let oNewDocumentStyle = null let oNewDocumentStyle = null
if (SpacingBefore) { if (SpacingBefore) {
if (Asc.scope.alias == '1') { if (Asc.scope.alias == '1') {
oParagraph.SetIndLeft(20); oParagraph.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("space");
@@ -351,7 +351,7 @@
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(20); oParagraph.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("space");
@@ -371,7 +371,7 @@
oNewDocumentStyle = oDocument.GetStyle("Heading 4"); oNewDocumentStyle = oDocument.GetStyle("Heading 4");
const oTextPr3 = oNewDocumentStyle.GetTextPr(); const oTextPr3 = oNewDocumentStyle.GetTextPr();
oTextPr3.SetFontFamily("黑体"); oTextPr3.SetFontFamily("黑体");
oParagraph.SetIndLeft(20); oParagraph.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') {
@@ -383,7 +383,7 @@
oNewDocumentStyle = oDocument.GetStyle("Heading 5"); oNewDocumentStyle = oDocument.GetStyle("Heading 5");
const oTextPr3 = oNewDocumentStyle.GetTextPr(); const oTextPr3 = oNewDocumentStyle.GetTextPr();
oTextPr3.SetFontFamily("黑体"); oTextPr3.SetFontFamily("黑体");
oParagraph.SetIndLeft(20); oParagraph.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') {
@@ -395,13 +395,13 @@
oNewDocumentStyle = oDocument.GetStyle("Heading 6"); oNewDocumentStyle = oDocument.GetStyle("Heading 6");
const oTextPr3 = oNewDocumentStyle.GetTextPr(); const oTextPr3 = oNewDocumentStyle.GetTextPr();
oTextPr3.SetFontFamily("黑体"); oTextPr3.SetFontFamily("黑体");
oParagraph.SetIndLeft(20); oParagraph.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(20); oParagraph.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("space");
@@ -414,7 +414,7 @@
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(20); oParagraph.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("space");
@@ -434,7 +434,7 @@
oNewDocumentStyle = oDocument.GetStyle("Heading 4"); oNewDocumentStyle = oDocument.GetStyle("Heading 4");
const oTextPr3 = oNewDocumentStyle.GetTextPr(); const oTextPr3 = oNewDocumentStyle.GetTextPr();
oTextPr3.SetFontFamily("黑体"); oTextPr3.SetFontFamily("黑体");
oParagraph.SetIndLeft(20); oParagraph.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') {
@@ -446,7 +446,7 @@
oNewDocumentStyle = oDocument.GetStyle("Heading 5"); oNewDocumentStyle = oDocument.GetStyle("Heading 5");
const oTextPr3 = oNewDocumentStyle.GetTextPr(); const oTextPr3 = oNewDocumentStyle.GetTextPr();
oTextPr3.SetFontFamily("黑体"); oTextPr3.SetFontFamily("黑体");
oParagraph.SetIndLeft(20); oParagraph.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') {
@@ -458,7 +458,7 @@
oNewDocumentStyle = oDocument.GetStyle("Heading 6"); oNewDocumentStyle = oDocument.GetStyle("Heading 6");
const oTextPr3 = oNewDocumentStyle.GetTextPr(); const oTextPr3 = oNewDocumentStyle.GetTextPr();
oTextPr3.SetFontFamily("黑体"); oTextPr3.SetFontFamily("黑体");
oParagraph.SetIndLeft(20); oParagraph.SetIndLeft(0);
let oTextPr = numbering.GetTextPr(); let oTextPr = numbering.GetTextPr();
oTextPr.SetFontFamily("黑体"); oTextPr.SetFontFamily("黑体");
} }
@@ -614,7 +614,7 @@
let oNewDocumentStyle = null let oNewDocumentStyle = null
if (SpacingBefore) { if (SpacingBefore) {
if (Asc.scope.alias == '1') { if (Asc.scope.alias == '1') {
oParagraph.SetIndLeft(20); oParagraph.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("space");
@@ -622,7 +622,7 @@
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(20); oParagraph.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("space");
@@ -636,7 +636,7 @@
let oParaPr = numbering.GetParaPr(); let oParaPr = numbering.GetParaPr();
oParaPr.SetIndFirstLine(25); oParaPr.SetIndFirstLine(25);
oNewDocumentStyle = oDocument.GetStyle("Normal"); oNewDocumentStyle = oDocument.GetStyle("Normal");
oParagraph.SetIndLeft(20); oParagraph.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");
@@ -644,7 +644,7 @@
let oParaPr = numbering.GetParaPr(); let oParaPr = numbering.GetParaPr();
oParaPr.SetIndFirstLine(25); oParaPr.SetIndFirstLine(25);
oNewDocumentStyle = oDocument.GetStyle("Normal"); oNewDocumentStyle = oDocument.GetStyle("Normal");
oParagraph.SetIndLeft(20); oParagraph.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");
@@ -652,11 +652,11 @@
let oParaPr = numbering.GetParaPr(); let oParaPr = numbering.GetParaPr();
oParaPr.SetIndFirstLine(25); oParaPr.SetIndFirstLine(25);
oNewDocumentStyle = oDocument.GetStyle("Normal"); oNewDocumentStyle = oDocument.GetStyle("Normal");
oParagraph.SetIndLeft(20); oParagraph.SetIndLeft(0);
} }
} else { } else {
if (Asc.scope.alias == '1') { if (Asc.scope.alias == '1') {
oParagraph.SetIndLeft(20); oParagraph.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("space");
@@ -664,7 +664,7 @@
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(20); oParagraph.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("space");
@@ -678,7 +678,7 @@
let oParaPr = numbering.GetParaPr(); let oParaPr = numbering.GetParaPr();
oParaPr.SetIndFirstLine(0); oParaPr.SetIndFirstLine(0);
oNewDocumentStyle = oDocument.GetStyle("Normal"); oNewDocumentStyle = oDocument.GetStyle("Normal");
oParagraph.SetIndLeft(20); oParagraph.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");
@@ -686,7 +686,7 @@
let oParaPr = numbering.GetParaPr(); let oParaPr = numbering.GetParaPr();
oParaPr.SetIndFirstLine(0); oParaPr.SetIndFirstLine(0);
oNewDocumentStyle = oDocument.GetStyle("Normal"); oNewDocumentStyle = oDocument.GetStyle("Normal");
oParagraph.SetIndLeft(20); oParagraph.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");
@@ -694,7 +694,7 @@
let oParaPr = numbering.GetParaPr(); let oParaPr = numbering.GetParaPr();
oParaPr.SetIndFirstLine(0); oParaPr.SetIndFirstLine(0);
oNewDocumentStyle = oDocument.GetStyle("Normal"); oNewDocumentStyle = oDocument.GetStyle("Normal");
oParagraph.SetIndLeft(20); oParagraph.SetIndLeft(0);
} }
} }
// oParagraphOne.Delete() // oParagraphOne.Delete()