officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-subdocument-dot-insertsinglelinetext-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-documentposition-system-dot-string-x29.md
Inserts a single line of text (text without line breaks) at the specified position.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
DocumentRange InsertSingleLineText(
DocumentPosition pos,
string text
)
Function InsertSingleLineText(
pos As DocumentPosition,
text As String
) As DocumentRange
| Name | Type | Description |
|---|---|---|
| pos | DocumentPosition |
A DocumentPosition object specifying the position at which the text should be inserted.
| | text | String |
A String value specifying the text to insert.
|
| Type | Description |
|---|---|
| DocumentRange |
A DocumentRange object representing the DocumentRange.Start and DocumentRange.End positions of the inserted text.
|
The InsertSingleLineText method enables you to insert plain text which has no line breaks. Using this method instead of the more complex SubDocument.InsertText method, can enhance performance.
Note
Do not use the InsertSingleLineText method to insert text that contains line breaks.
The following code snippets (auto-collected from DevExpress Examples) contain references to the InsertSingleLineText(DocumentPosition, String) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-richedit-tables-simple-example/CS/TablesSimpleExample/Form1.cs#L106
// Insert header data
document.InsertSingleLineText(table.Rows[0].Cells[2].Range.Start, "Active Customers");
document.InsertSingleLineText(table[2, 1].Range.Start, "Photo");
word-document-api-table-examples/CS/Program.cs#L87
//Insert the header data
document.InsertSingleLineText(table.Rows[0].Cells[1].Range.Start, "Active Customers");
document.InsertSingleLineText(table[2, 0].Range.Start, "Photo");
winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Table.cs#L32
string fileLastTime = String.Format("{0:g}", fi.LastWriteTime);
document.InsertSingleLineText(cell.Range.Start, fileName);
document.InsertSingleLineText(cell.Next.Range.Start, fileLength);
wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/TableActions.cs#L36
string fileLastTime = String.Format("{0:g}", fi.LastWriteTime);
document.InsertSingleLineText(cell.Range.Start, fileName);
document.InsertSingleLineText(cell.Next.Range.Start, fileLength);
winforms-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L480
SubDocument doc = range.BeginUpdateDocument();
doc.InsertSingleLineText(range.Start, s);
DocumentRange rangeToRemove = doc.CreateRange(range.Start, selLength);
winforms-richedit-tables-simple-example/VB/TablesSimpleExample/Form1.vb#L86
' Insert header data
document.InsertSingleLineText(table.Rows(0).Cells(2).Range.Start, "Active Customers")
document.InsertSingleLineText(table(2, 1).Range.Start, "Photo")
word-document-api-table-examples/VB/Program.vb#L68
'Insert the header data
document.InsertSingleLineText(table.Rows(0).Cells(1).Range.Start, "Active Customers")
document.InsertSingleLineText(table(2, 0).Range.Start, "Photo")
winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Table.vb#L29
Dim fileLastTime As String = System.[String].Format("{0:g}", fi.LastWriteTime)
document.InsertSingleLineText(cell.Range.Start, fileName)
document.InsertSingleLineText(cell.[Next].Range.Start, fileLength)
wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/TableActions.vb#L31
Dim fileLastTime As String = String.Format("{0:g}", fi.LastWriteTime)
document.InsertSingleLineText(cell.Range.Start, fileName)
document.InsertSingleLineText(cell.Next.Range.Start, fileLength)
word-document-api-examples/VB/CodeExamples/TablesActions.vb#L57
Dim fileLastTime As String = System.[String].Format("{0:g}", fi.LastWriteTime)
document.InsertSingleLineText(cell.Range.Start, fileName)
document.InsertSingleLineText(cell.[Next].Range.Start, fileLength)
See Also