KingMan 发表于 2019-3-29 11:59:35

代码如何删除TXControl指定段落

本帖最后由 KingMan 于 2019-4-3 17:20 编辑

   int iParagraphs = textControl1.Paragraphs.Count;
            for (int i = iParagraphs; i >= 1; i--)
            {
                String sText = textControl1.Paragraphs.Text.Replace("\r\n", "").Replace(" ", "").Replace(" ", "");
                if (sText.Length > 0)
                  break;
                textControl1.Paragraphs.Select();
                textControl1.Selection.Text = "";
            }
我想清除空的段落,但是好像没有用,应该怎么处理。即清空空行或空换行。

Richard.Ma 发表于 2019-4-5 01:17:49

您可以参考链接中的示例代码
https://www.textcontrol.com/blog/2010/10/15/sample-code-removing-all-empty-paragraphs-completely/
页: [1]
查看完整版本: 代码如何删除TXControl指定段落