ZLQQ 发表于 2014-11-5 09:34:58

RichEditControl的各种操作

DocumentRange range = this.richEditControl.Document.AppendSingleLineText("......"); 在文档的末尾添加单独的一行
ParagraphProperties pp = this.richEditControl.Document.BenginUpdateParagraphs(range);修改添加行的属性
pp.Alignment = DevExpress.XtraRichEdit.API.Native.ParagraphAlignment.Left;   设置组后一行居左
this.richEditContrl.Document.EndUpdateParagraphs(pp);结束对最后一行的修改


richEditControl.Document.ReplaceAll(" .","",SearchOptions.None);用“”代替“ .”


DocumentRange selectRange = richEditControl.Document.Selection;获取选中范围
DocumentImageCollection dImage = richEditControl.Document.GetImages(selectRange);
richEditControl.Document.AppendParagraph();


richEditControl.Document.Replace(image," "); 用空格代替图片


Table editTable = this.richEditControl.Document.Tables;获取文档中的表
TableCell editCell = editTable.Cell(RowIndex,CellIndex);获取指定行指定列的表格单元
string editText = richEditControl.Document.GetText(editCell.Range); 获取单元格中的数据


richEditControl.Document.InsertParagraph(richEditControl.Document.CaretPosition); 在光标位置插入一个新段落


CharacterProperties cp = richEditControl.Document.BeginUpdateCharacters(range);开始修改指定范围内的字符串的属性
cp.ForeColor = color;修改指定范围内的字符串的前景色
richEditControl.Document.EndUpdateCharacters(range);


richEditControl.Document.AppendDocument(file,DocumentFormat,path); 将一个新的文档的内容添加到文档的最后
richEditControl.Document.AppendText(string); 将一串字符添加到文档最后


PageBasedRichEditView currentView = richEditControl.ActiveView as PageBasedRichEditView;


TableCollection tables = richEditCtrol.Document.Tables;


DocumentPosition startPos = richEditControl.Document.Selection.Start;
DocumentRange deleteRange = richEditControl.Document.CreateRange(richEditControl.Document.CaretPosition,5); 创造范围长度为5
string getText = richEditControl.Document.GetText(deleteRange);
richEditControl.Document.Delete(deleteRange); 删除创建的范围内的字符串

szhlgp 发表于 2014-11-30 20:57:06

感谢楼主分享,我也正好用到richeditcontrol控件
页: [1]
查看完整版本: RichEditControl的各种操作