回复 9楼DCAgile的帖子
问题并不是产品使用问题,是业务逻辑问题,并且第四个TextField,设置文本是 tf3,替换成tf4就OK了。
替换代码如下:
- private void NewMethod()
- {
- DTC = this.txContent.DocumentTargets;
- this.txContent.DocumentLinkClicked += textControl1_DocumentLinkClicked;
- List<int> bookmarks = new List<int>();
- foreach (DocumentTarget item in DTC)
- {
- bookmarks.Add(item.Start);
- }
- //第一个TextField
- this.txContent.Select(bookmarks[0], bookmarks[1] - bookmarks[0]);
- TextField tf = new TextField();
- tf.Text = this.txContent.Selection.Text;
- this.txContent.Selection.Text = "";
- this.txContent.Select(bookmarks[0], 0);
- this.txContent.TextFields.Add(tf);
- //第二个TextField
- this.txContent.Select(bookmarks[2], bookmarks[3] - bookmarks[2]);
- TextField tf2 = new TextField();
- tf2.Text = this.txContent.Selection.Text;
- this.txContent.Selection.Text = "";
- this.txContent.Select(bookmarks[2], 0);
- this.txContent.TextFields.Add(tf2);
- //第三个TextField
- this.txContent.Select(bookmarks[4], bookmarks[5] - bookmarks[4]);
- TextField tf3 = new TextField();
- tf3.Text = this.txContent.Selection.Text;
- this.txContent.Selection.Text = "";
- this.txContent.Select(bookmarks[4], 0);
- this.txContent.TextFields.Add(tf3);
- //第四个TextField
- this.txContent.Select(bookmarks[6], bookmarks[7] - bookmarks[6]);
- TextField tf4 = new TextField();
- tf4.Text = this.txContent.Selection.Text;
- this.txContent.Selection.Text = "";
- this.txContent.Select(bookmarks[6], 0);
- this.txContent.TextFields.Add(tf4);
- this.txContent.TextFieldClicked += textControl1_TextFieldClicked;
- }
复制代码 |