ninja_aya 发表于 2015-6-30 11:43:00

如何删除section

目前想实现这样一个功能,文章分为多个章节,每个章节占有那些section我是可以获取到比如
第一章 1-3个section
第二章 4-7 section
。。。。
现在想删除第二章4-7的section
请问如何实现。

iceman 发表于 2015-6-30 17:39:00

回复 1楼ninja_aya的帖子

移除 Section 的方法如下,删除特定Section 需要略微修改:

private void RemoveAllSections()
{
    TXTextControl.SectionCollection.SectionEnumerator sectionEnum = textControl1.Sections.GetEnumerator();
    int sectionCounter = textControl1.Sections.Count;

    sectionEnum.Reset();
    sectionEnum.MoveNext();
    for (int i = 0; i < sectionCounter; i++)
    {
      TXTextControl.Section curSection = (TXTextControl.Section)sectionEnum.Current;

      if (curSection.Number == 1)
      {
            sectionEnum.MoveNext();
            continue;
      }

      textControl1.Selection.Start = curSection.Start - 2;
      textControl1.Selection.Length = 1;
      textControl1.Selection.Text = "";
    }
}

iceman 发表于 2015-7-17 17:32:00

回复 1楼ninja_aya的帖子

为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢   
http://gcdn.gcpowertools.com.cn/attachment.aspx?attachmentid=10062
页: [1]
查看完整版本: 如何删除section