Back to Devexpress

SubDocument.InsertSingleLineText(DocumentPosition, String) Method

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

latest7.8 KB
Original Source

SubDocument.InsertSingleLineText(DocumentPosition, String) Method

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

Declaration

csharp
DocumentRange InsertSingleLineText(
    DocumentPosition pos,
    string text
)
vb
Function InsertSingleLineText(
    pos As DocumentPosition,
    text As String
) As DocumentRange

Parameters

NameTypeDescription
posDocumentPosition

A DocumentPosition object specifying the position at which the text should be inserted.

| | text | String |

A String value specifying the text to insert.

|

Returns

TypeDescription
DocumentRange

A DocumentRange object representing the DocumentRange.Start and DocumentRange.End positions of the inserted text.

|

Remarks

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

csharp
// 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

csharp
//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

csharp
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

csharp
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

csharp
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

vb
' 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

vb
'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

vb
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

vb
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

vb
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

InsertText(DocumentPosition, String)

InsertRtfText

SubDocument Interface

SubDocument Members

DevExpress.XtraRichEdit.API.Native Namespace