本文整理汇总了C#中Novacode.Paragraph.SplitEdit方法的典型用法代码示例。如果您正苦于以下问题:C# Paragraph.SplitEdit方法的具体用法?C# Paragraph.SplitEdit怎么用?C# Paragraph.SplitEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Novacode.Paragraph
的用法示例。
在下文中一共展示了Paragraph.SplitEdit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SplitParagraph
internal static XElement[] SplitParagraph(Paragraph p, int index)
{
// In this case edit dosent really matter, you have a choice.
Run r = p.GetFirstRunEffectedByEdit(index, EditType.ins);
XElement[] split;
XElement before, after;
if (r.Xml.Parent.Name.LocalName == "ins")
{
split = p.SplitEdit(r.Xml.Parent, index, EditType.ins);
before = new XElement(p.Xml.Name, p.Xml.Attributes(), r.Xml.Parent.ElementsBeforeSelf(), split[0]);
after = new XElement(p.Xml.Name, p.Xml.Attributes(), r.Xml.Parent.ElementsAfterSelf(), split[1]);
}
else if (r.Xml.Parent.Name.LocalName == "del")
{
split = p.SplitEdit(r.Xml.Parent, index, EditType.del);
before = new XElement(p.Xml.Name, p.Xml.Attributes(), r.Xml.Parent.ElementsBeforeSelf(), split[0]);
after = new XElement(p.Xml.Name, p.Xml.Attributes(), r.Xml.Parent.ElementsAfterSelf(), split[1]);
}
else
{
split = Run.SplitRun(r, index);
before = new XElement(p.Xml.Name, p.Xml.Attributes(), r.Xml.ElementsBeforeSelf(), split[0]);
after = new XElement(p.Xml.Name, p.Xml.Attributes(), split[1], r.Xml.ElementsAfterSelf());
}
if (before.Elements().Count() == 0)
before = null;
if (after.Elements().Count() == 0)
after = null;
return new XElement[] { before, after };
}