Aspose::Words::ControlChar class

ControlChar class

Control characters often encountered in documents. To learn more, visit the Working With Control Characters documentation article.

class ControlChar

Methods

MethodDescription
static Cell()End of a table cell or end of a table row character: “\x0007” or “\a”.
static ColumnBreak()End of column character: “\x000e”.
ControlChar()
static Cr()Carriage return character: “\x000d” or “\r”. Same as ParagraphBreak.
static 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.
static Lf()Line feed character: “\x000a” or “\n”. Same as LineFeed.
static LineBreak()Line break character: “\x000b” or “\v”.
static LineFeed()Line feed character: “\x000a” or “\n”. Same as Lf.
static NonBreakingSpace()Non-breaking space character: “\x00a0”.
static PageBreak()Page break character: “\x000c” or “\f”. Note it has the same value as SectionBreak.
static ParagraphBreak()End of paragraph character: “\x000d” or “\r”. Same as Cr
static SectionBreak()End of section character: “\x000c” or “\f”. Note it has the same value as PageBreak.
static Tab()Tab character: “\x0009” or “\t”.

Fields

FieldDescription
static constexpr CellCharEnd of a table cell or end of a table row character: (char)7 or “\a”.
static constexpr ColumnBreakCharEnd of column character: (char)14.
static constexpr DefaultTextInputCharThis is the “o” character used as a default value in text input form fields.
static constexpr FieldEndCharEnd of MS Word field character: (char)21.
static constexpr FieldSeparatorCharField separator character separates field code from field value. Optional in some fields. Value: (char)20.
static constexpr FieldStartCharStart of MS Word field character: (char)19.
static constexpr LineBreakCharLine break character: (char)11 or “\v”.
static constexpr LineFeedCharLine feed character: (char)10 or “\n”.
static constexpr NonBreakingHyphenCharNonbreaking Hyphen in Microsoft Word is (char)30.
static constexpr NonBreakingSpaceCharNon-breaking space character: (char)160.
static constexpr OptionalHyphenCharOptional Hyphen in Microsoft Word is (char)31.
static constexpr PageBreakCharPage break character: (char)12 or “\f”.
static constexpr ParagraphBreakCharEnd of paragraph character: (char)13 or “\r”.
static constexpr SectionBreakCharEnd of section character: (char)12 or “\f”.
static constexpr SpaceCharSpace character: (char)32.
static constexpr TabCharTab character: (char)9 or “\t”.

Examples

Shows how to use control characters.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);

// Insert paragraphs with text with DocumentBuilder.
builder->Writeln(u"Hello world!");
builder->Writeln(u"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_EQ(String::Format(u"Hello world!{0}", ControlChar::Cr()) + String::Format(u"Hello again!{0}", ControlChar::Cr()) + ControlChar::PageBreak(),
          doc->GetText());

// When converting a document to string form,
// we can omit some of the control characters with the Trim method.
ASSERT_EQ(String::Format(u"Hello world!{0}", ControlChar::Cr()) + u"Hello again!", doc->GetText().Trim());

See Also