本文整理汇总了C#中Paragraph.GetXPathIndex方法的典型用法代码示例。如果您正苦于以下问题:C# Paragraph.GetXPathIndex方法的具体用法?C# Paragraph.GetXPathIndex怎么用?C# Paragraph.GetXPathIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paragraph
的用法示例。
在下文中一共展示了Paragraph.GetXPathIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestGetXPathIndex
public void TestGetXPathIndex()
{
Paragraph p = new Paragraph(new ParagraphProperties());
int target = -1;
target = p.GetXPathIndex();
Assert.Equal(1, target);
target = p.FirstChild.GetXPathIndex();
Assert.Equal(1, target);
var run1 = p.AppendChild( new Run() );
var run2 = p.AppendChild( new Run() );
var bk1 = p.AppendChild( new BookmarkStart());
var unknown1 = p.AppendChild( new OpenXmlUnknownElement("unknown") );
var unknown2 = p.AppendChild( new OpenXmlUnknownElement("unknown") );
var run3 = p.AppendChild(new Run() );
target = run1.GetXPathIndex();
Assert.Equal(1, target);
target = run2.GetXPathIndex();
Assert.Equal(2, target);
target = run3.GetXPathIndex();
Assert.Equal(3, target);
target = bk1.GetXPathIndex();
Assert.Equal(1, target);
target = unknown1.GetXPathIndex();
Assert.Equal(1, target);
target = unknown2.GetXPathIndex();
Assert.Equal(2, target);
}