fix 1、表”与“1”之间去掉空格
2、“表1”标题 段前段后0.5个字符
3、表格外围 1.5磅,里边线条0.5磅
This commit is contained in:
@@ -36,13 +36,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "SaicTable",
|
name: 'SaicTable',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
visible: false,
|
visible: false,
|
||||||
formItemLayout: {
|
formItemLayout: {
|
||||||
labelCol: { span: 6 },
|
labelCol: { span: 6 },
|
||||||
wrapperCol: {span: 14},
|
wrapperCol: { span: 14 }
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
imageUrl: '',
|
imageUrl: '',
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
this.visible = true
|
this.visible = true
|
||||||
this.form = {
|
this.form = {
|
||||||
rows: 7,
|
rows: 7,
|
||||||
column:4,
|
column: 4
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 插入表格含题注
|
// 插入表格含题注
|
||||||
@@ -100,34 +100,34 @@
|
|||||||
Asc.scope.column = data.column
|
Asc.scope.column = data.column
|
||||||
this.ctx.callCommand(() => {
|
this.ctx.callCommand(() => {
|
||||||
try {
|
try {
|
||||||
const oDocument = Api.GetDocument();
|
const oDocument = Api.GetDocument()
|
||||||
const oTable = Api.CreateTable(Asc.scope.column,Asc.scope.rows);
|
const oTable = Api.CreateTable(Asc.scope.column, Asc.scope.rows)
|
||||||
oTable.SetWidth("percent", 100);
|
oTable.SetWidth('percent', 100)
|
||||||
oTable.SetTableLayout('fixed');
|
oTable.SetTableLayout('fixed')
|
||||||
oTable.SetTableCellMarginRight(0.2 * (1440 / 2.54));
|
oTable.SetTableCellMarginRight(0.2 * (1440 / 2.54))
|
||||||
oTable.SetTableCellMarginTop(0.2 * (1440 / 2.54));
|
oTable.SetTableCellMarginTop(0.2 * (1440 / 2.54))
|
||||||
oTable.SetTableCellMarginLeft(0.2 * (1440 / 2.54));
|
oTable.SetTableCellMarginLeft(0.2 * (1440 / 2.54))
|
||||||
oTable.SetTableCellMarginBottom(0.2 * (1440 / 2.54));
|
oTable.SetTableCellMarginBottom(0.2 * (1440 / 2.54))
|
||||||
oTable.SetTableBorderTop("single", 9, 0, 0, 0, 0);
|
oTable.SetTableBorderTop('single', 12, 0, 0, 0, 0)
|
||||||
oTable.SetTableBorderBottom("single", 9, 0, 0, 0, 0);
|
oTable.SetTableBorderBottom('single', 12, 0, 0, 0, 0)
|
||||||
oTable.SetTableBorderLeft("single", 9, 0, 0, 0, 0);
|
oTable.SetTableBorderLeft('single', 12, 0, 0, 0, 0)
|
||||||
oTable.SetTableBorderRight("single", 9, 0, 0, 0, 0);
|
oTable.SetTableBorderRight('single', 12, 0, 0, 0, 0)
|
||||||
oTable.SetTableBorderInsideV("single", 6, 0, 0, 0, 0);
|
oTable.SetTableBorderInsideV('single', 4, 0, 0, 0, 0)
|
||||||
oTable.SetTableBorderInsideH("single", 6, 0, 0, 0, 0);
|
oTable.SetTableBorderInsideH('single', 4, 0, 0, 0, 0)
|
||||||
const oRowsCount = oTable.GetRowsCount();
|
const oRowsCount = oTable.GetRowsCount()
|
||||||
oTable.SetTableDescription("tableOp");
|
oTable.SetTableDescription('tableOp')
|
||||||
oDocument.InsertContent([oTable]);
|
oDocument.InsertContent([oTable])
|
||||||
for (let i = 0; i < oRowsCount; i++) {
|
for (let i = 0; i < oRowsCount; i++) {
|
||||||
const oCellsCount = oTable.GetRow(i).GetCellsCount();
|
const oCellsCount = oTable.GetRow(i).GetCellsCount()
|
||||||
for (let j = 0; j < oCellsCount; j++) {
|
for (let j = 0; j < oCellsCount; j++) {
|
||||||
const cellEle = oTable
|
const cellEle = oTable
|
||||||
.GetRow(i)
|
.GetRow(i)
|
||||||
.GetCell(j)
|
.GetCell(j)
|
||||||
.GetContent()
|
.GetContent()
|
||||||
.GetElement(0);
|
.GetElement(0)
|
||||||
cellEle.SetSpacingAfter(10)
|
cellEle.SetSpacingAfter(10)
|
||||||
cellEle.SetFontSize(18)
|
cellEle.SetFontSize(18)
|
||||||
cellEle.SetColor(0, 0, 0);
|
cellEle.SetColor(0, 0, 0)
|
||||||
// if (i === 0) {
|
// if (i === 0) {
|
||||||
// oTable
|
// oTable
|
||||||
// .GetRow(i)
|
// .GetRow(i)
|
||||||
@@ -148,33 +148,33 @@
|
|||||||
// // cellEle.SetFontFamily("宋体");
|
// // cellEle.SetFontFamily("宋体");
|
||||||
// } else
|
// } else
|
||||||
// 表头
|
// 表头
|
||||||
if (i === 0) {
|
// if (i === 0) {
|
||||||
oTable
|
// oTable
|
||||||
.GetRow(i)
|
// .GetRow(i)
|
||||||
.GetCell(j)
|
// .GetCell(j)
|
||||||
.SetCellBorderTop("single", 9, 0, 0, 0, 0);
|
// .SetCellBorderTop("single", 9, 0, 0, 0, 0);
|
||||||
// oTable
|
// oTable
|
||||||
// .GetRow(i)
|
// .GetRow(i)
|
||||||
// .GetCell(j)
|
// .GetCell(j)
|
||||||
// .SetCellBorderRight("single", 6, 0, 0, 0, 0);
|
// .SetCellBorderRight("single", 6, 0, 0, 0, 0);
|
||||||
oTable
|
// oTable
|
||||||
.GetRow(i)
|
// .GetRow(i)
|
||||||
.GetCell(j)
|
// .GetCell(j)
|
||||||
.SetCellBorderBottom("single", 9, 0, 0, 0, 0);
|
// .SetCellBorderBottom("single", 9, 0, 0, 0, 0);
|
||||||
// oTable
|
// oTable
|
||||||
// .GetRow(i)
|
// .GetRow(i)
|
||||||
// .GetCell(j)
|
// .GetCell(j)
|
||||||
// .SetCellBorderLeft("single", 6, 0, 0, 0, 0);
|
// .SetCellBorderLeft("single", 6, 0, 0, 0, 0);
|
||||||
// cellEle.SetFontFamily("宋体");
|
// cellEle.SetFontFamily("宋体");
|
||||||
} else if (i === oRowsCount - 2) {
|
// } else if (i === oRowsCount - 2) {
|
||||||
oTable
|
// oTable
|
||||||
.GetRow(i)
|
// .GetRow(i)
|
||||||
.GetCell(j)
|
// .GetCell(j)
|
||||||
.SetCellBorderBottom("single", 9, 0, 0, 0, 0);
|
// .SetCellBorderBottom("single", 9, 0, 0, 0, 0);
|
||||||
} else {
|
// } else {
|
||||||
// cellEle.SetFontFamily("宋体");
|
// cellEle.SetFontFamily("宋体");
|
||||||
}
|
// }
|
||||||
cellEle.SetFontSize(18);
|
cellEle.SetFontSize(18)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,9 +249,9 @@
|
|||||||
// oCell.AddElement(2, oTable);
|
// oCell.AddElement(2, oTable);
|
||||||
|
|
||||||
// 表格注
|
// 表格注
|
||||||
const oLastRow = oTable.GetRow(oTable.GetRowsCount() - 1);
|
const oLastRow = oTable.GetRow(oTable.GetRowsCount() - 1)
|
||||||
oLastRow.MergeCells();
|
oLastRow.MergeCells()
|
||||||
oLastRow.SetHeight("atLeast", 540);
|
oLastRow.SetHeight('atLeast', 540)
|
||||||
|
|
||||||
// const noteNumbering = oDocument.CreateNumbering("numbered");
|
// const noteNumbering = oDocument.CreateNumbering("numbered");
|
||||||
// const noteNumLevel = noteNumbering.GetLevel(0);
|
// const noteNumLevel = noteNumbering.GetLevel(0);
|
||||||
@@ -272,9 +272,9 @@
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e)
|
||||||
}
|
}
|
||||||
}, false);
|
}, false)
|
||||||
this.visible = false
|
this.visible = false
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -282,55 +282,55 @@
|
|||||||
handleInsertNote () {
|
handleInsertNote () {
|
||||||
this.ctx.callCommand(() => {
|
this.ctx.callCommand(() => {
|
||||||
try {
|
try {
|
||||||
const oDocument = Api.GetDocument();
|
const oDocument = Api.GetDocument()
|
||||||
const newParagraph = Api.CreateParagraph();
|
const newParagraph = Api.CreateParagraph()
|
||||||
const oTableCell = newParagraph.GetParentTableCell();
|
const oTableCell = newParagraph.GetParentTableCell()
|
||||||
console.log(oTableCell);
|
console.log(oTableCell)
|
||||||
const elementsCount = oTableCell.GetContent().GetElementsCount();
|
const elementsCount = oTableCell.GetContent().GetElementsCount()
|
||||||
let noteNumLevel = null;
|
let noteNumLevel = null
|
||||||
for (let i = 0; i < elementsCount; i++) {
|
for (let i = 0; i < elementsCount; i++) {
|
||||||
const ele = oTableCell.GetContent().GetElement(i);
|
const ele = oTableCell.GetContent().GetElement(i)
|
||||||
if (
|
if (
|
||||||
ele &&
|
ele &&
|
||||||
ele.GetClassType() === "paragraph" &&
|
ele.GetClassType() === 'paragraph' &&
|
||||||
ele.GetNumbering()
|
ele.GetNumbering()
|
||||||
) {
|
) {
|
||||||
noteNumLevel = ele.GetNumbering();
|
noteNumLevel = ele.GetNumbering()
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!noteNumLevel) {
|
if (!noteNumLevel) {
|
||||||
const noteNumbering = oDocument.CreateNumbering("numbered");
|
const noteNumbering = oDocument.CreateNumbering('numbered')
|
||||||
noteNumLevel = noteNumbering.GetLevel(0);
|
noteNumLevel = noteNumbering.GetLevel(0)
|
||||||
const sFormatString = "注%1:";
|
const sFormatString = '注%1:'
|
||||||
noteNumLevel.SetCustomType("decimal", sFormatString, "center");
|
noteNumLevel.SetCustomType('decimal', sFormatString, 'center')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表格中文注
|
// 表格中文注
|
||||||
var textPr = noteNumLevel.GetTextPr();
|
var textPr = noteNumLevel.GetTextPr()
|
||||||
textPr.SetFontFamily("黑体");
|
textPr.SetFontFamily('黑体')
|
||||||
textPr.SetFontSize(18)
|
textPr.SetFontSize(18)
|
||||||
const noteParagraph = Api.CreateParagraph();
|
const noteParagraph = Api.CreateParagraph()
|
||||||
noteParagraph.SetNumbering(noteNumLevel);
|
noteParagraph.SetNumbering(noteNumLevel)
|
||||||
noteParagraph.AddText("XXX");
|
noteParagraph.AddText('XXX')
|
||||||
noteParagraph.SetFontSize(18);
|
noteParagraph.SetFontSize(18)
|
||||||
noteParagraph.SetFontFamily("SimSun");
|
noteParagraph.SetFontFamily('SimSun')
|
||||||
|
|
||||||
if (elementsCount > 0) {
|
if (elementsCount > 0) {
|
||||||
oTableCell.AddElement(elementsCount - 1, noteParagraph);
|
oTableCell.AddElement(elementsCount - 1, noteParagraph)
|
||||||
} else {
|
} else {
|
||||||
oTableCell.AddElement(0, noteParagraph);
|
oTableCell.AddElement(0, noteParagraph)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elementsCount > 0) {
|
if (elementsCount > 0) {
|
||||||
// oTableCell.AddElement(elementsCount, noteParagraphEN);
|
// oTableCell.AddElement(elementsCount, noteParagraphEN);
|
||||||
} else {
|
} else {
|
||||||
oTableCell.AddElement(1, noteParagraph);
|
oTableCell.AddElement(1, noteParagraph)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
handleInsertNoteThe () {
|
handleInsertNoteThe () {
|
||||||
@@ -341,26 +341,26 @@
|
|||||||
const oDocument = Api.GetDocument()
|
const oDocument = Api.GetDocument()
|
||||||
let oNumbering = oDocument.CreateNumbering('numbered')
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
const oNumLvl = oNumbering.GetLevel(0)
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
oNumLvl.SetCustomType('decimalZero', "注:", "right")
|
oNumLvl.SetCustomType('decimalZero', '注:', 'right')
|
||||||
oNumLvl.SetSuff("space");
|
oNumLvl.SetSuff('space')
|
||||||
const oParaPr = oNumLvl.GetParaPr();
|
const oParaPr = oNumLvl.GetParaPr()
|
||||||
// oParaPr.SetSpacingLine(280, "auto");
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
// oParaPr.SetJc("both");
|
// oParaPr.SetJc("both");
|
||||||
oParaPr.SetIndFirstLine(-86);
|
oParaPr.SetIndFirstLine(-86)
|
||||||
const textPr = oNumLvl.GetTextPr();
|
const textPr = oNumLvl.GetTextPr()
|
||||||
textPr.SetFontFamily("黑体");
|
textPr.SetFontFamily('黑体')
|
||||||
textPr.SetFontSize(18)
|
textPr.SetFontSize(18)
|
||||||
const oParagraph = Api.CreateParagraph()
|
const oParagraph = Api.CreateParagraph()
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
oParagraph.SetContextualSpacing(true)
|
oParagraph.SetContextualSpacing(true)
|
||||||
oParagraph.SetFontFamily('宋体')
|
oParagraph.SetFontFamily('宋体')
|
||||||
oParagraph.SetFontSize(18)
|
oParagraph.SetFontSize(18)
|
||||||
oParagraph.SetIndLeft(766);
|
oParagraph.SetIndLeft(766)
|
||||||
oParagraph.SetHighlight(255, 255, 0);
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
let text = oParagraph.GetText()
|
let text = oParagraph.GetText()
|
||||||
if (text) {
|
if (text) {
|
||||||
let aSearch = oParagraph.Search(text);
|
let aSearch = oParagraph.Search(text)
|
||||||
if (aSearch && aSearch.length > 0) {
|
if (aSearch && aSearch.length > 0) {
|
||||||
aSearch[0].SetFontFamily('宋体')
|
aSearch[0].SetFontFamily('宋体')
|
||||||
aSearch[0].SetFontSize(9)
|
aSearch[0].SetFontSize(9)
|
||||||
@@ -385,10 +385,10 @@
|
|||||||
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 ("table" === element.GetClassType()) {
|
if ('table' === element.GetClassType()) {
|
||||||
for (let i = 0; i < element.GetRowsCount(); i++) {
|
for (let i = 0; i < element.GetRowsCount(); i++) {
|
||||||
if (element.GetCell(i, 0).GetContent().GetElement(0)) {
|
if (element.GetCell(i, 0).GetContent().GetElement(0)) {
|
||||||
const Count = element.GetCell(i, 0).GetContent().GetElementsCount();
|
const Count = element.GetCell(i, 0).GetContent().GetElementsCount()
|
||||||
if (Count > 1) {
|
if (Count > 1) {
|
||||||
for (let j = 0; j < Count; j++) {
|
for (let j = 0; j < Count; j++) {
|
||||||
const getNumbering = element.GetCell(i, 0).GetContent().GetElement(j).GetNumbering()
|
const getNumbering = element.GetCell(i, 0).GetContent().GetElement(j).GetNumbering()
|
||||||
@@ -410,32 +410,32 @@
|
|||||||
} else {
|
} else {
|
||||||
let oNumbering = oDocument.CreateNumbering('numbered')
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
numbering = oNumbering.GetLevel(0)
|
numbering = oNumbering.GetLevel(0)
|
||||||
const sFormatString = '注%1:';
|
const sFormatString = '注%1:'
|
||||||
numbering.SetCustomType("decimal", sFormatString, "right");
|
numbering.SetCustomType('decimal', sFormatString, 'right')
|
||||||
numbering.SetSuff("space");
|
numbering.SetSuff('space')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const oParagraph = Api.CreateParagraph()
|
const oParagraph = Api.CreateParagraph()
|
||||||
// oParagraph.SetSpacingLine(400, "auto");
|
// oParagraph.SetSpacingLine(400, "auto");
|
||||||
const oParaPr = numbering.GetParaPr();
|
const oParaPr = numbering.GetParaPr()
|
||||||
// oParaPr.SetSpacingLine(280, "auto");
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
// oParaPr.SetJc("both");
|
// oParaPr.SetJc("both");
|
||||||
oParaPr.SetIndFirstLine(-86);
|
oParaPr.SetIndFirstLine(-86)
|
||||||
const textPr = numbering.GetTextPr();
|
const textPr = numbering.GetTextPr()
|
||||||
textPr.SetFontFamily("黑体");
|
textPr.SetFontFamily('黑体')
|
||||||
textPr.SetFontSize(18)
|
textPr.SetFontSize(18)
|
||||||
oParagraph.SetNumbering(numbering)
|
oParagraph.SetNumbering(numbering)
|
||||||
oParagraph.SetFontFamily('宋体')
|
oParagraph.SetFontFamily('宋体')
|
||||||
oParagraph.SetSpacingBefore(50)
|
oParagraph.SetSpacingBefore(50)
|
||||||
oParagraph.SetSpacingAfter(50)
|
oParagraph.SetSpacingAfter(50)
|
||||||
oParagraph.SetIndLeft(856);
|
oParagraph.SetIndLeft(856)
|
||||||
oParagraph.SetFontSize(18)
|
oParagraph.SetFontSize(18)
|
||||||
oParagraph.SetBold(false);
|
oParagraph.SetBold(false)
|
||||||
oParagraph.SetHighlight(255, 255, 0);
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
let text = oParagraph.GetText()
|
let text = oParagraph.GetText()
|
||||||
if (text) {
|
if (text) {
|
||||||
let aSearch = oParagraph.Search(text);
|
let aSearch = oParagraph.Search(text)
|
||||||
if (aSearch && aSearch.length > 0) {
|
if (aSearch && aSearch.length > 0) {
|
||||||
aSearch[0].SetFontFamily('宋体')
|
aSearch[0].SetFontFamily('宋体')
|
||||||
aSearch[0].SetFontSize(9)
|
aSearch[0].SetFontSize(9)
|
||||||
@@ -458,28 +458,28 @@
|
|||||||
const oDocument = Api.GetDocument()
|
const oDocument = Api.GetDocument()
|
||||||
let oNumbering = oDocument.CreateNumbering('numbered')
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
const oNumLvl = oNumbering.GetLevel(0)
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
oNumLvl.SetCustomType('decimal', "注%1:", "right")
|
oNumLvl.SetCustomType('decimal', '注%1:', 'right')
|
||||||
oNumLvl.SetSuff("space");
|
oNumLvl.SetSuff('space')
|
||||||
var oParaPr = oNumLvl.GetParaPr();
|
var oParaPr = oNumLvl.GetParaPr()
|
||||||
// oParaPr.SetSpacingLine(280, "auto");
|
// oParaPr.SetSpacingLine(280, "auto");
|
||||||
// oParaPr.SetJc("both");
|
// oParaPr.SetJc("both");
|
||||||
oParaPr.SetIndFirstLine(-86);
|
oParaPr.SetIndFirstLine(-86)
|
||||||
var textPr = oNumLvl.GetTextPr();
|
var textPr = oNumLvl.GetTextPr()
|
||||||
textPr.SetFontFamily("黑体");
|
textPr.SetFontFamily('黑体')
|
||||||
textPr.SetFontSize(18)
|
textPr.SetFontSize(18)
|
||||||
const oParagraph = Api.CreateParagraph()
|
const oParagraph = Api.CreateParagraph()
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
oParagraph.SetFontFamily('宋体')
|
oParagraph.SetFontFamily('宋体')
|
||||||
oParagraph.SetSpacingBefore(50)
|
oParagraph.SetSpacingBefore(50)
|
||||||
oParagraph.SetSpacingAfter(50)
|
oParagraph.SetSpacingAfter(50)
|
||||||
oParagraph.SetIndLeft(856);
|
oParagraph.SetIndLeft(856)
|
||||||
oParagraph.SetBold(false);
|
oParagraph.SetBold(false)
|
||||||
oParagraph.SetFontSize(18)
|
oParagraph.SetFontSize(18)
|
||||||
oParagraph.SetHighlight(255, 255, 0);
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
let text = oParagraph.GetText()
|
let text = oParagraph.GetText()
|
||||||
if (text) {
|
if (text) {
|
||||||
let aSearch = oParagraph.Search(text);
|
let aSearch = oParagraph.Search(text)
|
||||||
if (aSearch && aSearch.length > 0) {
|
if (aSearch && aSearch.length > 0) {
|
||||||
aSearch[0].SetFontFamily('宋体')
|
aSearch[0].SetFontFamily('宋体')
|
||||||
aSearch[0].SetFontSize(9)
|
aSearch[0].SetFontSize(9)
|
||||||
@@ -506,12 +506,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) {
|
||||||
@@ -524,8 +524,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) {
|
||||||
@@ -533,11 +533,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) {
|
||||||
@@ -551,10 +551,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, "center");
|
oNumLvl.SetCustomType('decimal', sFormatString, 'center')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -563,11 +563,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) {
|
||||||
@@ -581,27 +581,28 @@
|
|||||||
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, "center");
|
oNumLvl.SetCustomType('decimal', sFormatString, 'center')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const oNewDocumentStyle = oDocument.GetStyle("List Paragraph");
|
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr();
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily("黑体");
|
oTextPr3.SetFontFamily('黑体')
|
||||||
const textPr = oNumLvl.GetTextPr();
|
const textPr = oNumLvl.GetTextPr()
|
||||||
textPr.SetFontFamily("黑体");
|
textPr.SetFontFamily('黑体')
|
||||||
textPr.SetFontSize(21)
|
textPr.SetFontSize(21)
|
||||||
// const CNParagraph = Api.CreateParagraph();
|
// const CNParagraph = Api.CreateParagraph();
|
||||||
oParagraph.SetJc("center");
|
oParagraph.SetJc('center')
|
||||||
// oParagraph.AddText("企业技术标准类别及代号");
|
// oParagraph.AddText("企业技术标准类别及代号");
|
||||||
oParagraph.SetFontSize(21);
|
oParagraph.SetFontSize(21)
|
||||||
oParagraph.SetStyle(oNewDocumentStyle);
|
oParagraph.SetStyle(oNewDocumentStyle)
|
||||||
oParagraph.SetFontFamily("黑体");
|
oParagraph.SetFontFamily('黑体')
|
||||||
oParagraph.SetSpacingAfter(33,false)
|
oParagraph.SetSpacingAfter(75, false)
|
||||||
oParagraph.SetNumbering(oNumLvl);
|
oParagraph.SetSpacingBefore(73.5, false)
|
||||||
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
oParagraph.AddText('XXX')
|
oParagraph.AddText('XXX')
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
let GetNext = oParagraph.GetNext()
|
let GetNext = oParagraph.GetNext()
|
||||||
@@ -628,12 +629,12 @@
|
|||||||
let currentNumbering
|
let currentNumbering
|
||||||
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() == 'tableOp') {
|
if (element.GetTableDescription() == 'tableOp') {
|
||||||
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) {
|
||||||
@@ -645,9 +646,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (table) {
|
if (table) {
|
||||||
const oRowsCount = table.GetRowsCount();
|
const oRowsCount = table.GetRowsCount()
|
||||||
for (let i = 0; i < oRowsCount; i++) {
|
for (let i = 0; i < oRowsCount; i++) {
|
||||||
const oCellsCount = table.GetRow(i).GetCellsCount();
|
const oCellsCount = table.GetRow(i).GetCellsCount()
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -656,19 +657,19 @@
|
|||||||
.GetRow(i)
|
.GetRow(i)
|
||||||
.GetCell(j)
|
.GetCell(j)
|
||||||
.GetContent()
|
.GetContent()
|
||||||
.GetElementsCount();
|
.GetElementsCount()
|
||||||
for (let k = 0; k < cellEle; k++) {
|
for (let k = 0; k < cellEle; k++) {
|
||||||
const cellEle1 = table
|
const cellEle1 = table
|
||||||
.GetRow(i)
|
.GetRow(i)
|
||||||
.GetCell(j)
|
.GetCell(j)
|
||||||
.GetContent()
|
.GetContent()
|
||||||
.GetElement(k);
|
.GetElement(k)
|
||||||
cellEle1.SetFontSize(18)
|
cellEle1.SetFontSize(18)
|
||||||
let GetNumbering = cellEle1.GetNumbering()
|
let GetNumbering = cellEle1.GetNumbering()
|
||||||
if (GetNumbering) {
|
if (GetNumbering) {
|
||||||
let spacingAfter = cellEle1.GetSpacingAfter()
|
let spacingAfter = cellEle1.GetSpacingAfter()
|
||||||
if (spacingAfter == 30) {
|
if (spacingAfter == 30) {
|
||||||
currentNumbering = GetNumbering;
|
currentNumbering = GetNumbering
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -680,34 +681,34 @@
|
|||||||
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("lowerLetter", sFormatString, "left");
|
oNumLvl.SetCustomType('lowerLetter', sFormatString, 'left')
|
||||||
oNumLvl.SetSuff("space");
|
oNumLvl.SetSuff('space')
|
||||||
const textPr = oNumLvl.GetTextPr()
|
const textPr = oNumLvl.GetTextPr()
|
||||||
textPr.SetFontSize(18);
|
textPr.SetFontSize(18)
|
||||||
textPr.SetFontFamily('黑体')
|
textPr.SetFontFamily('黑体')
|
||||||
textPr.SetSmallCaps(true);
|
textPr.SetSmallCaps(true)
|
||||||
textPr.SetVertAlign("superscript");
|
textPr.SetVertAlign('superscript')
|
||||||
const paraPr = oNumLvl.GetParaPr()
|
const paraPr = oNumLvl.GetParaPr()
|
||||||
paraPr.SetSpacingBefore(0);
|
paraPr.SetSpacingBefore(0)
|
||||||
paraPr.SetJc("left");
|
paraPr.SetJc('left')
|
||||||
paraPr.SetIndFirstLine(-150);
|
paraPr.SetIndFirstLine(-150)
|
||||||
const oParagraph1 = Api.CreateParagraph()
|
const oParagraph1 = Api.CreateParagraph()
|
||||||
oParagraph1.AddText(oParagraph.GetText())
|
oParagraph1.AddText(oParagraph.GetText())
|
||||||
oParagraph1.SetIndLeft(574);
|
oParagraph1.SetIndLeft(574)
|
||||||
oParagraph1.SetNumbering(oNumLvl)
|
oParagraph1.SetNumbering(oNumLvl)
|
||||||
oParagraph1.SetSpacingAfter(30)
|
oParagraph1.SetSpacingAfter(30)
|
||||||
oParagraph1.SetFontSize(18)
|
oParagraph1.SetFontSize(18)
|
||||||
oDocument.InsertContent([oParagraph1])
|
oDocument.InsertContent([oParagraph1])
|
||||||
} else {
|
} else {
|
||||||
const oRowsCount = parentTable.GetRowsCount();
|
const oRowsCount = parentTable.GetRowsCount()
|
||||||
let oNumLvl
|
let oNumLvl
|
||||||
let currentNumbering
|
let currentNumbering
|
||||||
for (let i = 0; i < oRowsCount; i++) {
|
for (let i = 0; i < oRowsCount; i++) {
|
||||||
const oCellsCount = parentTable.GetRow(i).GetCellsCount();
|
const oCellsCount = parentTable.GetRow(i).GetCellsCount()
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -716,19 +717,19 @@
|
|||||||
.GetRow(i)
|
.GetRow(i)
|
||||||
.GetCell(j)
|
.GetCell(j)
|
||||||
.GetContent()
|
.GetContent()
|
||||||
.GetElementsCount();
|
.GetElementsCount()
|
||||||
for (let k = 0; k < cellEle; k++) {
|
for (let k = 0; k < cellEle; k++) {
|
||||||
const cellEle1 = parentTable
|
const cellEle1 = parentTable
|
||||||
.GetRow(i)
|
.GetRow(i)
|
||||||
.GetCell(j)
|
.GetCell(j)
|
||||||
.GetContent()
|
.GetContent()
|
||||||
.GetElement(k);
|
.GetElement(k)
|
||||||
cellEle1.SetFontSize(18)
|
cellEle1.SetFontSize(18)
|
||||||
let GetNumbering = cellEle1.GetNumbering()
|
let GetNumbering = cellEle1.GetNumbering()
|
||||||
if (GetNumbering) {
|
if (GetNumbering) {
|
||||||
let spacingAfter = cellEle1.GetSpacingAfter()
|
let spacingAfter = cellEle1.GetSpacingAfter()
|
||||||
if (spacingAfter == 30) {
|
if (spacingAfter == 30) {
|
||||||
currentNumbering = GetNumbering;
|
currentNumbering = GetNumbering
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -736,15 +737,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!currentNumbering) {
|
if (!currentNumbering) {
|
||||||
let numIndex = parentTable.GetPosInParent();
|
let numIndex = parentTable.GetPosInParent()
|
||||||
const allElement = oDocument.GetElementsCount()
|
const allElement = oDocument.GetElementsCount()
|
||||||
for (let i = numIndex + 1; i < allElement; i++) {
|
for (let i = numIndex + 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() == 'tableOp') {
|
if (element.GetTableDescription() == 'tableOp') {
|
||||||
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) {
|
||||||
@@ -759,24 +760,24 @@
|
|||||||
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("lowerLetter", sFormatString, "left");
|
oNumLvl.SetCustomType('lowerLetter', sFormatString, 'left')
|
||||||
oNumLvl.SetSuff("space");
|
oNumLvl.SetSuff('space')
|
||||||
const textPr = oNumLvl.GetTextPr()
|
const textPr = oNumLvl.GetTextPr()
|
||||||
textPr.SetFontSize(18);
|
textPr.SetFontSize(18)
|
||||||
textPr.SetFontFamily('黑体')
|
textPr.SetFontFamily('黑体')
|
||||||
textPr.SetSmallCaps(true);
|
textPr.SetSmallCaps(true)
|
||||||
textPr.SetVertAlign("superscript");
|
textPr.SetVertAlign('superscript')
|
||||||
const paraPr = oNumLvl.GetParaPr()
|
const paraPr = oNumLvl.GetParaPr()
|
||||||
paraPr.SetSpacingBefore(0);
|
paraPr.SetSpacingBefore(0)
|
||||||
paraPr.SetJc("left");
|
paraPr.SetJc('left')
|
||||||
paraPr.SetIndFirstLine(-150);
|
paraPr.SetIndFirstLine(-150)
|
||||||
const oParagraph1 = Api.CreateParagraph()
|
const oParagraph1 = Api.CreateParagraph()
|
||||||
oParagraph1.SetIndLeft(586);
|
oParagraph1.SetIndLeft(586)
|
||||||
oParagraph1.SetNumbering(oNumLvl)
|
oParagraph1.SetNumbering(oNumLvl)
|
||||||
oParagraph1.SetSpacingAfter(30)
|
oParagraph1.SetSpacingAfter(30)
|
||||||
oParagraph1.SetFontSize(18)
|
oParagraph1.SetFontSize(18)
|
||||||
@@ -784,12 +785,12 @@
|
|||||||
let GetNext = oParagraph1.GetNext()
|
let GetNext = oParagraph1.GetNext()
|
||||||
GetNext.Delete()
|
GetNext.Delete()
|
||||||
}
|
}
|
||||||
oParagraph.Delete();
|
oParagraph.Delete()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
}, false)
|
}, false)
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user