ControlChar
Contents
[
Hide
]ControlChar class
Control characters often encountered in documents.
To learn more, visit the Working With Control Characters documentation article.
public static class ControlChar
Fields
| Name | Description |
|---|---|
| static readonly Cell | End of a table cell or end of a table row character: “\x0007” or “\a”. |
| const CellChar | End of a table cell or end of a table row character: (char)7 or “\a”. |
| static readonly ColumnBreak | End of column character: “\x000e”. |
| const ColumnBreakChar | End of column character: (char)14. |
| static readonly Cr | Carriage return character: “\x000d” or “\r”. Same as ParagraphBreak. |
| static readonly CrLf | Carriage return followed by line feed character: “\x000d\x000a” or “\r\n”. Not used as such in Microsoft Word documents, but commonly used in text files for paragraph breaks. |
| const DefaultTextInputChar | This is the “o” character used as a default value in text input form fields. |
| const FieldEndChar | End of MS Word field character: (char)21. |
| const FieldSeparatorChar | Field separator character separates field code from field value. Optional in some fields. Value: (char)20. |
| const FieldStartChar | Start of MS Word field character: (char)19. |
| static readonly Lf | Line feed character: “\x000a” or “\n”. Same as LineFeed. |
| static readonly LineBreak | Line break character: “\x000b” or “\v”. |
| const LineBreakChar | Line break character: (char)11 or “\v”. |
| static readonly LineFeed | Line feed character: “\x000a” or “\n”. Same as Lf. |
| const LineFeedChar | Line feed character: (char)10 or “\n”. |
| const NonBreakingHyphenChar | Non-breaking Hyphen in Microsoft Word is (char)30. |
| static readonly NonBreakingSpace | Non-breaking space character: “\x00a0”. |
| const NonBreakingSpaceChar | Non-breaking space character: (char)160. |
| const OptionalHyphenChar | Optional Hyphen in Microsoft Word is (char)31. |
| static readonly PageBreak | Page break character: “\x000c” or “\f”. Note it has the same value as SectionBreak. |
| const PageBreakChar | Page break character: (char)12 or “\f”. |
| static readonly ParagraphBreak | End of paragraph character: “\x000d” or “\r”. Same as Cr |
| const ParagraphBreakChar | End of paragraph character: (char)13 or “\r”. |
| static readonly SectionBreak | End of section character: “\x000c” or “\f”. Note it has the same value as PageBreak. |
| const SectionBreakChar | End of section character: (char)12 or “\f”. |
| const SpaceChar | Space character: (char)32. |
| static readonly Tab | Tab character: “\x0009” or “\t”. |
| const TabChar | Tab character: (char)9 or “\t”. |
Remarks
Provides both char and string versions of the same constants. For example: string LineBreak and char LineBreakChar have the same value.
Examples
Shows how to use control characters.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert paragraphs with text with DocumentBuilder.
builder.Writeln("Hello world!");
builder.Writeln("Hello again!");
// Converting the document to text form reveals that control characters
// represent some of the document's structural elements, such as page breaks.
Assert.That(doc.GetText(), Is.EqualTo($"Hello world!{ControlChar.Cr}" +
$"Hello again!{ControlChar.Cr}" +
ControlChar.PageBreak));
// When converting a document to string form,
// we can omit some of the control characters with the Trim method.
Assert.That(doc.GetText().Trim(), Is.EqualTo($"Hello world!{ControlChar.Cr}" +
"Hello again!"));
See Also
- namespace Aspose.Words
- assembly Aspose.Words