IndexOf

MathParagraph.IndexOf method

确定集合中特定 IMathBlock 的索引。

public int IndexOf(IMathBlock mathBlock)
范围类型描述
mathBlockIMathBlock要在集合中定位的项目。

返回值

mathBlock的索引(如果在集合中找到);否则,-1。

例子

示例:

[C#]
IAutoShape shape = slide.Shapes.AddMathShape(x, y, width, height);
IMathParagraph mathParagraph = (shape.TextFrame.Paragraphs[0].Portions[0] as MathPortion).MathParagraph;
IMathBlock block = new MathBlock(new MathematicalText("y"));
mathParagraph.Add(block);
int index = mathParagraph.IndexOf(block);

也可以看看