GetOutlineLvl
返回指定属性的大纲级别。
示例
通过演示文稿中的段落属性获取指定段落的大纲级别。
// How can I get the outline lvl using a paragraph properties in a presentation?
// Get the outline lvl for a paragraph properties in a presentation.
const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
const rgb = Api.CreateRGBColor(50, 100, 150);
const fill = Api.CreateSolidFill(rgb);
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape('rect', 200 * 36000, 50 * 36000, fill, stroke);
shape.SetPosition(10 * 36000, 10 * 36000);
slide.AddObject(shape);
const content = shape.GetDocContent();
const paragraph = content.GetElement(0);
const paraPr = paragraph.GetParaPr();
const levelBefore = paraPr.GetOutlineLvl();
paraPr.SetOutlineLvl(8);
const levelAfter = paraPr.GetOutlineLvl();
let text = 'Outline level (index) for this paragraph is currently set to ' + levelAfter;
text += ',\n';
text += 'but originally was set to ' + levelBefore;
paragraph.AddText(text);