fix 保存后编号空格问题
This commit is contained in:
@@ -22,7 +22,7 @@ export default {
|
|||||||
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('none')
|
oNumLvl.SetSuff('tab')
|
||||||
var oParaPr = oNumLvl.GetParaPr()
|
var oParaPr = oNumLvl.GetParaPr()
|
||||||
oParaPr.SetSpacingLine(280, 'auto')
|
oParaPr.SetSpacingLine(280, 'auto')
|
||||||
oParaPr.SetIndFirstLine(0)
|
oParaPr.SetIndFirstLine(0)
|
||||||
@@ -43,8 +43,8 @@ export default {
|
|||||||
aSearch[0].SetFontSize(10.5)
|
aSearch[0].SetFontSize(10.5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// let GetNext = oParagraph.GetNext()
|
let GetNext = oParagraph.GetNext()
|
||||||
// GetNext.Delete()
|
GetNext.Delete()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
@@ -56,17 +56,7 @@ export default {
|
|||||||
this.ctx.callCommand(() => {
|
this.ctx.callCommand(() => {
|
||||||
try {
|
try {
|
||||||
const oDocument = Api.GetDocument()
|
const oDocument = Api.GetDocument()
|
||||||
// let oNumbering = oDocument.CreateNumbering('numbered')
|
|
||||||
// const oNumLvl = oNumbering.GetLevel(0)
|
|
||||||
// oNumLvl.SetCustomType('decimalZero', " ", "left")
|
|
||||||
// oNumLvl.SetSuff("space");
|
|
||||||
// var oParaPr = oNumLvl.GetParaPr();
|
|
||||||
// oParaPr.SetSpacingLine(280, "auto");
|
|
||||||
// oParaPr.SetJc("both");
|
|
||||||
// oParaPr.SetIndFirstLine(-500);
|
|
||||||
// // oParaPr.SetIndLeft(366)
|
|
||||||
const oParagraph = Api.CreateParagraph()
|
const oParagraph = Api.CreateParagraph()
|
||||||
// oParagraph.SetNumbering(oNumLvl)
|
|
||||||
oParagraph.SetContextualSpacing(true)
|
oParagraph.SetContextualSpacing(true)
|
||||||
oParagraph.SetFontFamily('宋体')
|
oParagraph.SetFontFamily('宋体')
|
||||||
oParagraph.SetFontSize(21)
|
oParagraph.SetFontSize(21)
|
||||||
@@ -81,8 +71,8 @@ export default {
|
|||||||
aSearch[0].SetFontSize(10.5)
|
aSearch[0].SetFontSize(10.5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// let GetNext = oParagraph.GetNext()
|
let GetNext = oParagraph.GetNext()
|
||||||
// GetNext.Delete()
|
GetNext.Delete()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
@@ -96,19 +86,16 @@ export default {
|
|||||||
const oDocument = Api.GetDocument()
|
const oDocument = Api.GetDocument()
|
||||||
let oNumbering = oDocument.CreateNumbering('bullet')
|
let oNumbering = oDocument.CreateNumbering('bullet')
|
||||||
const oNumLvl = oNumbering.GetLevel(0)
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
oNumLvl.SetSuff('none')
|
oNumLvl.SetSuff('tab')
|
||||||
const oParagraph = Api.CreateParagraph()
|
const oParagraph = Api.CreateParagraph()
|
||||||
var oParaPr = oNumLvl.GetParaPr()
|
var oParaPr = oNumLvl.GetParaPr()
|
||||||
oParaPr.SetSpacingLine(280, 'auto')
|
oParaPr.SetSpacingLine(280, 'auto')
|
||||||
// oParaPr.SetIndRight(80)
|
|
||||||
// oParaPr.SetIndFirstLine(120);
|
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
oParagraph.SetContextualSpacing(true)
|
oParagraph.SetContextualSpacing(true)
|
||||||
oParagraph.SetFontFamily('宋体')
|
oParagraph.SetFontFamily('宋体')
|
||||||
oParagraph.SetFontSize(21)
|
oParagraph.SetFontSize(21)
|
||||||
oParagraph.SetIndLeft(1270)
|
oParagraph.SetIndLeft(1270)
|
||||||
oParagraph.SetHighlight(255, 255, 0)
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
oParagraph.AddText(' ')
|
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
let text = oParagraph.GetText()
|
let text = oParagraph.GetText()
|
||||||
if (text) {
|
if (text) {
|
||||||
@@ -118,8 +105,8 @@ export default {
|
|||||||
aSearch[0].SetFontSize(10.5)
|
aSearch[0].SetFontSize(10.5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// let GetNext = oParagraph.GetNext()
|
let GetNext = oParagraph.GetNext()
|
||||||
// GetNext.Delete()
|
GetNext.Delete()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
@@ -135,21 +122,21 @@ export default {
|
|||||||
let oNumbering = oDocument.CreateNumbering('numbered')
|
let oNumbering = oDocument.CreateNumbering('numbered')
|
||||||
numbering = oNumbering.GetLevel(0)
|
numbering = oNumbering.GetLevel(0)
|
||||||
numbering.SetTemplateType('a)')
|
numbering.SetTemplateType('a)')
|
||||||
numbering.SetSuff('none')
|
|
||||||
const oParagraph = Api.CreateParagraph()
|
const oParagraph = Api.CreateParagraph()
|
||||||
|
// oParagraph.SetSpacingLine(400, "auto");
|
||||||
let oTextPr = numbering.GetTextPr()
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily('宋体')
|
oTextPr.SetFontFamily('宋体')
|
||||||
var oParaPr = numbering.GetParaPr()
|
var oParaPr = numbering.GetParaPr()
|
||||||
oParaPr.SetSpacingLine(240, 'auto')
|
oParaPr.SetSpacingLine(240, 'auto')
|
||||||
oParaPr.SetJc('none')
|
oParaPr.SetJc('tab')
|
||||||
oParaPr.SetIndFirstLine(-420)
|
oParaPr.SetIndFirstLine(-420)
|
||||||
|
// oParaPr.SetIndFirstLine(0);
|
||||||
oParagraph.SetNumbering(numbering)
|
oParagraph.SetNumbering(numbering)
|
||||||
oParagraph.SetContextualSpacing(true)
|
oParagraph.SetContextualSpacing(true)
|
||||||
oParagraph.SetFontFamily('宋体')
|
oParagraph.SetFontFamily('宋体')
|
||||||
oParagraph.SetIndLeft(840)
|
oParagraph.SetIndLeft(840)
|
||||||
oParagraph.SetFontSize(21)
|
oParagraph.SetFontSize(21)
|
||||||
oParagraph.SetHighlight(255, 255, 0)
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
oParagraph.AddText(' ')
|
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
let text = oParagraph.GetText()
|
let text = oParagraph.GetText()
|
||||||
if (text) {
|
if (text) {
|
||||||
@@ -159,9 +146,6 @@ export default {
|
|||||||
aSearch[0].SetFontSize(10.5)
|
aSearch[0].SetFontSize(10.5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// let GetNext = oParagraph.GetNext()
|
|
||||||
// GetNext.Delete()
|
|
||||||
// oNumbering = oParagraph.GetNumbering().GetNumbering()
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
@@ -185,7 +169,6 @@ export default {
|
|||||||
numbering.SetCustomType('decimal', '%1)', 'left')
|
numbering.SetCustomType('decimal', '%1)', 'left')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
numbering.SetSuff('none')
|
|
||||||
let oTextPr = numbering.GetTextPr()
|
let oTextPr = numbering.GetTextPr()
|
||||||
oTextPr.SetFontFamily('宋体')
|
oTextPr.SetFontFamily('宋体')
|
||||||
const oParaPr = numbering.GetParaPr()
|
const oParaPr = numbering.GetParaPr()
|
||||||
@@ -200,7 +183,6 @@ export default {
|
|||||||
oParagraph.SetFontSize(21)
|
oParagraph.SetFontSize(21)
|
||||||
oParagraph.SetIndLeft(1260)
|
oParagraph.SetIndLeft(1260)
|
||||||
oParagraph.SetHighlight(255, 255, 0)
|
oParagraph.SetHighlight(255, 255, 0)
|
||||||
oParagraph.AddText(' ')
|
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
let text = oParagraph.GetText()
|
let text = oParagraph.GetText()
|
||||||
if (text) {
|
if (text) {
|
||||||
@@ -210,8 +192,6 @@ export default {
|
|||||||
aSearch[0].SetFontSize(10.5)
|
aSearch[0].SetFontSize(10.5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// let GetNext = oParagraph.GetNext()
|
|
||||||
// GetNext.Delete()
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oNumLvl.SetSuff('none')
|
oNumLvl.SetSuff('tab')
|
||||||
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
|
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily('黑体')
|
oTextPr3.SetFontFamily('黑体')
|
||||||
@@ -421,7 +421,6 @@ export default {
|
|||||||
oParagraph.SetFontFamily('黑体')
|
oParagraph.SetFontFamily('黑体')
|
||||||
oParagraph.SetSpacingAfter(34, false)
|
oParagraph.SetSpacingAfter(34, false)
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
oParagraph.AddText(' ')
|
|
||||||
oDocument.InsertContent([oParagraph])
|
oDocument.InsertContent([oParagraph])
|
||||||
// let GetNext = oParagraph.GetNext()
|
// let GetNext = oParagraph.GetNext()
|
||||||
// GetNext.Delete()
|
// GetNext.Delete()
|
||||||
|
|||||||
@@ -939,12 +939,6 @@ export default {
|
|||||||
try {
|
try {
|
||||||
console.log('初始化正文,start')
|
console.log('初始化正文,start')
|
||||||
const oDocument = Api.GetDocument()
|
const oDocument = Api.GetDocument()
|
||||||
// 处理编号格式,.SetSuff('none')为关键代码,不然会出现标题后面的空格变大的问题
|
|
||||||
const aNumberedParagraphs = oDocument.GetAllNumberedParagraphs()
|
|
||||||
// for (let i = 0; i < aNumberedParagraphs.length; i++) {
|
|
||||||
// const oNumLvl = aNumberedParagraphs[i].GetNumbering()
|
|
||||||
// oNumLvl.SetSuff('none')
|
|
||||||
// }
|
|
||||||
const AllContentControls = oDocument.GetAllContentControls()
|
const AllContentControls = oDocument.GetAllContentControls()
|
||||||
let flag = false
|
let flag = false
|
||||||
for (let i = 0; i < AllContentControls.length; i++) {
|
for (let i = 0; i < AllContentControls.length; i++) {
|
||||||
@@ -1016,11 +1010,11 @@ export default {
|
|||||||
const oNumLvl = oNumbering.GetLevel(0)
|
const oNumLvl = oNumbering.GetLevel(0)
|
||||||
const sFormatString = '%1 '
|
const sFormatString = '%1 '
|
||||||
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
oNumLvl.SetCustomType('decimal', sFormatString, 'left')
|
||||||
oNumLvl.SetSuff('space')
|
oNumLvl.SetSuff('none')
|
||||||
var oParaPr = oNumLvl.GetParaPr()
|
const oParaPr = oNumLvl.GetParaPr()
|
||||||
oParaPr.SetIndFirstLine(0)
|
oParaPr.SetIndFirstLine(0)
|
||||||
const oParagraph = Api.CreateParagraph()
|
const oParagraph = Api.CreateParagraph()
|
||||||
var oNewDocumentStyle = oDocument.GetStyle('Heading 1')
|
const oNewDocumentStyle = oDocument.GetStyle('Heading 1')
|
||||||
oParagraph.SetStyle(oNewDocumentStyle)
|
oParagraph.SetStyle(oNewDocumentStyle)
|
||||||
oParagraph.AddText('范围')
|
oParagraph.AddText('范围')
|
||||||
oParagraph.SetNumbering(oNumLvl)
|
oParagraph.SetNumbering(oNumLvl)
|
||||||
|
|||||||
@@ -133,149 +133,15 @@ export default {
|
|||||||
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) {
|
|
||||||
// oTable
|
|
||||||
// .GetRow(i)
|
|
||||||
// .GetCell(j)
|
|
||||||
// .SetCellBorderTop("single", 0, 0, 255, 255, 255);
|
|
||||||
// oTable
|
|
||||||
// .GetRow(i)
|
|
||||||
// .GetCell(j)
|
|
||||||
// .SetCellBorderRight("single", 0, 0, 255, 255, 255);
|
|
||||||
// oTable
|
|
||||||
// .GetRow(i)
|
|
||||||
// .GetCell(j)
|
|
||||||
// .SetCellBorderBottom("single", 0, 0, 255, 255, 255);
|
|
||||||
// oTable
|
|
||||||
// .GetRow(i)
|
|
||||||
// .GetCell(j)
|
|
||||||
// .SetCellBorderLeft("single", 0, 0, 255, 255, 255);
|
|
||||||
// // cellEle.SetFontFamily("宋体");
|
|
||||||
// } else
|
|
||||||
// 表头
|
|
||||||
// if (i === 0) {
|
|
||||||
// oTable
|
|
||||||
// .GetRow(i)
|
|
||||||
// .GetCell(j)
|
|
||||||
// .SetCellBorderTop("single", 9, 0, 0, 0, 0);
|
|
||||||
// oTable
|
|
||||||
// .GetRow(i)
|
|
||||||
// .GetCell(j)
|
|
||||||
// .SetCellBorderRight("single", 6, 0, 0, 0, 0);
|
|
||||||
// oTable
|
|
||||||
// .GetRow(i)
|
|
||||||
// .GetCell(j)
|
|
||||||
// .SetCellBorderBottom("single", 9, 0, 0, 0, 0);
|
|
||||||
// oTable
|
|
||||||
// .GetRow(i)
|
|
||||||
// .GetCell(j)
|
|
||||||
// .SetCellBorderLeft("single", 6, 0, 0, 0, 0);
|
|
||||||
// cellEle.SetFontFamily("宋体");
|
|
||||||
// } else if (i === oRowsCount - 2) {
|
|
||||||
// oTable
|
|
||||||
// .GetRow(i)
|
|
||||||
// .GetCell(j)
|
|
||||||
// .SetCellBorderBottom("single", 9, 0, 0, 0, 0);
|
|
||||||
// } else {
|
|
||||||
// cellEle.SetFontFamily("宋体");
|
|
||||||
// }
|
|
||||||
cellEle.SetFontSize(18)
|
cellEle.SetFontSize(18)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const oParagraph = oDocument.Document.GetCurrentParagraph(
|
|
||||||
// undefined,
|
|
||||||
// undefined,
|
|
||||||
// { CheckDocContent: true }
|
|
||||||
// );
|
|
||||||
// const newParagraph = Api.CreateParagraph();
|
|
||||||
// newParagraph.SetParagraphWx(oParagraph);
|
|
||||||
// var oRow = oTable.GetRow(0);
|
|
||||||
// oRow.MergeCells();
|
|
||||||
// const oCell = oTable.GetRow(0).GetCell(0);
|
|
||||||
// const oInlineLvlSdt = Api.CreateInlineLvlSdt();
|
|
||||||
// oInlineLvlSdt.SetAlias("smtc.table");
|
|
||||||
|
|
||||||
// let oNumbering = null,
|
|
||||||
// oNumLvl = null;
|
|
||||||
//
|
|
||||||
// // 获取全部控件,找到smtc.table,从而得到编号
|
|
||||||
// const AllControl = oDocument.GetAllContentControls();
|
|
||||||
// for (let i = 0; i < AllControl.length; i++) {
|
|
||||||
// if (AllControl[i].GetAlias() === "smtc.table") {
|
|
||||||
// const tableContent = AllControl[i]
|
|
||||||
// .GetElement(0)
|
|
||||||
// .GetParentTableCell()
|
|
||||||
// .GetContent();
|
|
||||||
// const count = tableContent.GetElementsCount();
|
|
||||||
// for (let j = 0; j < count; j++) {
|
|
||||||
// const ele = tableContent.GetElement(j);
|
|
||||||
// if (
|
|
||||||
// ele &&
|
|
||||||
// ele.GetClassType() === "paragraph" &&
|
|
||||||
// ele.GetNumbering() &&
|
|
||||||
// ele.GetNumbering().GetLevelIndex() === 0
|
|
||||||
// ) {
|
|
||||||
// oNumLvl = ele.GetNumbering();
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (!oNumLvl) {
|
|
||||||
// oNumbering = oDocument.CreateNumbering("numbered");
|
|
||||||
// oNumLvl = oNumbering.GetLevel(0);
|
|
||||||
// const sFormatString = "表 %1 ";
|
|
||||||
// oNumLvl.SetCustomType("decimal", sFormatString, "center");
|
|
||||||
// }
|
|
||||||
// var textPr = oNumLvl.GetTextPr();
|
|
||||||
// textPr.SetFontFamily("黑体");
|
|
||||||
// textPr.SetFontSize(21)
|
|
||||||
// const CNParagraph = Api.CreateParagraph();
|
|
||||||
// CNParagraph.SetJc("center");
|
|
||||||
// CNParagraph.AddText("企业技术标准类别及代号");
|
|
||||||
// CNParagraph.SetFontSize(21);
|
|
||||||
// CNParagraph.SetFontFamily("黑体");
|
|
||||||
// CNParagraph.SetSpacingAfter(0)
|
|
||||||
// CNParagraph.AddInlineLvlSdt(oInlineLvlSdt);
|
|
||||||
// CNParagraph.SetNumbering(oNumLvl);
|
|
||||||
// oCell.AddElement(1, CNParagraph);
|
|
||||||
// 获取编号文本
|
|
||||||
// const tableNum = CNParagraph.Paragraph.GetNumberingText();
|
|
||||||
|
|
||||||
// const Unit = Api.CreateParagraph();
|
|
||||||
// Unit.SetJc("right");
|
|
||||||
// const UnitCN = Api.CreateRun();
|
|
||||||
// UnitCN.AddText("单位为XXX");
|
|
||||||
// UnitCN.SetFontSize(21);
|
|
||||||
// UnitCN.SetFontFamily("SimHei");
|
|
||||||
// Unit.AddElement(UnitCN);
|
|
||||||
// oCell.AddElement(1, Unit);
|
|
||||||
// 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 noteNumLevel = noteNumbering.GetLevel(0);
|
|
||||||
// const sFormatString = "注%1:";
|
|
||||||
// noteNumLevel.SetCustomType("decimal", sFormatString, "center");
|
|
||||||
// for (let i = 0; i < 3; i++) {
|
|
||||||
// const noteParagraph = Api.CreateParagraph();
|
|
||||||
// noteParagraph.SetNumbering(noteNumLevel);
|
|
||||||
// noteParagraph.AddText("XXX");
|
|
||||||
// noteParagraph.SetSpacingAfter(10);
|
|
||||||
// noteParagraph.SetFontFamily('宋体')
|
|
||||||
// noteParagraph.SetFontSize(23)
|
|
||||||
// noteParagraph.SetColor(49, 36, 19);
|
|
||||||
// if (i > 0) {
|
|
||||||
// oLastRow.GetCell(0).AddElement(i * 2, noteParagraph);
|
|
||||||
// } else {
|
|
||||||
// oLastRow.GetCell(0).AddElement(0, noteParagraph);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
@@ -593,7 +459,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oNumLvl.SetSuff('none')
|
oNumLvl.SetSuff('tab')
|
||||||
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
|
const oNewDocumentStyle = oDocument.GetStyle('List Paragraph')
|
||||||
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
const oTextPr3 = oNewDocumentStyle.GetTextPr()
|
||||||
oTextPr3.SetFontFamily('黑体')
|
oTextPr3.SetFontFamily('黑体')
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ export default {
|
|||||||
// oParagraphOne.Delete()
|
// oParagraphOne.Delete()
|
||||||
// const oParagraph = Api.CreateParagraph()
|
// const oParagraph = Api.CreateParagraph()
|
||||||
const oParagraphNew = Api.CreateParagraph()
|
const oParagraphNew = Api.CreateParagraph()
|
||||||
oParagraphNew.AddText(' ' + oParagraph.GetText())
|
oParagraphNew.AddText(oParagraph.GetText())
|
||||||
oParagraph.Delete()
|
oParagraph.Delete()
|
||||||
let oTextPr = oNumLvl.GetTextPr()
|
let oTextPr = oNumLvl.GetTextPr()
|
||||||
oTextPr.SetFontFamily('黑体')
|
oTextPr.SetFontFamily('黑体')
|
||||||
@@ -220,8 +220,6 @@ export default {
|
|||||||
oTextPr3.SetFontFamily('黑体')
|
oTextPr3.SetFontFamily('黑体')
|
||||||
oParagraphNew.SetStyle(oNewDocumentStyle)
|
oParagraphNew.SetStyle(oNewDocumentStyle)
|
||||||
oParagraphNew.SetFontSize(21)
|
oParagraphNew.SetFontSize(21)
|
||||||
// oParagraphNew.SetJc("left");
|
|
||||||
// oParagraphNew.AddText(' ')
|
|
||||||
oParagraphNew.SetColor(0, 0, 0)
|
oParagraphNew.SetColor(0, 0, 0)
|
||||||
oParagraphNew.SetFontFamily('黑体')
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
oDocument.InsertContent([oParagraphNew])
|
oDocument.InsertContent([oParagraphNew])
|
||||||
@@ -340,7 +338,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const oParagraphNew = Api.CreateParagraph()
|
const oParagraphNew = Api.CreateParagraph()
|
||||||
oParagraphNew.AddText(' ' + oParagraph.GetText())
|
oParagraphNew.AddText(oParagraph.GetText())
|
||||||
oParagraph.Delete()
|
oParagraph.Delete()
|
||||||
let oNewDocumentStyle = null
|
let oNewDocumentStyle = null
|
||||||
if (SpacingBefore) {
|
if (SpacingBefore) {
|
||||||
@@ -470,7 +468,6 @@ export default {
|
|||||||
oTextPr.SetFontFamily('黑体')
|
oTextPr.SetFontFamily('黑体')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// oParagraphOne.Delete()
|
|
||||||
const ParaPr = numbering.GetParaPr()
|
const ParaPr = numbering.GetParaPr()
|
||||||
ParaPr.SetStyle(oNewDocumentStyle)
|
ParaPr.SetStyle(oNewDocumentStyle)
|
||||||
ParaPr.SetSpacingAfter(140)
|
ParaPr.SetSpacingAfter(140)
|
||||||
@@ -478,27 +475,6 @@ export default {
|
|||||||
oParagraphNew.SetNumbering(numbering)
|
oParagraphNew.SetNumbering(numbering)
|
||||||
oParagraphNew.SetSpacingAfter(127)
|
oParagraphNew.SetSpacingAfter(127)
|
||||||
oParagraphNew.SetSpacingBefore(127)
|
oParagraphNew.SetSpacingBefore(127)
|
||||||
// let isTrue = false
|
|
||||||
// for (let i = num - 1; i >= 0; i--) {
|
|
||||||
// const element = oDocument.GetElement(i)
|
|
||||||
// if ('paragraph' === element.GetClassType()) {
|
|
||||||
// let ContentControls = element.GetParaPr().GetStyle()
|
|
||||||
// if (ContentControls && ContentControls.GetName() == 'Heading 1') {
|
|
||||||
// if (element.GetText() == ' 术语和定义') {
|
|
||||||
// isTrue = true
|
|
||||||
// }
|
|
||||||
// break
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (isTrue) {
|
|
||||||
// let text = oParagraphNew.GetText()
|
|
||||||
// oParagraphNew.RemoveAllElements()
|
|
||||||
// oParagraphNew.AddLineBreak()
|
|
||||||
// oParagraphNew.AddText(' ' + text)
|
|
||||||
// } else {
|
|
||||||
// oParagraphNew.AddText(' ')
|
|
||||||
// }
|
|
||||||
oParagraphNew.SetBold(false)
|
oParagraphNew.SetBold(false)
|
||||||
oParagraphNew.SetFontFamily('黑体')
|
oParagraphNew.SetFontFamily('黑体')
|
||||||
oParagraphNew.SetFontSize(21)
|
oParagraphNew.SetFontSize(21)
|
||||||
@@ -620,7 +596,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const oParagraphNew = Api.CreateParagraph()
|
const oParagraphNew = Api.CreateParagraph()
|
||||||
oParagraphNew.AddText(' ' + oParagraph.GetText())
|
oParagraphNew.AddText(oParagraph.GetText())
|
||||||
oParagraph.Delete()
|
oParagraph.Delete()
|
||||||
let oNewDocumentStyle = null
|
let oNewDocumentStyle = null
|
||||||
if (SpacingBefore) {
|
if (SpacingBefore) {
|
||||||
@@ -719,27 +695,6 @@ export default {
|
|||||||
oParagraphNew.SetSpacingAfter(0)
|
oParagraphNew.SetSpacingAfter(0)
|
||||||
oParagraphNew.SetSpacingBefore(0)
|
oParagraphNew.SetSpacingBefore(0)
|
||||||
oParagraphNew.SetFontFamily('宋体')
|
oParagraphNew.SetFontFamily('宋体')
|
||||||
let isTrue = false
|
|
||||||
// for (let i = num - 1; i >= 0; i--) {
|
|
||||||
// const element = oDocument.GetElement(i)
|
|
||||||
// if ('paragraph' === element.GetClassType()) {
|
|
||||||
// let ContentControls = element.GetParaPr().GetStyle()
|
|
||||||
// if (ContentControls && ContentControls.GetName() == 'Heading 1') {
|
|
||||||
// if (element.GetText() == ' 术语和定义') {
|
|
||||||
// isTrue = true
|
|
||||||
// }
|
|
||||||
// break
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (isTrue) {
|
|
||||||
// let text = oParagraphNew.GetText()
|
|
||||||
// oParagraphNew.RemoveAllElements()
|
|
||||||
// oParagraphNew.AddLineBreak()
|
|
||||||
// oParagraphNew.AddText(' ' + text)
|
|
||||||
// } else {
|
|
||||||
// oParagraphNew.AddText(' ')
|
|
||||||
// }
|
|
||||||
oParagraphNew.SetBold(false)
|
oParagraphNew.SetBold(false)
|
||||||
oParagraphNew.SetFontSize(21)
|
oParagraphNew.SetFontSize(21)
|
||||||
oParagraphNew.SetJc('left')
|
oParagraphNew.SetJc('left')
|
||||||
|
|||||||
Reference in New Issue
Block a user