var oDocument = Api.GetDocument();
var chapterStyleName = '标准文件_章标题';
var oAllStyles = oDocument.GetAllStyles();
var oStyle = null;
for (var i = 0; i < oAllStyles.length; i++) {
var style = oAllStyles[i];
if (style.GetName() === chapterStyleName) {
oStyle = style;
break;
}
}
if (!oStyle) {
return -1;
}
var oParagraph = getCurrentParagraph();
if (!oParagraph) {
return -1;
}
var currentStyle = oParagraph.GetStyle();
if (currentStyle && currentStyle.GetName() === chapterStyleName) {
return 1;
}
oParagraph.SetStyle(oStyle);
oParagraph.SetIndFirstLine(0);
After changing the paragraph style, the cursor is out of focus and content cannot be input. It needs to be clicked before input