Aspose::Words Namespace Reference

Detailed Description

The Aspose.Words namespace provides classes for generating, converting, modifying, rendering and printing Microsoft Word documents without utilizing Microsoft Word.

Aspose.Words is written completely in C#, CLS compliant and contains only safe managed code. Microsoft Word is not required in order to use Aspose.Words.

The classes in the Aspose.Words namespace borrow best practices from two well-known frameworks: Microsoft Word Automation and System.Xml. A document in Aspose.Words is represented by a tree of nodes, much like in XML DOM. Where possible, class, method and property names match those found in Microsoft Word Automation.

The main classes in this namespace are:

  • Document is the main class of the object model that represents a Microsoft Word document.
  • DocumentBuilder provides an easy way to insert content and formatting into a document.
  • Node is the base class for all nodes in the document.
  • CompositeNode is the base class for all nodes of the document that can contain other nodes, for example Paragraph, Section and Table.

Namespaces

 BuildingBlocks
 The Aspose.Words.BuildingBlocks namespace provides classes that allow to access and use AutoText, AutoCorrect entries and Building Blocks in a document.
 
 Drawing
 The Aspose.Words.Drawing namespace provides classes that allow to create and modify drawing objects.
 
 Fields
 The Aspose.Words.Fields namespace contains classes that represent Microsoft Word fields in a document.
 
 Fonts
 The Aspose.Words.Fonts namespace provides classes and enumerations to access information about fonts used in a document.
 
 Layout
 The Aspose.Words.Layout namespace provides classes that allow to access information such as on what page and where on a page particular document elements are positioned, when the document is formatted into pages.
 
 Lists
 The Aspose.Words.Lists namespace contains classes for working with bulleted and numbered lists defined in a document.
 
 Loading
 The Aspose.Words.Loading namespace provides classes and enumerations that allow to specify additional options when loading documents.
 
 MailMerging
 The Aspose.Words.MailMerging namespace contains classes of the "original" mail merge reporting engine.
 
 Markup
 The Aspose.Words.Markup namespace contains classes that represent customer defined semantics in a document: smart tags, custom XML and structured document tags (content controls).
 
 Math
 The Aspose.Words.Math namespace contains classes that represent Office Math elements.
 
 Properties
 The Aspose.Words.Properties namespace provides classes to work with custom and built-in document properties such as title, keywords, company etc.
 
 Rendering
 The Aspose.Words.Rendering namespace provides classes that allow to customize printing or rendering of documents.
 
 Replacing
 The Aspose.Words.Replacing namespace provides classes to manipulate with find/replace operations over the document tree.
 
 Reporting
 This namespace contains classes of the Aspose.Words' new reporting engine that supports report templates marked up with a language based on the LINQ Method Syntax.
 
 Saving
 The Aspose.Words.Saving namespace provides classes and enumerations that allow to specify additional options for saving or converting documents.
 
 Settings
 The Aspose.Words.Settings namespace contains classes and enums that are used when specifying various settings and options stored in a document. These are mail merge, write protection, compatibility and other settings.
 
 Shaping
 
 Tables
 The Aspose.Words.Tables namespace contains classes that represent tables, rows, cells and their formatting.
 
 Themes
 The Aspose.Words.Themes namespace provides classes that allow to access theme information in Microsoft Word documents.
 
 WebExtensions
 The Aspose.Words.WebExtensions namespace provides classes that allow to customize elements and attributes that extend the XML vocabulary for representing Office Add-ins.
 

Classes

class  AbsolutePositionTab
 An absolute position tab is a character which is used to advance the position on the current line of text when displaying this WordprocessingML content. More...
 
class  Body
 Represents a container for the main text of a section. More...
 
class  Bookmark
 Represents a single bookmark. More...
 
class  BookmarkCollection
 A collection of Bookmark objects that represent the bookmarks in the specified range. More...
 
class  BookmarkEnd
 Represents an end of a bookmark in a Word document. More...
 
class  BookmarkStart
 Represents a start of a bookmark in a Word document. More...
 
class  Border
 Represents a border of an object. More...
 
class  BorderCollection
 A collection of Border objects. More...
 
class  BuildVersionInfo
 Provides information about the current product name and version. More...
 
class  CertificateHolder
 Represents a holder of X509Certificate2 instance. More...
 
class  CleanupOptions
 Allows to specify options for document cleaning. More...
 
class  ComHelper
 Provides methods for COM clients to load a document into Aspose.Words. More...
 
class  Comment
 Represents a container for text of a comment. More...
 
class  CommentCollection
 Provides typed access to a collection of Comment nodes. More...
 
class  CommentRangeEnd
 Denotes the end of a region of text that has a comment associated with it. More...
 
class  CommentRangeStart
 Denotes the start of a region of text that has a comment associated with it. More...
 
class  CompareOptions
 Allows to choose advanced options for document comparison operation. More...
 
class  CompositeNode
 Base class for nodes that can contain other nodes. More...
 
class  ConditionalStyle
 Represents special formatting applied to some area of a table with assigned table style. More...
 
class  ConditionalStyleCollection
 Represents a collection of ConditionalStyle objects. More...
 
class  ControlChar
 Control characters often encountered in documents. More...
 
class  ConvertUtil
 Provides helper functions to convert between various measurement units. More...
 
class  Details_DocumentReaderPluginLoadException
 Thrown during document load, when the plugin required for reading the document format cannot be loaded.
 
class  Details_FileCorruptedException
 Thrown during document load, when the document appears to be corrupted and impossible to load.
 
class  Details_IncorrectPasswordException
 Thrown if a document is encrypted with a password and the password specified when opening the document is incorrect or missing.
 
class  Details_UnsupportedFileFormatException
 Thrown during document load, when the document format is not recognized or not supported by Aspose.Words.
 
class  DigitalSignature
 Represents a digital signature on a document and the result of its verification. More...
 
class  DigitalSignatureCollection
 Provides a read-only collection of digital signatures attached to a document. More...
 
class  DigitalSignatureUtil
 Provides methods for signing document. More...
 
class  Document
 Represents a Word document. More...
 
class  DocumentBase
 Provides the abstract base class for a main document and a glossary document of a Word document. More...
 
class  DocumentBuilder
 Provides methods to insert text, images and other content, specify font, paragraph and section formatting. More...
 
class  DocumentVisitor
 Base class for custom document visitors. More...
 
class  EditableRange
 Represents a single editable range. More...
 
class  EditableRangeEnd
 Represents an end of an editable range in a Word document. More...
 
class  EditableRangeStart
 Represents a start of an editable range in a Word document. More...
 
class  EndnoteOptions
 Represents the endnote numbering options for a document or section. More...
 
class  FileFormatInfo
 Contains data returned by FileFormatUtil document format detection methods. More...
 
class  FileFormatUtil
 Provides utility methods for working with file formats, such as detecting file format or converting file extensions to/from file format enums. More...
 
class  Font
 Contains font attributes (font name, font size, color, and so on) for an object. More...
 
class  Footnote
 Represents a container for text of a footnote or endnote. More...
 
class  FootnoteOptions
 Represents the footnote numbering options for a document or section. More...
 
class  FrameFormat
 Represents frame related formatting for a paragraph. More...
 
class  HeaderFooter
 Represents a container for the header or footer text of a section. More...
 
class  HeaderFooterCollection
 Provides typed access to HeaderFooter nodes of a Section. More...
 
class  HtmlLoadOptions
 Allows to specify additional options when loading HTML document into a Document object. More...
 
class  Hyphenation
 Provides methods for working with hyphenation dictionaries. These dictionaries prescribe where words of a specific language can be hyphenated. More...
 
interface  IDocumentReaderPlugin
 Defines an interface for external reader plugins that can read a file into a document. More...
 
interface  IHyphenationCallback
 Implemented by classes which can register hyphenation dictionaries. More...
 
class  ImageWatermarkOptions
 Contains options that can be specified when adding a watermark with image. More...
 
class  ImportFormatOptions
 Allows to specify various import options to format output. More...
 
class  Inline
 Base class for inline-level nodes that can have character formatting associated with them, but cannot have child nodes of their own. More...
 
class  InlineStory
 Base class for inline-level nodes that can contain paragraphs and tables. More...
 
interface  INodeChangingCallback
 Implement this interface if you want to receive notifications when nodes are inserted or removed in the document. More...
 
class  InternableComplexAttr
 Base class for internable complex attribute. Internable complex attribute should notify parent collection when going to be changed. More...
 
interface  IWarningCallback
 Implement this interface if you want to have your own custom method called to capture loss of fidelity warnings that can occur during document loading or saving. More...
 
class  LanguagePreferences
 Allows to set up language preferences. More...
 
class  License
 Provides methods to license the component. More...
 
class  ListFormat
 Allows to control what list formatting is applied to a paragraph. More...
 
class  LoadOptions
 Allows to specify additional options (such as password or base URI) when loading a document into a Document object. More...
 
class  Node
 Base class for all nodes of a Word document. More...
 
class  NodeChangingArgs
 Provides data for methods of the INodeChangingCallback interface. More...
 
class  NodeCollection
 Represents a collection of nodes of a specific type. More...
 
class  NodeCollectionEnumerator
 
class  NodeImporter
 Allows to efficiently perform repeated import of nodes from one document to another. More...
 
class  NodeList
 Represents a collection of nodes matching an XPath query executed using the SelectNodes() method. More...
 
class  PageSetup
 Represents the page setup properties of a section. More...
 
class  Paragraph
 Represents a paragraph of text. More...
 
class  ParagraphCollection
 Provides typed access to a collection of Paragraph nodes. More...
 
class  ParagraphFormat
 Represents all the formatting for a paragraph. More...
 
class  PdfLoadOptions
 Allows to specify additional options when loading Pdf document into a Document object. More...
 
class  PlainTextDocument
 Allows to extract plain-text representation of the document's content. More...
 
class  Range
 Represents a contiguous area in a document. More...
 
class  Revision
 Represents a revision (tracked change) in a document node or style. Use RevisionType to check the type of this revision. More...
 
class  RevisionCollection
 A collection of Revision objects that represent revisions in the document. More...
 
class  RevisionGroup
 Represents a group of sequential Revision objects. More...
 
class  RevisionGroupCollection
 A collection of RevisionGroup objects that represent revision groups in the document. More...
 
class  RtfLoadOptions
 Allows to specify additional options when loading Rtf document into a Document object. More...
 
class  Run
 Represents a run of characters with the same font formatting. More...
 
class  RunCollection
 Provides typed access to a collection of Run nodes. More...
 
class  Section
 Represents a single section in a document. More...
 
class  SectionCollection
 A collection of Section objects in the document. More...
 
class  Shading
 Contains shading attributes for an object. More...
 
class  SignatureLineOptions
 Allows to specify options for signature line being inserted. Used in DocumentBuilder. More...
 
class  SignOptions
 Allows to specify options for document signing. More...
 
class  SpecialChar
 Base class for special characters in the document. More...
 
class  Story
 Base class for elements that contain block-level nodes Paragraph and Table. More...
 
class  Style
 Represents a single built-in or user-defined style. More...
 
class  StyleCollection
 A collection of Style objects that represent both the built-in and user-defined styles in a document. More...
 
class  SubDocument
 Represents a SubDocument - which is a reference to an externally stored document. More...
 
class  TableStyle
 Represents a table style. More...
 
class  TabStop
 Represents a single custom tab stop. The TabStop object is a member of the TabStopCollection collection. More...
 
class  TabStopCollection
 A collection of TabStop objects that represent custom tabs for a paragraph or a style. More...
 
class  TextColumn
 Represents a single text column. TextColumn is a member of the TextColumnCollection collection. The TextColumns collection includes all the columns in a section of a document. More...
 
class  TextColumnCollection
 A collection of TextColumn objects that represent all the columns of text in a section of a document. More...
 
class  TextWatermarkOptions
 Contains options that can be specified when adding a watermark with text. More...
 
class  TxtLoadOptions
 Allows to specify additional options when loading Text document into a Document object. More...
 
class  VariableCollection
 A collection of document variables. More...
 
class  VbaModule
 Provides access to VBA project module. More...
 
class  VbaModuleCollection
 Represents a collection of VbaModule objects. More...
 
class  VbaProject
 Provides access to VBA project information. A VBA project inside the document is defined as a collection of VBA modules. More...
 
class  VbaReference
 Implements a reference to an Automation type library or VBA project. More...
 
class  VbaReferenceCollection
 Represents a collection of VbaReference objects. More...
 
class  WarningInfo
 Contains information about a warning that Aspose.Words issued during document loading or saving. More...
 
class  WarningInfoCollection
 Represents a typed collection of WarningInfo objects. More...
 
class  Watermark
 Represents class to work with document watermark. More...
 

Typedefs

using DocumentReaderPluginLoadException = ExceptionWrapper< Details_DocumentReaderPluginLoadException >
 Thrown during document load, when the plugin required for reading the document format cannot be loaded. More...
 
using FileCorruptedException = ExceptionWrapper< Details_FileCorruptedException >
 Thrown during document load, when the document appears to be corrupted and impossible to load. More...
 
using IncorrectPasswordException = ExceptionWrapper< Details_IncorrectPasswordException >
 Thrown if a document is encrypted with a password and the password specified when opening the document is incorrect or missing. More...
 
using UnsupportedFileFormatException = ExceptionWrapper< Details_UnsupportedFileFormatException >
 Thrown during document load, when the document format is not recognized or not supported by Aspose.Words. More...
 

Enumerations

enum  BorderType
 Specifies sides of a border. More...
 
enum  BreakType
 Specifies type of a break inside a document. More...
 
enum  CalendarType
 Specifies the type of a calendar. More...
 
enum  ComparisonTargetType
 Allows to specify base document which will be used during comparison. Default value is Current. More...
 
enum  ConditionalStyleType
 Represents possible table areas to which conditional formatting may be defined in a table style. More...
 
enum  DigitalSignatureType
 Specifies the type of a digital signature. More...
 
enum  DocumentDirection
 Allows to specify the direction to flow the text in a document. More...
 
enum  DocumentPositionMovement
 DocumentPositionMovement enumeration. More...
 
enum  DropCapPosition
 Specifies the position for a drop cap text. More...
 
enum  EditingLanguage
 Specifies the editing language. More...
 
enum  EditorType
 Specifies the set of possible aliases (or editing groups) which can be used as aliases to determine if the current user shall be allowed to edit a single range defined by an editable range within a document. More...
 
enum  EmphasisMark
 Specifies possible types of emphasis mark. More...
 
enum  EndnotePosition
 Defines the endnote position. More...
 
enum  FindReplaceDirection
 Specifies direction for replace operations. More...
 
enum  FootnoteLocation
 FootnoteLocation enumeration. More...
 
enum  FootnoteNumberingRule
 Determines when automatic footnote or endnote numbering restarts. More...
 
enum  FootnotePosition
 Defines the footnote position. More...
 
enum  FootnoteType
 Specifies whether this is a footnote or an endnote. More...
 
enum  Granularity
 Specifies the granularity of changes to track when comparing two documents. More...
 
enum  HeaderFooterType
 Identifies the type of header or footer found in a Word file. More...
 
enum  HeightRule
 Specifies the rule for determining the height of an object. More...
 
enum  HtmlControlType
 Type of document nodes that represent <input> and <select> elements imported from HTML. More...
 
enum  ImportFormatMode
 Specifies how formatting is merged when importing content from another document. More...
 
enum  LineNumberRestartMode
 Determines when automatic line numbering restarts. More...
 
enum  LineSpacingRule
 Specifies line spacing values for a paragraph. More...
 
enum  LineStyle
 Specifies line style of a Border. More...
 
enum  LoadFormat
 Indicates the format of the document that is to be loaded. More...
 
enum  LoadFormatTest
 LoadFormatTest enumeration. More...
 
enum  MeasurementUnits
 Specifies the unit of measurement. More...
 
enum  NodeChangingAction
 Specifies the type of node change. More...
 
enum  NodeType
 Specifies the type of a Word document node. More...
 
enum  NumberStyle
 Specifies the number style for a list, footnotes and endnotes, page numbers. More...
 
enum  Orientation
 Specifies page orientation. More...
 
enum  OutlineLevel
 Specifies the outline level of a paragraph in the document. More...
 
enum  PageBorderAppliesTo
 Specifies which pages the page border is printed on. More...
 
enum  PageBorderDistanceFrom
 Specifies the positioning of the page border relative to the page margin. More...
 
enum  PageVerticalAlignment
 Specifies vertical justification of text on each page. More...
 
enum  PaperSize
 Specifies paper size. More...
 
enum  ParagraphAlignment
 Specifies text alignment in a paragraph. More...
 
enum  ProtectionType
 Protection type for a document. More...
 
enum  RevisionsView
 Allows to specify whether to work with the original or revised version of a document. More...
 
enum  RevisionType
 Specifies the type of change being tracked in Revision. More...
 
enum  RunPrExpandFlags
 RunPrExpandFlags enumeration. More...
 
enum  SaveFormat
 Indicates the format in which the document is saved. More...
 
enum  SectionLayoutMode
 Specifies the layout mode for a section allowing to define the document grid behavior. More...
 
enum  SectionStart
 The type of break at the beginning of the section. More...
 
enum  StoryType
 Text of a Word document is stored in stories. StoryType identifies a story. More...
 
enum  StyleIdentifier
 Locale independent style identifier. More...
 
enum  StyleType
 Represents type of the style. More...
 
enum  TabAlignment
 Specifies the alignment/type of a tab stop. More...
 
enum  TabLeader
 Specifies the type of the leader line displayed under the tab character. More...
 
enum  TextDmlEffect
 Dml text effect for text runs. More...
 
enum  TextEffect
 Animation effect for text runs. More...
 
enum  TextOrientation
 Specifies orientation of text on a page, in a table cell or a text frame. More...
 
enum  TextureIndex
 Specifies shading texture. More...
 
enum  TxtLeadingSpacesOptions
 Specifies available options for leading space handling during import from Text file. More...
 
enum  TxtTrailingSpacesOptions
 Specifies available options for trailing spaces handling during import from Text file. More...
 
enum  Underline
 Indicates type of the underline applied to a font. More...
 
enum  VbaModuleType
 Specifies the type of a model in a VBA project. More...
 
enum  VbaReferenceType
 Allows to specify the type of a VbaReference object. More...
 
enum  VisitorAction
 Allows the visitor to control the enumeration of nodes. More...
 
enum  WarningSource
 Specifies the module that produces a warning during document loading or saving. More...
 
enum  WarningType
 Specifies the type of a warning that is issued by Aspose.Words during document loading or saving. More...
 
enum  WatermarkLayout
 Defines layout of the watermark relative to the watermark center. More...
 
enum  WatermarkType
 Specifies the watermark type. More...
 

Typedef Documentation

◆ DocumentReaderPluginLoadException

using Aspose::Words::DocumentReaderPluginLoadException = typedef System::ExceptionWrapper<Details_DocumentReaderPluginLoadException>

Thrown during document load, when the plugin required for reading the document format cannot be loaded.

◆ FileCorruptedException

using Aspose::Words::FileCorruptedException = typedef System::ExceptionWrapper<Details_FileCorruptedException>

Thrown during document load, when the document appears to be corrupted and impossible to load.

Examples

Shows how to catch a FileCorruptedException.

try
{
auto doc = MakeObject<Document>(MyDir + u"Corrupted document.docx");
}
{
System::Console::WriteLine(e->get_Message());
}

◆ IncorrectPasswordException

using Aspose::Words::IncorrectPasswordException = typedef System::ExceptionWrapper<Details_IncorrectPasswordException>

Thrown if a document is encrypted with a password and the password specified when opening the document is incorrect or missing.

◆ UnsupportedFileFormatException

using Aspose::Words::UnsupportedFileFormatException = typedef System::ExceptionWrapper<Details_UnsupportedFileFormatException>

Thrown during document load, when the document format is not recognized or not supported by Aspose.Words.

Enumeration Type Documentation

◆ BorderType

Specifies sides of a border.

Examples

Shows how to insert a paragraph with a top border.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Border> topBorder = builder->get_ParagraphFormat()->get_Borders()->idx_get(Aspose::Words::BorderType::Top);
topBorder->set_Color(System::Drawing::Color::get_Red());
topBorder->set_LineWidth(4.0);
topBorder->set_LineStyle(Aspose::Words::LineStyle::DashSmallGap);
builder->Writeln(u"Text with a red top border.");
doc->Save(ArtifactsDir + u"Border.ParagraphTopBorder.docx");
Enumerator
None 

Default value.

Bottom 

Specifies the bottom border of a paragraph or a table cell.

Left 

Specifies the left border of a paragraph or a table cell.

Right 

Specifies the right border of a paragraph or a table cell.

Top 

Specifies the top border of a paragraph or a table cell.

Horizontal 

Specifies the horizontal border between cells in a table or between conforming paragraphs.

Vertical 

Specifies the vertical border between cells in a table.

DiagonalDown 

Specifies the diagonal border in a table cell.

DiagonalUp 

Specifies the diagonal border in a table cell.

◆ BreakType

Specifies type of a break inside a document.

Examples

Shows how to create headers and footers in a document using DocumentBuilder.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Specify that we want headers and footers different for first, even and odd pages
builder->get_PageSetup()->set_DifferentFirstPageHeaderFooter(true);
builder->get_PageSetup()->set_OddAndEvenPagesHeaderFooter(true);
// Create the headers
builder->MoveToHeaderFooter(Aspose::Words::HeaderFooterType::HeaderFirst);
builder->Write(u"Header for the first page");
builder->MoveToHeaderFooter(Aspose::Words::HeaderFooterType::HeaderEven);
builder->Write(u"Header for even pages");
builder->MoveToHeaderFooter(Aspose::Words::HeaderFooterType::HeaderPrimary);
builder->Write(u"Header for all other pages");
// Create three pages in the document
builder->MoveToSection(0);
builder->Writeln(u"Page1");
builder->Writeln(u"Page2");
builder->Writeln(u"Page3");
doc->Save(ArtifactsDir + u"DocumentBuilder.HeadersAndFooters.docx");

Shows how to insert a Table of contents (TOC) into a document using heading styles as entries.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert a table of contents at the beginning of the document,
// and set it to pick up paragraphs with headings of levels 1 to 3 and entries to act like hyperlinks
builder->InsertTableOfContents(u"\\o \"1-3\" \\h \\z \\u");
// Start the actual document content on the second page
// Build a document with complex structure by applying different heading styles thus creating TOC entries
// The heading levels we use below will affect the list levels in which these items will appear in the TOC,
// and only levels 1-3 will be picked up by our TOC due to its settings
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading1);
builder->Writeln(u"Heading 1");
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading2);
builder->Writeln(u"Heading 1.1");
builder->Writeln(u"Heading 1.2");
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading1);
builder->Writeln(u"Heading 2");
builder->Writeln(u"Heading 3");
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading2);
builder->Writeln(u"Heading 3.1");
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading3);
builder->Writeln(u"Heading 3.1.1");
builder->Writeln(u"Heading 3.1.2");
builder->Writeln(u"Heading 3.1.3");
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading2);
builder->Writeln(u"Heading 3.2");
builder->Writeln(u"Heading 3.3");
// Call the method below to update the TOC and save
doc->UpdateFields();
doc->Save(ArtifactsDir + u"DocumentBuilder.InsertToc.docx");

Shows how to insert sections using DocumentBuilder, specify page setup for a section and reset page setup to defaults.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Modify the first section in the document
builder->get_PageSetup()->set_Orientation(Aspose::Words::Orientation::Landscape);
builder->get_PageSetup()->set_VerticalAlignment(Aspose::Words::PageVerticalAlignment::Center);
builder->Writeln(u"Section 1, landscape oriented and text vertically centered.");
// Start a new section and reset its formatting to defaults
builder->InsertBreak(Aspose::Words::BreakType::SectionBreakNewPage);
builder->get_PageSetup()->ClearFormatting();
builder->Writeln(u"Section 2, back to default Letter paper size, portrait orientation and top alignment.");
doc->Save(ArtifactsDir + u"PageSetup.ClearFormatting.docx");
Enumerator
ParagraphBreak 

Break between paragraphs.

PageBreak 

Explicit page break.

ColumnBreak 

Explicit column break.

SectionBreakContinuous 

Specifies start of new section on the same page as the previous section.

SectionBreakNewColumn 

Specifies start of new section in the new column.

SectionBreakNewPage 

Specifies start of new section on a new page.

SectionBreakEvenPage 

Specifies start of new section on a new even page.

SectionBreakOddPage 

Specifies start of new section on a odd page.

LineBreak 

Explicit line break.

◆ CalendarType

Specifies the type of a calendar.

Enumerator
Gregorian 

The Gregorian calendar.

Hijri 

The Hijri Lunar calendar.

Hebrew 

The Hebrew Lunar calendar.

SakaEra 

The Saka Era calendar.

UmAlQura 

The Um-al-Qura calendar.

◆ ComparisonTargetType

Allows to specify base document which will be used during comparison. Default value is Current.

Examples

Shows how to specify which document shall be used as a target during comparison.

// Create our original document
auto docOriginal = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(docOriginal);
// Insert paragraph text with an endnote
builder->Writeln(u"Hello world! This is the first paragraph.");
builder->InsertFootnote(Aspose::Words::FootnoteType::Endnote, u"Original endnote text.");
// Insert a table
builder->StartTable();
builder->InsertCell();
builder->Write(u"Original cell 1 text");
builder->InsertCell();
builder->Write(u"Original cell 2 text");
builder->EndTable();
// Insert a textbox
SharedPtr<Shape> textBox = builder->InsertShape(Aspose::Words::Drawing::ShapeType::TextBox, 150, 20);
builder->MoveTo(textBox->get_FirstParagraph());
builder->Write(u"Original textbox contents");
// Insert a DATE field
builder->MoveTo(docOriginal->get_FirstSection()->get_Body()->AppendParagraph(u""));
builder->InsertField(u" DATE ");
// Insert a comment
auto newComment = MakeObject<Comment>(docOriginal, u"John Doe", u"J.D.", System::DateTime::get_Now());
newComment->SetText(u"Original comment.");
builder->get_CurrentParagraph()->AppendChild(newComment);
// Insert a header
builder->MoveToHeaderFooter(Aspose::Words::HeaderFooterType::HeaderPrimary);
builder->Writeln(u"Original header contents.");
// Create a clone of our document, which we will edit and later compare to the original
auto docEdited = System::DynamicCast<Aspose::Words::Document>(System::StaticCast<Node>(docOriginal)->Clone(true));
SharedPtr<Paragraph> firstParagraph = docEdited->get_FirstSection()->get_Body()->get_FirstParagraph();
// Change the formatting of the first paragraph, change casing of original characters and add text
firstParagraph->get_Runs()->idx_get(0)->set_Text(u"hello world! this is the first paragraph, after editing.");
firstParagraph->get_ParagraphFormat()->set_Style(docEdited->get_Styles()->idx_get(Aspose::Words::StyleIdentifier::Heading1));
// Edit the footnote
auto footnote = System::DynamicCast<Aspose::Words::Footnote>(docEdited->GetChild(Aspose::Words::NodeType::Footnote, 0, true));
footnote->get_FirstParagraph()->get_Runs()->idx_get(1)->set_Text(u"Edited endnote text.");
// Edit the table
auto table = System::DynamicCast<Aspose::Words::Tables::Table>(docEdited->GetChild(Aspose::Words::NodeType::Table, 0, true));
table->get_FirstRow()->get_Cells()->idx_get(1)->get_FirstParagraph()->get_Runs()->idx_get(0)->set_Text(u"Edited Cell 2 contents");
// Edit the textbox
textBox = System::DynamicCast<Aspose::Words::Drawing::Shape>(docEdited->GetChild(Aspose::Words::NodeType::Shape, 0, true));
textBox->get_FirstParagraph()->get_Runs()->idx_get(0)->set_Text(u"Edited textbox contents");
// Edit the DATE field
auto fieldDate = System::DynamicCast<Aspose::Words::Fields::FieldDate>(docEdited->get_Range()->get_Fields()->idx_get(0));
fieldDate->set_UseLunarCalendar(true);
// Edit the comment
auto comment = System::DynamicCast<Aspose::Words::Comment>(docEdited->GetChild(Aspose::Words::NodeType::Comment, 0, true));
comment->get_FirstParagraph()->get_Runs()->idx_get(0)->set_Text(u"Edited comment.");
// Edit the header
docEdited->get_FirstSection()->get_HeadersFooters()->idx_get(Aspose::Words::HeaderFooterType::HeaderPrimary)->get_FirstParagraph()->get_Runs()->idx_get(0)->set_Text(u"Edited header contents.");
// When we compare documents, the differences of the latter document from the former show up as revisions to the former
// Each edit that we've made above will have its own revision, after we run the Compare method
// We can compare with a CompareOptions object, which can suppress changes done to certain types of objects within the original document
// from registering as revisions after the comparison by setting some of these members to "true"
auto compareOptions = MakeObject<Aspose::Words::CompareOptions>();
compareOptions->set_IgnoreFormatting(false);
compareOptions->set_IgnoreCaseChanges(false);
compareOptions->set_IgnoreComments(false);
compareOptions->set_IgnoreTables(false);
compareOptions->set_IgnoreFields(false);
compareOptions->set_IgnoreFootnotes(false);
compareOptions->set_IgnoreTextboxes(false);
compareOptions->set_IgnoreHeadersAndFooters(false);
compareOptions->set_Target(Aspose::Words::ComparisonTargetType::New);
docOriginal->Compare(docEdited, u"John Doe", System::DateTime::get_Now(), compareOptions);
docOriginal->Save(ArtifactsDir + u"Document.CompareOptions.docx");
Enumerator
Current 

This document is used as a base during comparison.

New 

Other document is used as a base during comparison.

◆ ConditionalStyleType

Represents possible table areas to which conditional formatting may be defined in a table style.

Examples

Shows how to work with certain area styles of a table.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Create a table
SharedPtr<Table> table = builder->StartTable();
builder->InsertCell();
builder->Write(u"Cell 1");
builder->InsertCell();
builder->Write(u"Cell 2");
builder->EndRow();
builder->InsertCell();
builder->Write(u"Cell 3");
builder->InsertCell();
builder->Write(u"Cell 4");
builder->EndTable();
// Create a custom table style
auto tableStyle = System::DynamicCast<Aspose::Words::TableStyle>(doc->get_Styles()->Add(Aspose::Words::StyleType::Table, u"MyTableStyle1"));
// Conditional styles are formatting changes that affect only some of the cells of the table based on a predicate,
// such as the cells being in the last row
// We can access these conditional styles by style type like this
tableStyle->get_ConditionalStyles()->idx_get(Aspose::Words::ConditionalStyleType::FirstRow)->get_Shading()->set_BackgroundPatternColor(System::Drawing::Color::get_AliceBlue());
// The same conditional style can be accessed by index
tableStyle->get_ConditionalStyles()->idx_get(0)->get_Borders()->set_Color(System::Drawing::Color::get_Black());
tableStyle->get_ConditionalStyles()->idx_get(0)->get_Borders()->set_LineStyle(Aspose::Words::LineStyle::DotDash);
ASSERT_EQ(Aspose::Words::ConditionalStyleType::FirstRow, tableStyle->get_ConditionalStyles()->idx_get(0)->get_Type());
// It can also be found in the ConditionalStyles collection as an attribute
tableStyle->get_ConditionalStyles()->get_FirstRow()->get_ParagraphFormat()->set_Alignment(Aspose::Words::ParagraphAlignment::Center);
// Apply padding and text formatting to conditional styles
tableStyle->get_ConditionalStyles()->get_LastRow()->set_BottomPadding(10);
tableStyle->get_ConditionalStyles()->get_LastRow()->set_LeftPadding(10);
tableStyle->get_ConditionalStyles()->get_LastRow()->set_RightPadding(10);
tableStyle->get_ConditionalStyles()->get_LastRow()->set_TopPadding(10);
tableStyle->get_ConditionalStyles()->get_LastColumn()->get_Font()->set_Bold(true);
// List all possible style conditions
{
SharedPtr<System::Collections::Generic::IEnumerator<SharedPtr<ConditionalStyle>>> enumerator = tableStyle->get_ConditionalStyles()->GetEnumerator();
while (enumerator->MoveNext())
{
SharedPtr<ConditionalStyle> currentStyle = enumerator->get_Current();
if (currentStyle != nullptr)
{
System::Console::WriteLine(System::ObjectExt::Box<ConditionalStyleType>(currentStyle->get_Type()));
}
}
}
// Apply conditional style to the table
table->set_Style(tableStyle);
// Changes to the first row are enabled by the table's style options be default,
// but need to be manually enabled for some other parts, such as the last column/row
table->set_StyleOptions(table->get_StyleOptions() | Aspose::Words::Tables::TableStyleOptions::LastRow | Aspose::Words::Tables::TableStyleOptions::LastColumn);
doc->Save(ArtifactsDir + u"Table.ConditionalStyles.docx");
Enumerator
FirstRow 

Specifies formatting of the first row of a table.

FirstColumn 

Specifies formatting of the first column of a table.

LastRow 

Specifies formatting of the last row of a table.

LastColumn 

Specifies formatting of the last column of a table.

OddRowBanding 

Specifies formatting of odd-numbered row stripe.

OddColumnBanding 

Specifies formatting of odd-numbered column stripe.

EvenRowBanding 

Specifies formatting of even-numbered row stripe.

EvenColumnBanding 

Specifies formatting of even-numbered column stripe.

TopLeftCell 

Specifies formatting of the top left cell of a table.

TopRightCell 

Specifies formatting of the top right cell of a table.

BottomLeftCell 

Specifies formatting of the bottom left cell of a table.

BottomRightCell 

Specifies formatting of the bottom right cell of a table.

◆ DigitalSignatureType

Specifies the type of a digital signature.

Examples

Shows how to sign documents with X.509 certificates.

// Verify that a document isn't signed
ASSERT_FALSE(FileFormatUtil::DetectFileFormat(MyDir + u"Document.docx")->get_HasDigitalSignature());
// Create a CertificateHolder object from a PKCS #12 file, which we will use to sign the document
SharedPtr<CertificateHolder> certificateHolder = CertificateHolder::Create(MyDir + u"morzal.pfx", u"aw", nullptr);
// There are 2 ways of saving a signed copy of a document to the local file system
// 1: Designate unsigned input and signed output files by filename and sign with the passed CertificateHolder
DigitalSignatureUtil::Sign(MyDir + u"Document.docx", ArtifactsDir + u"Document.DigitalSignature.docx", certificateHolder, [&]{ auto tmp_0 = MakeObject<SignOptions>(); tmp_0->set_SignTime(System::DateTime::get_Now()); return tmp_0; }());
ASSERT_TRUE(FileFormatUtil::DetectFileFormat(ArtifactsDir + u"Document.DigitalSignature.docx")->get_HasDigitalSignature());
// 2: Create a stream for the input file and one for the output and create a file, signed with the CertificateHolder, at the file system location determine
{
auto inDoc = MakeObject<System::IO::FileStream>(MyDir + u"Document.docx", System::IO::FileMode::Open);
{
auto outDoc = MakeObject<System::IO::FileStream>(ArtifactsDir + u"Document.DigitalSignature.docx", System::IO::FileMode::Create);
DigitalSignatureUtil::Sign(inDoc, outDoc, certificateHolder);
}
}
ASSERT_TRUE(FileFormatUtil::DetectFileFormat(ArtifactsDir + u"Document.DigitalSignature.docx")->get_HasDigitalSignature());
// Open the signed document and get its digital signature collection
auto signedDoc = MakeObject<Document>(ArtifactsDir + u"Document.DigitalSignature.docx");
SharedPtr<DigitalSignatureCollection> digitalSignatureCollection = signedDoc->get_DigitalSignatures();
// Verify that all of the document's digital signatures are valid and check their details
ASSERT_TRUE(digitalSignatureCollection->get_IsValid());
ASSERT_EQ(1, digitalSignatureCollection->get_Count());
ASSERT_EQ(Aspose::Words::DigitalSignatureType::XmlDsig, digitalSignatureCollection->idx_get(0)->get_SignatureType());
ASSERT_EQ(u"CN=Morzal.Me", signedDoc->get_DigitalSignatures()->idx_get(0)->get_IssuerName());
ASSERT_EQ(u"CN=Morzal.Me", signedDoc->get_DigitalSignatures()->idx_get(0)->get_SubjectName());
Enumerator
Unknown 

Indicates an error, unknown digital signature type.

CryptoApi 

The Crypto API signature method used in Microsoft Word 97-2003 .DOC binary documents.

XmlDsig 

The XmlDsig signature method used in OOXML and OpenDocument documents.

◆ DocumentDirection

Allows to specify the direction to flow the text in a document.

Enumerator
LeftToRight 

Left to right direction.

RightToLeft 

Right to left direction.

Auto 

Auto-detect direction.

◆ DocumentPositionMovement

DocumentPositionMovement enumeration.

Enumerator
None 
Inside 
StartEnd 
Sibling 
Above 
Below 

◆ DropCapPosition

Specifies the position for a drop cap text.

Examples

Shows how to set the position of a drop cap.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Every paragraph has its own drop cap setting
SharedPtr<ParagraphFormat> format = doc->get_FirstSection()->get_Body()->get_FirstParagraph()->get_ParagraphFormat();
// By default, it is "none", for no drop caps
ASSERT_EQ(Aspose::Words::DropCapPosition::None, format->get_DropCapPosition());
// Move the first capital to outside the text margin
format->set_DropCapPosition(Aspose::Words::DropCapPosition::Margin);
format->set_LinesToDrop(2);
// This text will be affected
builder->Write(u"Hello world!");
doc->Save(ArtifactsDir + u"ParagraphFormat.DropCap.docx");
Enumerator
None 

The paragraph does not have a drop cap.

Normal 

The drop cap is positioned inside the text margin on the anchor paragraph.

Margin 

The drop cap is positioned outside the text margin on the anchor paragraph.

◆ EditingLanguage

Specifies the editing language.

Examples

Shows how to set up language preferences that will be used when document is loading

auto loadOptions = MakeObject<LoadOptions>();
loadOptions->get_LanguagePreferences()->AddEditingLanguage(Aspose::Words::EditingLanguage::Japanese);
auto doc = MakeObject<Document>(MyDir + u"No default editing language.docx", loadOptions);
int localeIdFarEast = doc->get_Styles()->get_DefaultFont()->get_LocaleIdFarEast();
System::Console::WriteLine(localeIdFarEast == (int)Aspose::Words::EditingLanguage::Japanese ? String(u"The document either has no any FarEast language set in defaults or it was set to Japanese originally.") : String(u"The document default FarEast language was set to another than Japanese language originally, so it is not overridden."));
Enumerator
Afrikaans 
Albanian 
Alsatian 
Amharic 
ArabicAlgeria 
ArabicBahrain 
ArabicEgypt 
ArabicIraq 
ArabicJordan 
ArabicKuwait 
ArabicLebanon 
ArabicLibya 
ArabicMorocco 
ArabicOman 
ArabicQatar 
ArabicSaudiArabia 
ArabicSyria 
ArabicTunisia 
ArabicUAE 
ArabicYemen 
Armenian 
Assamese 
AzerbaijaniCyrillic 
AzerbaijaniLatin 
BanglaBangladesh 
BanglaIndia 
Bashkir 
Basque 
Belarusian 
BosnianCyrillic 
BosnianLatin 
Breton 
Bulgarian 
Burmese 
Catalan 
CentralKurdishIraq 
Cherokee 
ChineseHongKong 
ChineseMacao 
ChinesePRC 
ChineseSingapore 
ChineseTaiwan 
Corsican 
CroatianBozniaAndHerzegovina 
Croatian 
Czech 
Danish 
Divehi 
DutchBelgium 
DutchNetherlands 
Edo 
EnglishAustralia 
EnglishBelize 
EnglishCanada 
EnglishCaribbean 
EnglishHongKong 
EnglishIndia 
EnglishIndonesia 
EnglishIreland 
EnglishJamaica 
EnglishMalaysia 
EnglishNewZealand 
EnglishPhilippines 
EnglishSingapore 
EnglishSouthAfrica 
EnglishTrinidadAndTobago 
EnglishUK 
EnglishUS 
EnglishZimbabwe 
Estonian 
Faeroese 
Filipino 
Finnish 
FrenchBelgium 
FrenchCanada 
FrenchFrance 
FrenchLuxembourg 
FrenchMonaco 
FrenchSwitzerland 
Frisian 
FulahLatinSenegal 
FulahNigeria 
Galician 
Georgian 
GermanAustria 
GermanGermany 
GermanLiechtenstein 
GermanLuxembourg 
GermanSwitzerland 
Greek 
Greenlandic 
Guarani 
Gujarati 
Hausa 
Hawaiian 
Hebrew 
Hindi 
Hungarian 
Icelandic 
Igbo 
InariSamiFinland 
Indonesian 
InuktitutLatin 
InuktitutSyllabics 
Irish 
IsiXhosa 
IsiZulu 
ItalianItaly 
ItalianSwitzerland 
Japanese 
Kannada 
Kanuri 
Kashmiri 
KashmiriArabic 
Kazakh 
Khmer 
Kiche 
Kinyarwanda 
Kiswahili 
Konkani 
Korean 
Kyrgyz 
Lao 
Latin 
Latvian 
Lithuanian 
LowerSorbian 
LuleSamiNorway 
LuleSamiSweden 
Luxembougish 
Macedonian 
MalayMalaysia 
MalayBruneiDarussalam 
Malayalam 
Maltese 
Manipuri 
Maori 
MapudungunChile 
Marathi 
Mohawk 
MongolianCyrillic 
MongolianMongolian 
Nepali 
NorthernSamiFinland 
NorthernSamiNorway 
NorthernSamiSweden 
NorwegianBokmal 
NorwegianNynorsk 
Oriya 
Oromo 
Papiamentu 
Pashto 
Persian 
Polish 
PortugueseBrazil 
PortuguesePortugal 
PunjabiIndia 
PunjabiPakistan 
QuechuaBolivia 
QuechuaEcuador 
QuechuaPeru 
Romanian 
Romansh 
Russian 
Sakha 
Sanskrit 
ScottishGaelic 
SerbianCyrillicBosniaAndHerzegovina 
SerbianCyrillicSerbiaAndMontenegro 
SerbianLatinBosniaAndHerzegovina 
SerbianLatinSerbiaAndMontenegro 
Sindhi 
SindhiDevanagaric 
Sinhalese 
Slovak 
Slovenian 
Somali 
Sorbian 
SpanishArgentina 
SpanishBolivia 
SpanishChile 
SpanishColombia 
SpanishCostaRica 
SpanishDominicanRepublic 
SpanishEcuador 
SpanishElSalvador 
SpanishGuatemala 
SpanishHonduras 
SpanishMexico 
SpanishNicaragua 
SpanishPanama 
SpanishParaguay 
SpanishPeru 
SpanishPuertoRico 
SpanishSpainModernSort 
SpanishSpainTraditionalSort 
SpanishUruguay 
SpanishVenezuela 
Sutu 
SwedishFinland 
SwedishSweden 
Syriac 
Tajik 
Tamazight 
TamazightLatin 
Tamil 
Tatar 
Telugu 
Thai 
TibetanButan 
TibetanChina 
TigrignaEritrea 
TigrignaEthiopia 
Tsonga 
Tswana 
Turkish 
Turkmen 
Ukrainian 
Urdu 
UzbekCyrillic 
UzbekLatin 
Venda 
Vietnamese 
Welsh 
Yi 
Yiddish 
Yoruba 

◆ EditorType

Specifies the set of possible aliases (or editing groups) which can be used as aliases to determine if the current user shall be allowed to edit a single range defined by an editable range within a document.

Examples

Shows how to add editing group for editable ranges

SharedPtr<EditableRangeStart> startRange1 = builder->StartEditableRange();
builder->Writeln(u"EditableRange_1_1");
builder->Writeln(u"EditableRange_1_2");
// Sets the editor for editable range region
startRange1->get_EditableRange()->set_EditorGroup(Aspose::Words::EditorType::Everyone);
Enumerator
Unspecified 

Means that editor type is not specified.

Administrators 

Specifies that users associated with the Administrators group shall be allowed to edit editable ranges using this editing type when document protection is enabled.

Contributors 

Specifies that users associated with the Contributors group shall be allowed to edit editable ranges using this editing type when document protection is enabled.

Current 

Specifies that users associated with the Current group shall be allowed to edit editable ranges using this editing type when document protection is enabled.

Editors 

Specifies that users associated with the Editors group shall be allowed to edit editable ranges using this editing type when document protection is enabled.

Everyone 

Specifies that all users that open the document shall be allowed to edit editable ranges using this editing type when document protection is enabled.

None 

Specifies that none of the users that open the document shall be allowed to edit editable ranges using this editing type when document protection is enabled.

Owners 

Specifies that users associated with the Owners group shall be allowed to edit editable ranges using this editing type when document protection is enabled.

Default 

Same as Unspecified.

◆ EmphasisMark

Specifies possible types of emphasis mark.

Enumerator
None 

No emphasis mark.

OverSolidCircle 

Emphasis mark is a solid black circle displayed above text.

OverComma 

Emphasis mark is a comma character displayed above text.

OverWhiteCircle 

Emphasis mark is an empty white circle displayed above text.

UnderSolidCircle 

Emphasis mark is a solid black circle displayed below text.

◆ EndnotePosition

Defines the endnote position.

See also
Aspose::Words::EndnoteOptions
Examples

Shows how to insert endnotes and edit their appearance.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert 3 paragraphs with an endnote at the end of each one
builder->Write(u"Text 1. ");
builder->InsertFootnote(Aspose::Words::FootnoteType::Endnote, u"Endnote 1");
builder->Write(u"Text 2. ");
builder->InsertFootnote(Aspose::Words::FootnoteType::Endnote, u"Endnote 2");
builder->Write(u"Text 3. ");
builder->InsertFootnote(Aspose::Words::FootnoteType::Endnote, u"Endnote 3", u"Custom reference mark");
// Edit the numbering and positioning of endnotes
doc->get_EndnoteOptions()->set_Position(Aspose::Words::EndnotePosition::EndOfDocument);
doc->get_EndnoteOptions()->set_NumberStyle(Aspose::Words::NumberStyle::UppercaseRoman);
doc->get_EndnoteOptions()->set_RestartRule(Aspose::Words::FootnoteNumberingRule::Continuous);
doc->get_EndnoteOptions()->set_StartNumber(1);
doc->Save(ArtifactsDir + u"Document.Endnotes.docx");
Enumerator
EndOfSection 

Endnotes are output at the end of the section.

EndOfDocument 

Endnotes are output at the end of the document.

◆ FindReplaceDirection

Specifies direction for replace operations.

Enumerator
Forward 

Matched items are replaced from first to last.

Backward 

Matched items are replaced from last back to first.

◆ FootnoteLocation

FootnoteLocation enumeration.

Enumerator
BottomOfPage 
BeneathText 
EndOfSection 
EndOfDocument 

◆ FootnoteNumberingRule

Determines when automatic footnote or endnote numbering restarts.

See also
Aspose::Words::FootnoteOptions
Aspose::Words::EndnoteOptions
Examples

Shows how to insert footnotes and edit their appearance.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert 3 paragraphs with a footnote at the end of each one
builder->Write(u"Text 1. ");
builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote 1");
builder->Write(u"Text 2. ");
builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote 2");
builder->Write(u"Text 3. ");
builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote 3", u"Custom reference mark");
// Edit the numbering and positioning of footnotes
doc->get_FootnoteOptions()->set_Position(Aspose::Words::FootnotePosition::BeneathText);
doc->get_FootnoteOptions()->set_NumberStyle(Aspose::Words::NumberStyle::UppercaseRoman);
doc->get_FootnoteOptions()->set_RestartRule(Aspose::Words::FootnoteNumberingRule::Continuous);
doc->get_FootnoteOptions()->set_StartNumber(1);
doc->Save(ArtifactsDir + u"Document.Footnotes.docx");
Enumerator
Continuous 

Numbering continuous throughout the document.

RestartSection 

Numbering restarts at each section.

RestartPage 

Numbering restarts at each page. Valid for footnotes only.

Default 

Equals Continuous.

◆ FootnotePosition

Defines the footnote position.

See also
Aspose::Words::FootnoteOptions
Examples

Shows how to insert footnotes and edit their appearance.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert 3 paragraphs with a footnote at the end of each one
builder->Write(u"Text 1. ");
builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote 1");
builder->Write(u"Text 2. ");
builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote 2");
builder->Write(u"Text 3. ");
builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote 3", u"Custom reference mark");
// Edit the numbering and positioning of footnotes
doc->get_FootnoteOptions()->set_Position(Aspose::Words::FootnotePosition::BeneathText);
doc->get_FootnoteOptions()->set_NumberStyle(Aspose::Words::NumberStyle::UppercaseRoman);
doc->get_FootnoteOptions()->set_RestartRule(Aspose::Words::FootnoteNumberingRule::Continuous);
doc->get_FootnoteOptions()->set_StartNumber(1);
doc->Save(ArtifactsDir + u"Document.Footnotes.docx");
Enumerator
BottomOfPage 

Footnotes are output at the bottom of each page.

BeneathText 

Footnotes are output beneath text on each page.

◆ FootnoteType

Specifies whether this is a footnote or an endnote.

Both footnotes and endnotes are represented by objects by the Footnote class. Use FootnoteType to distinguish between footnotes and endnotes.

See also
Aspose::Words::FootnoteType::Footnote
Examples

Shows how to reference text with a footnote and an endnote.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert some text and mark it with a footnote with the IsAuto attribute set to "true" by default,
// so the marker seen in the body text will be auto-numbered at "1", and the footnote will appear at the bottom of the page
builder->Write(u"This text will be referenced by a footnote.");
builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote comment regarding referenced text.");
// Insert more text and mark it with an endnote with a custom reference mark,
// which will be used in place of the number "2" and will set "IsAuto" to false
builder->Write(u"This text will be referenced by an endnote.");
builder->InsertFootnote(Aspose::Words::FootnoteType::Endnote, u"Endnote comment regarding referenced text.", u"CustomMark");
// Footnotes always appear at the bottom of the page of their referenced text, so this page break will not affect the footnote
// On the other hand, endnotes are always at the end of the document, so this page break will push the endnote down to the next page
doc->Save(ArtifactsDir + u"DocumentBuilder.InsertFootnote.docx");

Shows how to add a footnote to a paragraph in the document and set its marker.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Add text that will be referenced by a footnote
builder->Write(u"Main body text.");
// Add a footnote and give it text, which will appear at the bottom of the page
SharedPtr<Footnote> footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
// This attribute means the footnote in the main text will automatically be assigned a number, "1" in this instance
// The next footnote will get "2"
ASSERT_TRUE(footnote->get_IsAuto());
// We can edit the footnote's text like this
// Make sure to move the builder back into the document body afterwards
builder->MoveTo(footnote->get_FirstParagraph());
builder->Write(u" More text added by a DocumentBuilder.");
builder->MoveToDocumentEnd();
ASSERT_EQ(u"Footnote text. More text added by a DocumentBuilder.", footnote->get_Paragraphs()->idx_get(0)->ToString(Aspose::Words::SaveFormat::Text).Trim());
builder->Write(u" More main body text.");
footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
// Substitute the reference number for our own custom mark by setting this variable, "IsAuto" will also be set to false
footnote->set_ReferenceMark(u"RefMark");
ASSERT_FALSE(footnote->get_IsAuto());
// This bookmark will get a number "3" even though there was no "2"
builder->Write(u" More main body text.");
footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
ASSERT_TRUE(footnote->get_IsAuto());
doc->Save(ArtifactsDir + u"InlineStory.AddFootnote.docx");
Enumerator
Footnote 

The object is a footnote.

Endnote 

The object is an endnote.

◆ Granularity

Specifies the granularity of changes to track when comparing two documents.

Enumerator
CharLevel 
WordLevel 

◆ HeaderFooterType

Identifies the type of header or footer found in a Word file.

Examples

Shows how to create headers and footers in a document using DocumentBuilder.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Specify that we want headers and footers different for first, even and odd pages
builder->get_PageSetup()->set_DifferentFirstPageHeaderFooter(true);
builder->get_PageSetup()->set_OddAndEvenPagesHeaderFooter(true);
// Create the headers
builder->MoveToHeaderFooter(Aspose::Words::HeaderFooterType::HeaderFirst);
builder->Write(u"Header for the first page");
builder->MoveToHeaderFooter(Aspose::Words::HeaderFooterType::HeaderEven);
builder->Write(u"Header for even pages");
builder->MoveToHeaderFooter(Aspose::Words::HeaderFooterType::HeaderPrimary);
builder->Write(u"Header for all other pages");
// Create three pages in the document
builder->MoveToSection(0);
builder->Writeln(u"Page1");
builder->Writeln(u"Page2");
builder->Writeln(u"Page3");
doc->Save(ArtifactsDir + u"DocumentBuilder.HeadersAndFooters.docx");
Enumerator
HeaderEven 

Header for even numbered pages.

HeaderPrimary 

Primary header, also used for odd numbered pages.

FooterEven 

Footer for even numbered pages.

FooterPrimary 

Primary footer, also used for odd numbered pages.

HeaderFirst 

Header for the first page of the section.

FooterFirst 

Footer for the first page of the section.

◆ HeightRule

Specifies the rule for determining the height of an object.

Examples

Shows how to create a table that contains a single cell and apply row formatting.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Table> table = builder->StartTable();
builder->InsertCell();
// Set the row formatting
SharedPtr<RowFormat> rowFormat = builder->get_RowFormat();
rowFormat->set_Height(100);
rowFormat->set_HeightRule(Aspose::Words::HeightRule::Exactly);
// These formatting properties are set on the table and are applied to all rows in the table
table->set_LeftPadding(30);
table->set_RightPadding(30);
table->set_TopPadding(30);
table->set_BottomPadding(30);
builder->Writeln(u"Contents of formatted row.");
builder->EndRow();
builder->EndTable();
doc->Save(ArtifactsDir + u"DocumentBuilder.DocumentBuilderSetRowFormatting.docx");
Enumerator
AtLeast 

The height will be at least the specified height in points. It will grow, if needed, to accommodate all text inside an object.

Exactly 

The height is specified exactly in points. Please note that if the text cannot fit inside the object of this height, it will appear truncated.

Auto 

The height will grow automatically to accommodate all text inside an object.

◆ HtmlControlType

Type of document nodes that represent <input> and <select> elements imported from HTML.

Enumerator
FormField 
StructuredDocumentTag 

◆ ImportFormatMode

Specifies how formatting is merged when importing content from another document.

When you copy nodes from one document to another, this option specifies how formatting is resolved when both documents have a style with the same name, but different formatting.

The formatting is resolved as follows:

  1. Built-in styles are matched using their locale independent style identifier. User defined styles are matched using case-sensitive style name.
  2. If a matching style is not found in the destination document, the style (and all styles referenced by it) are copied into the destination document and the imported nodes are updated to reference the new style.
  3. If a matching style already exists in the destination document, what happens depends on the importFormatMode parameter passed to Document.ImportNode as described below.

When using the UseDestinationStyles option, if a matching style already exists in the destination document, the style is not copied and the imported nodes are updated to reference the existing style.

The drawback of using UseDestinationStyles is that the imported text might look different in the destination document comparing to the source document. For example, the "Heading 1" style in the source document uses Arial 16pt font and the "Heading 1" style in the destination document uses Times New Roman 14pt font. When importing text of "Heading 1" style with no other direct formatting, it will appear as Times New Roman 14pt font in the destination document.

KeepSourceFormatting option allows to make sure the imported content looks the same in the destination document like it looks in the source document. If a matching style already exists in the destination document, the source style formatting is expanded into direct Node attributes and the style is changed to Normal. If the style does not exist in the destination document, then the source style is imported into the destination document and applied to the imported node. Note, that it is not always possible to preserve the source style even if it does not exist in the destination document. In this case formating of such style will be expanded into direct Node attributes in favor of preserving original Node formatting.

The drawback of using KeepSourceFormatting is that if you perform several imports, you could end up with many styles in the destination document and that could make using consistent style formatting in Microsoft Word difficult for this document.

Using KeepDifferentStyles option allows to reuse destination styles if the formatting they provide is identical to the styles in the source document. If the style in destination document is different from the source then it is imported.

See also
Aspose::Words::DocumentBase::ImportNode(System::SharedPtr<Aspose::Words::Node>, bool, Aspose::Words::ImportFormatMode)
Examples

Shows how to insert a document content into another document keep formatting of inserted document.

auto doc = MakeObject<Document>(MyDir + u"Document.docx");
auto builder = MakeObject<DocumentBuilder>(doc);
builder->MoveToDocumentEnd();
auto docToInsert = MakeObject<Document>(MyDir + u"Formatted elements.docx");
builder->InsertDocument(docToInsert, Aspose::Words::ImportFormatMode::KeepSourceFormatting);
builder->get_Document()->Save(ArtifactsDir + u"DocumentBuilder.InsertDocument.docx");
Enumerator
UseDestinationStyles 

Use the destination document styles and copy new styles. This is the default option.

KeepSourceFormatting 

Copy all required styles to the destination document, generate unique style names if needed.

KeepDifferentStyles 

Only copy styles that are different from those in the source document.

◆ LineNumberRestartMode

Determines when automatic line numbering restarts.

See also
Aspose::Words::PageSetup
Aspose::Words::PageSetup::get_LineNumberRestartMode
Examples

Shows how to enable Microsoft Word line numbering for a section.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Line numbering for each section can be configured via PageSetup
SharedPtr<PageSetup> pageSetup = builder->get_PageSetup();
pageSetup->set_LineStartingNumber(1);
pageSetup->set_LineNumberCountBy(3);
pageSetup->set_LineNumberRestartMode(Aspose::Words::LineNumberRestartMode::RestartPage);
pageSetup->set_LineNumberDistanceFromText(50.0);
// LineNumberCountBy is set to 3, so every line that's a multiple of 3
// will display that line number to the left of the text
for (int i = 1; i <= 25; i++)
{
builder->Writeln(String::Format(u"Line {0}.",i));
}
// The line counter will skip any paragraph with this flag set to true
// Normally, the number "15" would normally appear next to this paragraph, which says "Line 15"
// Since we set this flag to true and this paragraph is not counted by numbering,
// number 15 will appear next to the next paragraph, "Line 16", and from then on counting will carry on as normal
// until it will restart according to LineNumberRestartMode
doc->get_FirstSection()->get_Body()->get_Paragraphs()->idx_get(14)->get_ParagraphFormat()->set_SuppressLineNumbers(true);
doc->Save(ArtifactsDir + u"PageSetup.LineNumbers.docx");
Enumerator
RestartPage 

Line numbering restarts at the start of every page.

RestartSection 

Line numbering restarts at the section start.

Continuous 

Line numbering continuous from the previous section.

◆ LineSpacingRule

Specifies line spacing values for a paragraph.

Enumerator
AtLeast 

The line spacing can be greater than or equal to, but never less than, the value specified in the LineSpacing property.

Exactly 

The line spacing never changes from the value specified in the LineSpacing property, even if a larger font is used within the paragraph.

Multiple 

The line spacing is specified in the LineSpacing property as the number of lines. One line equals 12 points.

◆ LineStyle

Specifies line style of a Border.

Examples

Shows how to insert a string surrounded by a border into a document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_Font()->get_Border()->set_Color(System::Drawing::Color::get_Green());
builder->get_Font()->get_Border()->set_LineWidth(2.5);
builder->get_Font()->get_Border()->set_LineStyle(Aspose::Words::LineStyle::DashDotStroker);
builder->Write(u"Text surrounded by green border.");
doc->Save(ArtifactsDir + u"Border.FontBorder.docx");
Enumerator
None 
Single 
Thick 
Double 
Hairline 
Dot 
DashLargeGap 
DotDash 
DotDotDash 
Triple 
ThinThickSmallGap 
ThickThinSmallGap 
ThinThickThinSmallGap 
ThinThickMediumGap 
ThickThinMediumGap 
ThinThickThinMediumGap 
ThinThickLargeGap 
ThickThinLargeGap 
ThinThickThinLargeGap 
Wave 
DoubleWave 
DashSmallGap 
DashDotStroker 
Emboss3D 
Engrave3D 
Outset 
Inset 

◆ LoadFormat

Indicates the format of the document that is to be loaded.

Examples

Shows how to insert the HTML contents from a web page into a new document.

// The url of the page to load
const String url = u"https://www.aspose.com/";
// Create a WebClient object to easily extract the HTML from the page
auto client = MakeObject<System::Net::WebClient>();
String pageSource = client->DownloadString(url);
client->Dispose();
// Get the HTML as bytes for loading into a stream
SharedPtr<System::Text::Encoding> encoding = client->get_Encoding();
ArrayPtr<uint8_t> pageBytes = encoding->GetBytes(pageSource);
// Load the HTML into a stream
{
auto stream = MakeObject<System::IO::MemoryStream>(pageBytes);
// The baseUri property should be set to ensure any relative img paths are retrieved correctly
auto options = MakeObject<LoadOptions>(Aspose::Words::LoadFormat::Html, u"", url);
// Load the HTML document from stream and pass the LoadOptions object
auto doc = MakeObject<Document>(stream, options);
// Save the document to the local file system while converting it to .docx
doc->Save(ArtifactsDir + u"Document.InsertHtmlFromWebPage.docx");
}

Shows how to load a document as HTML without automatic file format detection.

auto loadOptions = MakeObject<LoadOptions>();
loadOptions->set_LoadFormat(Aspose::Words::LoadFormat::Html);
auto doc = MakeObject<Document>(MyDir + u"Document.html", loadOptions);
Enumerator
Auto 

Instructs Aspose.Words to recognize the format automatically.

Doc 

Microsoft Word 95 or Word 97 - 2003 Document.

Dot 

Microsoft Word 95 or Word 97 - 2003 Template.

DocPreWord60 

The document is in pre-Word 95 format. Aspose.Words does not currently support loading such documents.

Docx 

Office Open XML WordprocessingML Document (macro-free).

Docm 

Office Open XML WordprocessingML Macro-Enabled Document.

Dotx 

Office Open XML WordprocessingML Template (macro-free).

Dotm 

Office Open XML WordprocessingML Macro-Enabled Template.

FlatOpc 

Office Open XML WordprocessingML stored in a flat XML file instead of a ZIP package.

FlatOpcMacroEnabled 

Office Open XML WordprocessingML Macro-Enabled Document stored in a flat XML file instead of a ZIP package.

FlatOpcTemplate 

Office Open XML WordprocessingML Template (macro-free) stored in a flat XML file instead of a ZIP package.

FlatOpcTemplateMacroEnabled 

Office Open XML WordprocessingML Macro-Enabled Template stored in a flat XML file instead of a ZIP package.

Rtf 

RTF format.

WordML 

Microsoft Word 2003 WordprocessingML format.

Html 

HTML format.

Mhtml 

MHTML (Web archive) format.

Mobi 

MOBI is an eBook format used by the MobiPocket Reader and Amazon Kindle Readers.

Chm 

CHM (Compiled HTML Help) format.

Odt 

ODF Text Document.

Ott 

ODF Text Document Template.

Text 

Plain Text.

Markdown 

Markdown text document.

Pdf 

Pdf document.

Unknown 

Unrecognized format, cannot be loaded by Aspose.Words.

◆ LoadFormatTest

LoadFormatTest enumeration.

Enumerator
TestDocxDml 

◆ MeasurementUnits

Specifies the unit of measurement.

Enumerator
Inches 

Inches.

Centimeters 

Centimeters.

Millimeters 

Millimeters.

Points 

Points.

Picas 

Picas (commonly used in traditional typewriter font spacing).

◆ NodeChangingAction

Specifies the type of node change.

See also
Aspose::Words::NodeChangingArgs
Aspose::Words::NodeChangingArgs::get_Action
Enumerator
Insert 

A node is being inserted in the tree.

Remove 

A node is being removed from the tree.

◆ NodeType

Specifies the type of a Word document node.

Examples

Shows how to enumerate immediate children of a CompositeNode using the enumerator provided by the ChildNodes collection.

auto doc = MakeObject<Document>();
auto paragraph = System::DynamicCast<Aspose::Words::Paragraph>(doc->GetChild(Aspose::Words::NodeType::Paragraph, 0, true));
paragraph->AppendChild(MakeObject<Run>(doc, u"Hello world!"));
paragraph->AppendChild(MakeObject<Run>(doc, u" Hello again!"));
SharedPtr<Aspose::Words::NodeCollection> children = paragraph->get_ChildNodes();
// Paragraph may contain children of various types such as runs, shapes and so on
for (auto child : System::IterateOver(children))
{
{
auto run = System::DynamicCast<Aspose::Words::Run>(child);
System::Console::WriteLine(run->get_Text());
}
}
Enumerator
Any 

Indicates all node types. Allows to select all children.

Document 

A Document object that, as the root of the document tree, provides access to the entire Word document. A Document node can have Section nodes.

Section 

A Section object that corresponds to one section in a Word document. A Section node can have Body and HeaderFooter nodes.

Body 

A Body object that contains the main text of a section (main text story). A Body node can have Paragraph and Table nodes.

HeaderFooter 

A HeaderFooter object that contains text of a particular header or footer inside a section. A HeaderFooter node can have Paragraph and Table nodes.

Table 

A Table object that represents a table in a Word document. A Table node can have Row nodes.

Row 

A row of a table. A Row node can have Cell nodes.

Cell 

A cell of a table row. A Cell node can have Paragraph and Table nodes.

Paragraph 

A paragraph of text. A Paragraph node is a container for inline level elements Run, FieldStart, FieldSeparator, FieldEnd, FormField, Shape, GroupShape, Footnote, Comment, SpecialChar, as well as BookmarkStart and BookmarkEnd.

BookmarkStart 

A beginning of a bookmark marker.

BookmarkEnd 

An end of a bookmark marker.

EditableRangeStart 

A beginning of an editable range.

EditableRangeEnd 

An end of an editable range.

MoveFromRangeStart 

A beginning of an MoveFrom range.

MoveFromRangeEnd 

An end of an MoveFrom range.

MoveToRangeStart 

A beginning of an MoveTo range.

MoveToRangeEnd 

An end of an MoveTo range.

GroupShape 

A group of shapes, images, OLE objects or other group shapes. A GroupShape node can contain other Shape and GroupShape nodes.

Shape 

A drawing object, such as an OfficeArt shape, image or an OLE object. A Shape node can contain Paragraph and Table nodes.

Comment 

A comment in a Word document. A Comment node can have Paragraph and Table nodes.

Footnote 

A footnote or endnote in a Word document. A Footnote node can have Paragraph and Table nodes.

Run 

A run of text.

FieldStart 

A special character that designates the start of a Word field.

FieldSeparator 

A special character that separates the field code from the field result.

FieldEnd 

A special character that designates the end of a Word field.

FormField 

A form field.

SpecialChar 

A special character that is not one of the more specific special character types.

SmartTag 

A smart tag around one or more inline structures (runs, images, fields,etc.) within a paragraph.

StructuredDocumentTag 

Allows to define customer-specific information and its means of presentation.

StructuredDocumentTagRangeStart 

A start of ranged structured document tag which accepts multi-sections content.

StructuredDocumentTagRangeEnd 

A end of ranged structured document tag which accepts multi-sections content.

GlossaryDocument 

A glossary document within the main document.

BuildingBlock 

A building block within a glossary document (e.g. glossary document entry).

CommentRangeStart 

A marker node that represents the start of a commented range.

CommentRangeEnd 

A marker node that represents the end of a commented range.

OfficeMath 

An Office Math object. Can be equation, function, matrix or one of other mathematical objects. Can be a collection of mathematical object and also can contain some non-mathematical objects such as runs of text.

SubDocument 

A subdocument node which is a link to another document.

System 

Reserved for internal use by Aspose.Words.

Null 

Reserved for internal use by Aspose.Words.

◆ NumberStyle

Specifies the number style for a list, footnotes and endnotes, page numbers.

Examples

Shows how to apply custom list formatting to paragraphs when using DocumentBuilder.

auto doc = MakeObject<Document>();
// Create a list based on one of the Microsoft Word list templates
SharedPtr<List> list = doc->get_Lists()->Add(Aspose::Words::Lists::ListTemplate::NumberDefault);
// Completely customize one list level
SharedPtr<ListLevel> listLevel = list->get_ListLevels()->idx_get(0);
listLevel->get_Font()->set_Color(System::Drawing::Color::get_Red());
listLevel->get_Font()->set_Size(24);
listLevel->set_NumberStyle(Aspose::Words::NumberStyle::OrdinalText);
listLevel->set_StartAt(21);
listLevel->set_NumberFormat(u"\x0000");
listLevel->set_NumberPosition(-36);
listLevel->set_TextPosition(144);
listLevel->set_TabPosition(144);
// Customize another list level
listLevel = list->get_ListLevels()->idx_get(1);
listLevel->set_NumberStyle(Aspose::Words::NumberStyle::Bullet);
listLevel->get_Font()->set_Name(u"Wingdings");
listLevel->get_Font()->set_Color(System::Drawing::Color::get_Blue());
listLevel->get_Font()->set_Size(24);
listLevel->set_NumberFormat(u"\xf0af");
// A bullet that looks like a star
listLevel->set_TrailingCharacter(Aspose::Words::Lists::ListTrailingCharacter::Space);
listLevel->set_NumberPosition(144);
// Now add some text that uses the list that we created
// It does not matter when to customize the list - before or after adding the paragraphs
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ListFormat()->set_List(list);
builder->Writeln(u"The quick brown fox...");
builder->Writeln(u"The quick brown fox...");
builder->get_ListFormat()->ListIndent();
builder->Writeln(u"jumped over the lazy dog.");
builder->Writeln(u"jumped over the lazy dog.");
builder->get_ListFormat()->ListOutdent();
builder->Writeln(u"The quick brown fox...");
builder->get_ListFormat()->RemoveNumbers();
builder->get_Document()->Save(ArtifactsDir + u"Lists.CreateCustomList.docx");
Enumerator
Arabic 

Arabic numbering (1, 2, 3, ...)

UppercaseRoman 

Upper case Roman (I, II, III, ...)

LowercaseRoman 

Lower case Roman (i, ii, iii, ...)

UppercaseLetter 

Upper case Letter (A, B, C, ...)

LowercaseLetter 

Lower case letter (a, b, c, ...)

Ordinal 

Ordinal (1st, 2nd, 3rd, ...)

Number 

Numbered (One, Two, Three, ...)

OrdinalText 

Ordinal (text) (First, Second, Third, ...)

Hex 

Hexadecimal: 8, 9, A, B, C, D, E, F, 10, 11, 12.

ChicagoManual 

Chicago Manual of Style: *, †, †

Kanji 

Ideograph-digital.

KanjiDigit 

Japanese counting.

AiueoHalfWidth 

Aiueo.

IrohaHalfWidth 

Iroha.

ArabicFullWidth 

Full-width Arabic: 1, 2, 3, 4.

ArabicHalfWidth 

Half-width Arabic: 1, 2, 3, 4.

KanjiTraditional 

Japanese legal.

KanjiTraditional2 

Japanese digital ten thousand.

NumberInCircle 

Enclosed circles.

DecimalFullWidth 

Decimal full width: 1, 2, 3, 4.

Aiueo 

Aiueo full width.

Iroha 

Iroha full width.

LeadingZero 

Leading Zero (01, 02,..., 09, 10, 11,..., 99, 100, 101,...)

Bullet 

Bullet (check the character code in the text)

Ganada 

Korean Ganada.

Chosung 

Korea Chosung.

GB1 

Enclosed full stop.

GB2 

Enclosed parenthesis.

GB3 

Enclosed circle Chinese.

GB4 

Ideograph enclosed circle.

Zodiac1 

Ideograph traditional.

Zodiac2 

Ideograph Zodiac.

Zodiac3 

Ideograph Zodiac traditional.

TradChinNum1 

Taiwanese counting.

TradChinNum2 

Ideograph legal traditional.

TradChinNum3 

Taiwanese counting thousand.

TradChinNum4 

Taiwanese digital.

SimpChinNum1 

Chinese counting.

SimpChinNum2 

Chinese legal simplified.

SimpChinNum3 

Chinese counting thousand.

SimpChinNum4 

Chinese (not implemented)

HanjaRead 

Korean digital.

HanjaReadDigit 

Korean counting.

Hangul 

Korea legal.

Hanja 

Korea digital2.

Hebrew1 

Hebrew-1.

Arabic1 

Arabic alpha.

Hebrew2 

Hebrew-2.

Arabic2 

Arabic abjad.

HindiLetter1 

Hindi vowels.

HindiLetter2 

Hindi consonants.

HindiArabic 

Hindi numbers.

HindiCardinalText 

Hindi descriptive (cardinals)

ThaiLetter 

Thai letters.

ThaiArabic 

Thai numbers.

ThaiCardinalText 

Thai descriptive (cardinals)

VietCardinalText 

Vietnamese descriptive (cardinals)

NumberInDash 

Page number format: - 1 -, - 2 -, - 3 -, - 4 -.

LowercaseRussian 

Lowercase Russian alphabet.

UppercaseRussian 

Uppercase Russian alphabet.

None 

No bullet or number.

Custom 

Custom number format. It is supported by DOCX format only.

◆ Orientation

Specifies page orientation.

Examples

Shows how to insert sections using DocumentBuilder, specify page setup for a section and reset page setup to defaults.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Modify the first section in the document
builder->get_PageSetup()->set_Orientation(Aspose::Words::Orientation::Landscape);
builder->get_PageSetup()->set_VerticalAlignment(Aspose::Words::PageVerticalAlignment::Center);
builder->Writeln(u"Section 1, landscape oriented and text vertically centered.");
// Start a new section and reset its formatting to defaults
builder->InsertBreak(Aspose::Words::BreakType::SectionBreakNewPage);
builder->get_PageSetup()->ClearFormatting();
builder->Writeln(u"Section 2, back to default Letter paper size, portrait orientation and top alignment.");
doc->Save(ArtifactsDir + u"PageSetup.ClearFormatting.docx");
Enumerator
Portrait 

Portrait page orientation (narrow and tall).

Landscape 

Landscape page orientation (wide and short).

◆ OutlineLevel

Specifies the outline level of a paragraph in the document.

Enumerator
Level1 

The paragraph is at the outline level 1 (topmost level).

Level2 

The paragraph is at the outline level 2.

Level3 

The paragraph is at the outline level 3.

Level4 

The paragraph is at the outline level 4.

Level5 

The paragraph is at the outline level 5.

Level6 

The paragraph is at the outline level 6.

Level7 

The paragraph is at the outline level 7.

Level8 

The paragraph is at the outline level 8.

Level9 

The paragraph is at the outline level 9.

BodyText 

The paragraph is at the level of the main text.

◆ PageBorderAppliesTo

Specifies which pages the page border is printed on.

See also
Aspose::Words::PageSetup
Aspose::Words::PageSetup::get_BorderAppliesTo
Examples

Shows how to create a page border that looks like a wide blue band at the top of the first page only.

auto doc = MakeObject<Document>();
SharedPtr<PageSetup> pageSetup = doc->get_Sections()->idx_get(0)->get_PageSetup();
pageSetup->set_BorderAlwaysInFront(false);
pageSetup->set_BorderDistanceFrom(Aspose::Words::PageBorderDistanceFrom::PageEdge);
pageSetup->set_BorderAppliesTo(Aspose::Words::PageBorderAppliesTo::FirstPage);
SharedPtr<Border> border = pageSetup->get_Borders()->idx_get(Aspose::Words::BorderType::Top);
border->set_LineStyle(Aspose::Words::LineStyle::Single);
border->set_LineWidth(30);
border->set_Color(System::Drawing::Color::get_Blue());
border->set_DistanceFromText(0);
doc->Save(ArtifactsDir + u"PageSetup.PageBorderProperties.docx");
Enumerator
AllPages 

Page border is shown on all pages of the section.

FirstPage 

Page border is shown on the first page of the section only.

OtherPages 

Page border is shown on all pages except the first page of the section.

◆ PageBorderDistanceFrom

Specifies the positioning of the page border relative to the page margin.

See also
Aspose::Words::PageSetup
Aspose::Words::PageSetup::get_BorderDistanceFrom
Examples

Shows how to create a page border that looks like a wide blue band at the top of the first page only.

auto doc = MakeObject<Document>();
SharedPtr<PageSetup> pageSetup = doc->get_Sections()->idx_get(0)->get_PageSetup();
pageSetup->set_BorderAlwaysInFront(false);
pageSetup->set_BorderDistanceFrom(Aspose::Words::PageBorderDistanceFrom::PageEdge);
pageSetup->set_BorderAppliesTo(Aspose::Words::PageBorderAppliesTo::FirstPage);
SharedPtr<Border> border = pageSetup->get_Borders()->idx_get(Aspose::Words::BorderType::Top);
border->set_LineStyle(Aspose::Words::LineStyle::Single);
border->set_LineWidth(30);
border->set_Color(System::Drawing::Color::get_Blue());
border->set_DistanceFromText(0);
doc->Save(ArtifactsDir + u"PageSetup.PageBorderProperties.docx");
Enumerator
Text 

Border position is measured from the page margin.

PageEdge 

Border position is measured from the page edge.

◆ PageVerticalAlignment

Specifies vertical justification of text on each page.

See also
Aspose::Words::PageSetup
Aspose::Words::PageSetup::get_VerticalAlignment
Examples

Shows how to insert sections using DocumentBuilder, specify page setup for a section and reset page setup to defaults.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Modify the first section in the document
builder->get_PageSetup()->set_Orientation(Aspose::Words::Orientation::Landscape);
builder->get_PageSetup()->set_VerticalAlignment(Aspose::Words::PageVerticalAlignment::Center);
builder->Writeln(u"Section 1, landscape oriented and text vertically centered.");
// Start a new section and reset its formatting to defaults
builder->InsertBreak(Aspose::Words::BreakType::SectionBreakNewPage);
builder->get_PageSetup()->ClearFormatting();
builder->Writeln(u"Section 2, back to default Letter paper size, portrait orientation and top alignment.");
doc->Save(ArtifactsDir + u"PageSetup.ClearFormatting.docx");
Enumerator
Bottom 

Text is aligned at the bottom of the page.

Center 

Text is aligned in the middle of the page.

Justify 

Text is spread to fill the page.

Top 

Text is aligned at the top of the page.

◆ PaperSize

Specifies paper size.

Examples

Shows how to adjust paper size, orientation, margins and other settings for a section.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_PageSetup()->set_PaperSize(Aspose::Words::PaperSize::Legal);
builder->get_PageSetup()->set_Orientation(Aspose::Words::Orientation::Landscape);
builder->get_PageSetup()->set_TopMargin(ConvertUtil::InchToPoint(1.0));
builder->get_PageSetup()->set_BottomMargin(ConvertUtil::InchToPoint(1.0));
builder->get_PageSetup()->set_LeftMargin(ConvertUtil::InchToPoint(1.5));
builder->get_PageSetup()->set_RightMargin(ConvertUtil::InchToPoint(1.5));
builder->get_PageSetup()->set_HeaderDistance(ConvertUtil::InchToPoint(0.2));
builder->get_PageSetup()->set_FooterDistance(ConvertUtil::InchToPoint(0.2));
builder->Writeln(u"Hello world.");
doc->Save(ArtifactsDir + u"PageSetup.PageMargins.docx");

Shows how to construct an Aspose Words document node by node.

auto doc = MakeObject<Document>();
// A newly created blank document still comes one section, one body and one paragraph
// Calling this method will remove all those nodes to completely empty the document
doc->RemoveAllChildren();
// This document now has no composite nodes that content can be added to
// If we wish to edit it, we will need to repopulate its node collection,
// which we will start to do with by creating a new Section node
auto section = MakeObject<Section>(doc);
// Append the section to the document
doc->AppendChild(section);
// Lets set some properties for the section
section->get_PageSetup()->set_SectionStart(Aspose::Words::SectionStart::NewPage);
section->get_PageSetup()->set_PaperSize(Aspose::Words::PaperSize::Letter);
// The section that we created is empty, lets populate it. The section needs at least the Body node
auto body = MakeObject<Body>(doc);
section->AppendChild(body);
// The body needs to have at least one paragraph
// Note that the paragraph has not yet been added to the document,
// but we have to specify the parent document
// The parent document is needed so the paragraph can correctly work
// with styles and other document-wide information
auto para = MakeObject<Paragraph>(doc);
body->AppendChild(para);
// We can set some formatting for the paragraph
para->get_ParagraphFormat()->set_StyleName(u"Heading 1");
para->get_ParagraphFormat()->set_Alignment(Aspose::Words::ParagraphAlignment::Center);
// So far we have one empty paragraph in the document
// The document is valid and can be saved, but lets add some text before saving
// Create a new run of text and add it to our paragraph
auto run = MakeObject<Run>(doc);
run->set_Text(u"Hello World!");
run->get_Font()->set_Color(System::Drawing::Color::get_Red());
para->AppendChild(run);
ASSERT_EQ(String(u"Hello World!") + ControlChar::SectionBreakChar, doc->GetText());
doc->Save(ArtifactsDir + u"Section.CreateFromScratch.docx");
Enumerator
A3 

297 x 420 mm.

A4 

210 x 297 mm.

A5 

148 x 210 mm.

B4 

250 x 353 mm.

B5 

176 x 250 mm.

Executive 

7.25 x 10.5 inches.

Folio 

8.5 x 13 inches.

Ledger 

17 x 11 inches.

Legal 

8.5 x 14 inches.

Letter 

8.5 x 11 inches.

EnvelopeDL 

110 x 220 mm.

Quarto 

8.47 x 10.83 inches.

Statement 

8.5 x 5.5 inches.

Tabloid 

11 x 17 inches.

Paper10x14 

10 x 14 inches.

Paper11x17 

11 x 17 inches.

Custom 

Custom paper size.

◆ ParagraphAlignment

Specifies text alignment in a paragraph.

Examples

Shows how to construct an Aspose Words document node by node.

auto doc = MakeObject<Document>();
// A newly created blank document still comes one section, one body and one paragraph
// Calling this method will remove all those nodes to completely empty the document
doc->RemoveAllChildren();
// This document now has no composite nodes that content can be added to
// If we wish to edit it, we will need to repopulate its node collection,
// which we will start to do with by creating a new Section node
auto section = MakeObject<Section>(doc);
// Append the section to the document
doc->AppendChild(section);
// Lets set some properties for the section
section->get_PageSetup()->set_SectionStart(Aspose::Words::SectionStart::NewPage);
section->get_PageSetup()->set_PaperSize(Aspose::Words::PaperSize::Letter);
// The section that we created is empty, lets populate it. The section needs at least the Body node
auto body = MakeObject<Body>(doc);
section->AppendChild(body);
// The body needs to have at least one paragraph
// Note that the paragraph has not yet been added to the document,
// but we have to specify the parent document
// The parent document is needed so the paragraph can correctly work
// with styles and other document-wide information
auto para = MakeObject<Paragraph>(doc);
body->AppendChild(para);
// We can set some formatting for the paragraph
para->get_ParagraphFormat()->set_StyleName(u"Heading 1");
para->get_ParagraphFormat()->set_Alignment(Aspose::Words::ParagraphAlignment::Center);
// So far we have one empty paragraph in the document
// The document is valid and can be saved, but lets add some text before saving
// Create a new run of text and add it to our paragraph
auto run = MakeObject<Run>(doc);
run->set_Text(u"Hello World!");
run->get_Font()->set_Color(System::Drawing::Color::get_Red());
para->AppendChild(run);
ASSERT_EQ(String(u"Hello World!") + ControlChar::SectionBreakChar, doc->GetText());
doc->Save(ArtifactsDir + u"Section.CreateFromScratch.docx");
Enumerator
Left 

Text is aligned to the left.

Center 

Text is centered horizontally.

Right 

Text is aligned to the right.

Justify 

Text is aligned to both left and right.

Distributed 

Text is evenly distributed.

ArabicMediumKashida 

Arabic only. Kashida length for text is extended to a medium length determined by the consumer.

ArabicHighKashida 

Arabic only. Kashida length for text is extended to its widest possible length.

ArabicLowKashida 

Arabic only. Kashida length for text is extended to a slightly longer length.

ThaiDistributed 

Thai only. Text is justified with an optimization for Thai.

◆ ProtectionType

Protection type for a document.

Examples

Shows how to protect a section so only editing in form fields is possible.

auto doc = MakeObject<Document>();
// Insert two sections with some text
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"Section 1. Unprotected.");
builder->InsertBreak(Aspose::Words::BreakType::SectionBreakContinuous);
builder->Writeln(u"Section 2. Protected.");
// Section protection only works when document protection is turned and only editing in form fields is allowed
doc->Protect(Aspose::Words::ProtectionType::AllowOnlyFormFields);
// By default, all sections are protected, but we can selectively turn protection off
doc->get_Sections()->idx_get(0)->set_ProtectedForForms(false);
doc->Save(ArtifactsDir + u"Section.Protect.docx");
Enumerator
AllowOnlyComments 

User can only modify comments in the document.

AllowOnlyFormFields 

User can only enter data in the form fields in the document.

AllowOnlyRevisions 

User can only add revision marks to the document.

ReadOnly 

No changes are allowed to the document. Available since Microsoft Word 2003.

NoProtection 

The document is not protected.

◆ RevisionsView

Allows to specify whether to work with the original or revised version of a document.

Examples

Shows how to get revised version of list label and list level formatting in a document.

auto doc = MakeObject<Document>(MyDir + u"Revisions at list levels.docx");
doc->UpdateListLabels();
// Switch to the revised version of the document
doc->set_RevisionsView(Aspose::Words::RevisionsView::Final);
for (auto revision : System::IterateOver(doc->get_Revisions()))
{
if (revision->get_ParentNode()->get_NodeType() == Aspose::Words::NodeType::Paragraph)
{
auto paragraph = System::DynamicCast<Aspose::Words::Paragraph>(revision->get_ParentNode());
if (paragraph->get_IsListItem())
{
// Print revised version of LabelString and ListLevel
System::Console::WriteLine(paragraph->get_ListLabel()->get_LabelString());
System::Console::WriteLine(paragraph->get_ListFormat()->get_ListLevel());
}
}
}
Enumerator
Original 

Specifies original version of a document.

Final 

Specifies revised version of a document.

◆ RevisionType

Specifies the type of change being tracked in Revision.

Examples

Shows how to check if a document has revisions.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Normal editing of the document does not count as a revision
builder->Write(u"This does not count as a revision. ");
ASSERT_FALSE(doc->get_HasRevisions());
// In order for our edits to count as revisions, we need to declare an author and start tracking them
doc->StartTrackRevisions(u"John Doe", System::DateTime::get_Now());
builder->Write(u"This is revision #1. ");
// This flag corresponds to the "Track Changes" option being turned on in Microsoft Word, to track the editing manually
// done there and not the programmatic changes we are about to do here
ASSERT_FALSE(doc->get_TrackRevisions());
// As well as nodes in the document, revisions get referenced in this collection
ASSERT_TRUE(doc->get_HasRevisions());
ASSERT_EQ(1, doc->get_Revisions()->get_Count());
SharedPtr<Revision> revision = doc->get_Revisions()->idx_get(0);
ASSERT_EQ(u"John Doe", revision->get_Author());
ASSERT_EQ(u"This is revision #1. ", revision->get_ParentNode()->GetText());
ASSERT_EQ(Aspose::Words::RevisionType::Insertion, revision->get_RevisionType());
ASSERT_EQ(revision->get_DateTime().get_Date(), System::DateTime::get_Now().get_Date());
ASPOSE_ASSERT_EQ(doc->get_Revisions()->get_Groups()->idx_get(0), revision->get_Group());
// Deleting content also counts as a revision
// The most recent revisions are put at the start of the collection
doc->get_FirstSection()->get_Body()->get_FirstParagraph()->get_Runs()->idx_get(0)->Remove();
ASSERT_EQ(Aspose::Words::RevisionType::Deletion, doc->get_Revisions()->idx_get(0)->get_RevisionType());
ASSERT_EQ(2, doc->get_Revisions()->get_Count());
// Insert revisions are treated as document text by the GetText() method before they are accepted,
// since they are still nodes with text and are in the body
ASSERT_EQ(u"This does not count as a revision. This is revision #1.", doc->GetText().Trim());
// Accepting the deletion revision will assimilate it into the paragraph text and remove it from the collection
doc->get_Revisions()->idx_get(0)->Accept();
ASSERT_EQ(1, doc->get_Revisions()->get_Count());
// Once the delete revision is accepted, the nodes that it concerns are removed and their text will not show up here
ASSERT_EQ(u"This is revision #1.", doc->GetText().Trim());
// The second insertion revision is now at index 0, which we can reject to ignore and discard it
doc->get_Revisions()->idx_get(0)->Reject();
ASSERT_EQ(0, doc->get_Revisions()->get_Count());
ASSERT_EQ(u"", doc->GetText().Trim());
Enumerator
Insertion 

New content was inserted in the document.

Deletion 

Content was removed from the document.

FormatChange 

Change of formatting was applied to the parent node.

StyleDefinitionChange 

Change of formatting was applied to the parent style.

Moving 

Content was moved in the document.

◆ RunPrExpandFlags

RunPrExpandFlags enumeration.

Enumerator
Normal 
DocumentDefaults 
IgnoreNormalFontSize 
IgnoreHyperlinkCharStyle 
Revised 
AfterChanges 
GlobalDefaults 
NoTableStyle 
NoDirectFormatting 
NoParaStyle 
NoChangeCommentSize 
Layout 

◆ SaveFormat

Indicates the format in which the document is saved.

See also
Aspose::Words::Document::Save(System::SharedPtr<System::IO::Stream>, Aspose::Words::SaveFormat)
Aspose::Words::Saving::SaveOptions
Examples

Shows how to convert from DOCX to HTML format.

auto doc = MakeObject<Document>(MyDir + u"Document.docx");
doc->Save(ArtifactsDir + u"Document.ConvertToHtml.html", Aspose::Words::SaveFormat::Html);
Enumerator
Unknown 

Default, invalid value for file format.

Doc 

Saves the document in the Microsoft Word 97 - 2007 Document format.

Dot 

Saves the document in the Microsoft Word 97 - 2007 Template format.

Docx 

Saves the document as an Office Open XML WordprocessingML Document (macro-free).

Docm 

Saves the document as an Office Open XML WordprocessingML Macro-Enabled Document.

Dotx 

Saves the document as an Office Open XML WordprocessingML Template (macro-free).

Dotm 

Saves the document as an Office Open XML WordprocessingML Macro-Enabled Template.

FlatOpc 

Saves the document as an Office Open XML WordprocessingML stored in a flat XML file instead of a ZIP package.

FlatOpcMacroEnabled 

Saves the document as an Office Open XML WordprocessingML Macro-Enabled Document stored in a flat XML file instead of a ZIP package.

FlatOpcTemplate 

Saves the document as an Office Open XML WordprocessingML Template (macro-free) stored in a flat XML file instead of a ZIP package.

FlatOpcTemplateMacroEnabled 

Saves the document as an Office Open XML WordprocessingML Macro-Enabled Template stored in a flat XML file instead of a ZIP package.

Rtf 

Saves the document in the RTF format. All characters above 7-bits are escaped as hexadecimal or Unicode characters.

WordML 

Saves the document in the Microsoft Word 2003 WordprocessingML format.

Pdf 

Saves the document as PDF (Adobe Portable Document) format.

Xps 

Saves the document in the XPS (XML Paper Specification) format.

XamlFixed 

Saves the document in the Extensible Application Markup Language (XAML) format as a fixed document.

Svg 

Saves the document in the Svg (Scalable Vector Graphics) format.

HtmlFixed 

Saves the document in the HTML format using absolutely positioned elements.

OpenXps 

Saves the document in the OpenXPS (Ecma-388) format.

Ps 

Saves the document in the PS (PostScript) format.

Pcl 

Saves the document in the PCL (Printer Control Language) format.

Html 

Saves the document in the HTML format.

Mhtml 

Saves the document in the MHTML (Web archive) format.

Epub 

Saves the document in the IDPF EPUB format.

Odt 

Saves the document as an ODF Text Document.

Ott 

Saves the document as an ODF Text Document Template.

Text 

Saves the document in the plain text format.

XamlFlow 

Beta. Saves the document in the Extensible Application Markup Language (XAML) format as a flow document.

XamlFlowPack 

Beta. Saves the document in the Extensible Application Markup Language (XAML) package format as a flow document.

Markdown 

Saves the document in the Markdown format.

Tiff 

Renders a page or pages of the document and saves them into a single or multipage TIFF file.

Png 

Renders a page of the document and saves it as a PNG file.

Bmp 

Renders a page of the document and saves it as a BMP file.

Emf 

Renders a page of the document and saves it as a vector EMF (Enhanced Meta File) file.

Jpeg 

Renders a page of the document and saves it as a JPEG file.

Gif 

Renders a page of the document and saves it as a GIF file.

◆ SectionLayoutMode

Specifies the layout mode for a section allowing to define the document grid behavior.

Examples

Shows how to create headers and footers different for first, even and odd pages using DocumentBuilder.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<PageSetup> pageSetup = builder->get_PageSetup();
pageSetup->set_DifferentFirstPageHeaderFooter(true);
pageSetup->set_OddAndEvenPagesHeaderFooter(true);
pageSetup->set_LayoutMode(Aspose::Words::SectionLayoutMode::LineGrid);
pageSetup->set_CharactersPerLine(1);
pageSetup->set_LinesPerPage(1);
builder->MoveToHeaderFooter(Aspose::Words::HeaderFooterType::HeaderFirst);
builder->Writeln(u"First page header.");
builder->MoveToHeaderFooter(Aspose::Words::HeaderFooterType::HeaderEven);
builder->Writeln(u"Even pages header.");
builder->MoveToHeaderFooter(Aspose::Words::HeaderFooterType::HeaderPrimary);
builder->Writeln(u"Odd pages header.");
// Move back to the main story of the first section
builder->MoveToSection(0);
builder->Writeln(u"Text page 1.");
builder->Writeln(u"Text page 2.");
builder->Writeln(u"Text page 3.");
doc->Save(ArtifactsDir + u"PageSetup.DifferentHeaders.docx");
Enumerator
Default 

Specifies that no document grid shall be applied to the contents of the corresponding section in the document.

Grid 

Specifies that the corresponding section shall have both the additional line pitch and character pitch added to each line and character within it in order to maintain a specific number of lines per page and characters per line. Characters will not be automatically aligned with gridlines on typing.

LineGrid 

Specifies that the corresponding section shall have additional line pitch added to each line within it in order to maintain the specified number of lines per page.

SnapToChars 

Specifies that the corresponding section shall have both the additional line pitch and character pitch added to each line and character within it in order to maintain a specific number of lines per page and characters per line. Characters will be automatically aligned with gridlines on typing.

◆ SectionStart

The type of break at the beginning of the section.

Examples

Shows how to specify how the section starts, from a new page, on the same page or other.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Add text to the first section and that comes with a blank document,
// then add a new section that starts a new page and give it text as well
builder->Writeln(u"This text is in section 1.");
builder->InsertBreak(Aspose::Words::BreakType::SectionBreakNewPage);
builder->Writeln(u"This text is in section 2.");
// Section break types determine how a new section gets split from the previous section
// By inserting a "SectionBreakNewPage" type section break, we've set this section's SectionStart value to "NewPage"
ASSERT_EQ(Aspose::Words::SectionStart::NewPage, doc->get_Sections()->idx_get(1)->get_PageSetup()->get_SectionStart());
// Insert a new column section the same way
builder->InsertBreak(Aspose::Words::BreakType::SectionBreakNewColumn);
builder->Writeln(u"This text is in section 3.");
ASSERT_EQ(Aspose::Words::SectionStart::NewColumn, doc->get_Sections()->idx_get(2)->get_PageSetup()->get_SectionStart());
// We can change the types of section breaks by assigning different values to each section's SectionStart
// Setting their values to "Continuous" will put no visible breaks between sections
// and will leave all the content of this document on one page
doc->get_Sections()->idx_get(1)->get_PageSetup()->set_SectionStart(Aspose::Words::SectionStart::Continuous);
doc->get_Sections()->idx_get(2)->get_PageSetup()->set_SectionStart(Aspose::Words::SectionStart::Continuous);
doc->Save(ArtifactsDir + u"PageSetup.SetSectionStart.docx");

Shows how to construct an Aspose Words document node by node.

auto doc = MakeObject<Document>();
// A newly created blank document still comes one section, one body and one paragraph
// Calling this method will remove all those nodes to completely empty the document
doc->RemoveAllChildren();
// This document now has no composite nodes that content can be added to
// If we wish to edit it, we will need to repopulate its node collection,
// which we will start to do with by creating a new Section node
auto section = MakeObject<Section>(doc);
// Append the section to the document
doc->AppendChild(section);
// Lets set some properties for the section
section->get_PageSetup()->set_SectionStart(Aspose::Words::SectionStart::NewPage);
section->get_PageSetup()->set_PaperSize(Aspose::Words::PaperSize::Letter);
// The section that we created is empty, lets populate it. The section needs at least the Body node
auto body = MakeObject<Body>(doc);
section->AppendChild(body);
// The body needs to have at least one paragraph
// Note that the paragraph has not yet been added to the document,
// but we have to specify the parent document
// The parent document is needed so the paragraph can correctly work
// with styles and other document-wide information
auto para = MakeObject<Paragraph>(doc);
body->AppendChild(para);
// We can set some formatting for the paragraph
para->get_ParagraphFormat()->set_StyleName(u"Heading 1");
para->get_ParagraphFormat()->set_Alignment(Aspose::Words::ParagraphAlignment::Center);
// So far we have one empty paragraph in the document
// The document is valid and can be saved, but lets add some text before saving
// Create a new run of text and add it to our paragraph
auto run = MakeObject<Run>(doc);
run->set_Text(u"Hello World!");
run->get_Font()->set_Color(System::Drawing::Color::get_Red());
para->AppendChild(run);
ASSERT_EQ(String(u"Hello World!") + ControlChar::SectionBreakChar, doc->GetText());
doc->Save(ArtifactsDir + u"Section.CreateFromScratch.docx");
Enumerator
Continuous 

The new section starts on the same page as the previous section.

NewColumn 

The section starts from a new column.

NewPage 

The section starts from a new page.

EvenPage 

The section starts on a new even page.

OddPage 

The section starts on a new odd page.

◆ StoryType

Text of a Word document is stored in stories. StoryType identifies a story.

Examples

Shows how to clear a body of inline shapes.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Use a DocumentBuilder to insert a shape
// This is an inline shape, which has a parent Paragraph, which is in turn a child of the Body
builder->InsertShape(Aspose::Words::Drawing::ShapeType::Cube, 100.0, 100.0);
ASSERT_EQ(1, doc->GetChildNodes(Aspose::Words::NodeType::Shape, true)->get_Count());
// We can delete all such shapes from the Body, affecting all child Paragraphs
ASSERT_EQ(Aspose::Words::StoryType::MainText, doc->get_FirstSection()->get_Body()->get_StoryType());
doc->get_FirstSection()->get_Body()->DeleteShapes();
ASSERT_EQ(0, doc->GetChildNodes(Aspose::Words::NodeType::Shape, true)->get_Count());
Enumerator
None 

Default value. There is no such story in the document.

MainText 

Contains the main text of the document, represented by Body.

Footnotes 

Contains footnote text, represented by Footnote.

Endnotes 

Contains endnotes text, represented by Footnote.

Comments 

Contains document comments (annotations), represented by Comment.

Textbox 

Contains shape or textbox text, represented by Shape.

EvenPagesHeader 

Contains text of the even pages header, represented by HeaderFooter.

PrimaryHeader 

Contains text of the primary header. When header is different for odd and even pages, contains text of the odd pages header. Represented by HeaderFooter.

EvenPagesFooter 

Contains text of the even pages footer, represented by HeaderFooter.

PrimaryFooter 

Contains text of the primary footer. When footer is different for odd and even pages, contains text of the odd pages footer. Represented by HeaderFooter.

FirstPageHeader 

Contains text of the first page header, represented by HeaderFooter.

FirstPageFooter 

Contains text of the first page footer, represented by HeaderFooter.

FootnoteSeparator 

Contains the text of the footnote separator, represented by FootnoteSeparator.

FootnoteContinuationSeparator 

Contains the text of the footnote continuation separator, represented by FootnoteSeparator.

FootnoteContinuationNotice 

Contains the text of the footnote continuation notice separator, represented by FootnoteSeparator.

EndnoteSeparator 

Contains the text of the endnote separator, represented by FootnoteSeparator.

EndnoteContinuationSeparator 

Contains the text of the endnote continuation separator, represented by FootnoteSeparator.

EndnoteContinuationNotice 

Contains the text of the endnote continuation notice separator, represented by FootnoteSeparator.

◆ StyleIdentifier

Locale independent style identifier.

The names of built-in styles in MS Word are localized for different languages. Using a style identifier you can find the correct style regardless of the document language.

All user defined styles are assigned the StyleIdentifier.User value.

Examples

Shows how to use style name or identifier to find text formatted with a specific character style and apply different character style.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert text with two styles that will be replaced by another style
builder->get_Font()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Emphasis);
builder->Writeln(u"Text originally in \"Emphasis\" style");
builder->get_Font()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::IntenseEmphasis);
builder->Writeln(u"Text originally in \"Intense Emphasis\" style");
// Loop through every run node
for (auto run : System::IterateOver(doc->GetChildNodes(Aspose::Words::NodeType::Run, true)->LINQ_OfType<SharedPtr<Run> >()))
{
// If the run's text is of the "Emphasis" style, referenced by name, change the style to "Strong"
if (System::ObjectExt::Equals(run->get_Font()->get_StyleName(), u"Emphasis"))
{
run->get_Font()->set_StyleName(u"Strong");
}
// If the run's text style is "Intense Emphasis", change it to "Strong" also, but this time reference using a StyleIdentifier
if (System::ObjectExt::Equals(run->get_Font()->get_StyleIdentifier(), Aspose::Words::StyleIdentifier::IntenseEmphasis))
{
run->get_Font()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Strong);
}
}
doc->Save(ArtifactsDir + u"Font.ChangeStyle.docx");
Enumerator
BookTitle 
CommentReference 

The Annotation (Comment) Reference style.

DefaultParagraphFont 

The Default Paragraph Font style.

Emphasis 
EndnoteReference 

The Endnote Reference style.

FollowedHyperlink 
FootnoteReference 

The Footnote Reference style.

HtmlAcronym 
HtmlCite 
HtmlCode 
HtmlDefinition 
HtmlKeyboard 
HtmlSample 
HtmlTypewriter 
HtmlVariable 
Hyperlink 

The Hyperlink style.

IntenseEmphasis 
IntenseReference 
LineNumber 

The Line Number style.

PageNumber 

The Page Number style.

PlaceholderText 
Strong 
SubtleEmphasis 
SubtleReference 
BalloonText 
BodyText 

The Body Text style.

BodyText2 
BodyText3 
BodyText1I 
BodyText1I2 
BodyTextInd 
BodyTextInd2 
BodyTextInd3 
Closing 
CommentSubject 
CommentText 

The Annotation (Comment) Text style.

Date 
DocumentMap 
EmailSignature 
EndnoteText 

The Endnote Text style.

Footer 

The Footer style.

FootnoteText 

The Footnote Text style.

Header 

The Header style.

Heading1 

The Heading 1 style.

Heading2 

The Heading 2 style.

Heading3 

The Heading 3 style.

Heading4 

The Heading 4 style.

Heading5 

The Heading 5 style.

Heading6 

The Heading 6 style.

Heading7 

The Heading 7 style.

Heading8 

The Heading 8 style.

Heading9 

The Heading 9 style.

HtmlAddress 
HtmlTopOfForm 
HtmlBottomOfForm 
HtmlPreformatted 
IntenseQuote 
Macro 
MessageHeader 
NoteHeading 
PlainText 
Quote 
Salutation 
Signature 
Subtitle 
Title 

The Title style.

Bibliography 
BlockText 
Caption 
EnvelopeAddress 

The Envelope Address style.

EnvelopeReturn 

The Envelope Return style.

Index1 
Index2 
Index3 
Index4 
Index5 
Index6 
Index7 
Index8 
Index9 
IndexHeading 

The Index Heading style.

List 

The List style.

List2 
List3 
List4 
List5 
ListBullet 

The List Bullet style.

ListBullet2 
ListBullet3 
ListBullet4 
ListBullet5 
ListContinue 
ListContinue2 
ListContinue3 
ListContinue4 
ListContinue5 
ListNumber 

The List Number style.

ListNumber2 
ListNumber3 
ListNumber4 
ListNumber5 
ListParagraph 
NoSpacing 
Normal 

The Normal style.

NormalWeb 
NormalIndent 

The Normal Indent style.

TableOfAuthorities 
TableOfFigures 

The Table of Figures style.

ToaHeading 
Toc1 
Toc2 
Toc3 
Toc4 
Toc5 
Toc6 
Toc7 
Toc8 
Toc9 
TocHeading 
Revision 
OutlineList1 

The 1 / a / i style.

OutlineList2 

The 1 / 1.1 / 1.1.1 style.

OutlineList3 

The Article / Section style.

NoList 
ColorfulGrid 
ColorfulGridAccent1 
ColorfulGridAccent2 
ColorfulGridAccent3 
ColorfulGridAccent4 
ColorfulGridAccent5 
ColorfulGridAccent6 
ColorfulList 
ColorfulListAccent1 
ColorfulListAccent2 
ColorfulListAccent3 
ColorfulListAccent4 
ColorfulListAccent5 
ColorfulListAccent6 
ColorfulShading 
ColorfulShadingAccent1 
ColorfulShadingAccent2 
ColorfulShadingAccent3 
ColorfulShadingAccent4 
ColorfulShadingAccent5 
ColorfulShadingAccent6 
DarkList 
DarkListAccent1 
DarkListAccent2 
DarkListAccent3 
DarkListAccent4 
DarkListAccent5 
DarkListAccent6 
LightGrid 
LightGridAccent1 
LightGridAccent2 
LightGridAccent3 
LightGridAccent4 
LightGridAccent5 
LightGridAccent6 
LightList 
LightListAccent1 
LightListAccent2 
LightListAccent3 
LightListAccent4 
LightListAccent5 
LightListAccent6 
LightShading 
LightShadingAccent1 
LightShadingAccent2 
LightShadingAccent3 
LightShadingAccent4 
LightShadingAccent5 
LightShadingAccent6 
MediumGrid1 
MediumGrid1Accent1 
MediumGrid1Accent2 
MediumGrid1Accent3 
MediumGrid1Accent4 
MediumGrid1Accent5 
MediumGrid1Accent6 
MediumGrid2 
MediumGrid2Accent1 
MediumGrid2Accent2 
MediumGrid2Accent3 
MediumGrid2Accent4 
MediumGrid2Accent5 
MediumGrid2Accent6 
MediumGrid3 
MediumGrid3Accent1 
MediumGrid3Accent2 
MediumGrid3Accent3 
MediumGrid3Accent4 
MediumGrid3Accent5 
MediumGrid3Accent6 
MediumList1 
MediumList1Accent1 
MediumList1Accent2 
MediumList1Accent3 
MediumList1Accent4 
MediumList1Accent5 
MediumList1Accent6 
MediumList2 
MediumList2Accent1 
MediumList2Accent2 
MediumList2Accent3 
MediumList2Accent4 
MediumList2Accent5 
MediumList2Accent6 
MediumShading1 
MediumShading1Accent1 
MediumShading1Accent2 
MediumShading1Accent3 
MediumShading1Accent4 
MediumShading1Accent5 
MediumShading1Accent6 
MediumShading2 
MediumShading2Accent1 
MediumShading2Accent2 
MediumShading2Accent3 
MediumShading2Accent4 
MediumShading2Accent5 
MediumShading2Accent6 
Table3DEffects1 
Table3DEffects2 
Table3DEffects3 
TableClassic1 
TableClassic2 
TableClassic3 
TableClassic4 
TableColorful1 
TableColorful2 
TableColorful3 
TableColumns1 
TableColumns2 
TableColumns3 
TableColumns4 
TableColumns5 
TableContemporary 
TableElegant 
TableGrid 
TableGrid1 
TableGrid2 
TableGrid3 
TableGrid4 
TableGrid5 
TableGrid6 
TableGrid7 
TableGrid8 
TableList1 
TableList2 
TableList3 
TableList4 
TableList5 
TableList6 
TableList7 
TableList8 
TableNormal 
TableProfessional 
TableSimple1 
TableSimple2 
TableSimple3 
TableSubtle1 
TableSubtle2 
TableTheme 
TableWeb1 
TableWeb2 
TableWeb3 
PlainTable1 

Plain Table 1.

PlainTable2 

Plain Table 2.

PlainTable3 

Plain Table 3.

PlainTable4 

Plain Table 4.

PlainTable5 

Plain Table 5.

TableGridLight 

Table Grid Light.

GridTable1Light 

Grid Table 1 Light.

GridTable2 

Grid Table 2.

GridTable3 

Grid Table 3.

GridTable4 

Grid Table 4.

GridTable5Dark 

Grid Table 5 Dark.

GridTable6Colorful 

Grid Table 6 Colorful.

GridTable7Colorful 

Grid Table 7 Colorful.

GridTable1LightAccent1 

Grid Table 1 Light - Accent 1.

GridTable2Accent1 

Grid Table 2 - Accent 1.

GridTable3Accent1 

Grid Table 3 - Accent 1.

GridTable4Accent1 

Grid Table 4 - Accent 1.

GridTable5DarkAccent1 

Grid Table 5 Dark - Accent 1.

GridTable6ColorfulAccent1 

Grid Table 6 Colorful - Accent 1.

GridTable7ColorfulAccent1 

Grid Table 7 Colorful - Accent 1.

GridTable1LightAccent2 

Grid Table 1 Light - Accent 2.

GridTable2Accent2 

Grid Table 2 - Accent 2.

GridTable3Accent2 

Grid Table 3 - Accent 2.

GridTable4Accent2 

Grid Table 4 - Accent 2.

GridTable5DarkAccent2 

Grid Table 5 Dark - Accent 2.

GridTable6ColorfulAccent2 

Grid Table 6 Colorful - Accent 2.

GridTable7ColorfulAccent2 

Grid Table 7 Colorful - Accent 2.

GridTable1LightAccent3 

Grid Table 1 Light - Accent 3.

GridTable2Accent3 

Grid Table 2 - Accent 3.

GridTable3Accent3 

Grid Table 3 - Accent 3.

GridTable4Accent3 

Grid Table 4 - Accent 3.

GridTable5DarkAccent3 

Grid Table 5 Dark - Accent 3.

GridTable6ColorfulAccent3 

Grid Table 6 Colorful - Accent 3.

GridTable7ColorfulAccent3 

Grid Table 7 Colorful - Accent 3.

GridTable1LightAccent4 

Grid Table 1 Light - Accent 4.

GridTable2Accent4 

Grid Table 2 - Accent 4.

GridTable3Accent4 

Grid Table 3 - Accent 4.

GridTable4Accent4 

Grid Table 4 - Accent 4.

GridTable5DarkAccent4 

Grid Table 5 Dark - Accent 4.

GridTable6ColorfulAccent4 

Grid Table 6 Colorful - Accent 4.

GridTable7ColorfulAccent4 

Grid Table 7 Colorful - Accent 4.

GridTable1LightAccent5 

Grid Table 1 Light - Accent 5.

GridTable2Accent5 

Grid Table 2 - Accent 5.

GridTable3Accent5 

Grid Table 3 - Accent 5.

GridTable4Accent5 

Grid Table 4 - Accent 5.

GridTable5DarkAccent5 

Grid Table 5 Dark - Accent 5.

GridTable6ColorfulAccent5 

Grid Table 6 Colorful - Accent 5.

GridTable7ColorfulAccent5 

Grid Table 7 Colorful - Accent 5.

GridTable1LightAccent6 

Grid Table 1 Light - Accent 6.

GridTable2Accent6 

Grid Table 2 - Accent 6.

GridTable3Accent6 

Grid Table 3 - Accent 6.

GridTable4Accent6 

Grid Table 4 - Accent 6.

GridTable5DarkAccent6 

Grid Table 5 Dark - Accent 6.

GridTable6ColorfulAccent6 

Grid Table 6 Colorful - Accent 6.

GridTable7ColorfulAccent6 

Grid Table 7 Colorful - Accent 6.

ListTable1Light 

List Table 1 Light.

ListTable2 

List Table 2.

ListTable3 

List Table 3.

ListTable4 

List Table 4.

ListTable5Dark 

List Table 5 Dark.

ListTable6Colorful 

List Table 6 Colorful.

ListTable7Colorful 

List Table 7 Colorful.

ListTable1LightAccent1 

List Table 1 Light - Accent 1.

ListTable2Accent1 

List Table 2 - Accent 1.

ListTable3Accent1 

List Table 3 - Accent 1.

ListTable4Accent1 

List Table 4 - Accent 1.

ListTable5DarkAccent1 

List Table 5 Dark - Accent 1.

ListTable6ColorfulAccent1 

List Table 6 Colorful - Accent 1.

ListTable7ColorfulAccent1 

List Table 7 Colorful - Accent 1.

ListTable1LightAccent2 

List Table 1 Light - Accent 2.

ListTable2Accent2 

List Table 2 - Accent 2.

ListTable3Accent2 

List Table 3 - Accent 2.

ListTable4Accent2 

List Table 4 - Accent 2.

ListTable5DarkAccent2 

List Table 5 Dark - Accent 2.

ListTable6ColorfulAccent2 

List Table 6 Colorful - Accent 2.

ListTable7ColorfulAccent2 

List Table 7 Colorful - Accent 2.

ListTable1LightAccent3 

List Table 1 Light - Accent 3.

ListTable2Accent3 

List Table 2 - Accent 3.

ListTable3Accent3 

List Table 3 - Accent 3.

ListTable4Accent3 

List Table 4 - Accent 3.

ListTable5DarkAccent3 

List Table 5 Dark - Accent 3.

ListTable6ColorfulAccent3 

List Table 6 Colorful - Accent 3.

ListTable7ColorfulAccent3 

List Table 7 Colorful - Accent 3.

ListTable1LightAccent4 

List Table 1 Light - Accent 4.

ListTable2Accent4 

List Table 2 - Accent 4.

ListTable3Accent4 

List Table 3 - Accent 4.

ListTable4Accent4 

List Table 4 - Accent 4.

ListTable5DarkAccent4 

List Table 5 Dark - Accent 4.

ListTable6ColorfulAccent4 

List Table 6 Colorful - Accent 4.

ListTable7ColorfulAccent4 

List Table 7 Colorful - Accent 4.

ListTable1LightAccent5 

List Table 1 Light - Accent 5.

ListTable2Accent5 

List Table 2 - Accent 5.

ListTable3Accent5 

List Table 3 - Accent 5.

ListTable4Accent5 

List Table 4 - Accent 5.

ListTable5DarkAccent5 

List Table 5 Dark - Accent 5.

ListTable6ColorfulAccent5 

List Table 6 Colorful - Accent 5.

ListTable7ColorfulAccent5 

List Table 7 Colorful - Accent 5.

ListTable1LightAccent6 

List Table 1 Light - Accent 6.

ListTable2Accent6 

List Table 2 - Accent 6.

ListTable3Accent6 

List Table 3 - Accent 6.

ListTable4Accent6 

List Table 4 - Accent 6.

ListTable5DarkAccent6 

List Table 5 Dark - Accent 6.

ListTable6ColorfulAccent6 

List Table 6 Colorful - Accent 6.

ListTable7ColorfulAccent6 

List Table 7 Colorful - Accent 6.

User 

A user defined style.

Nil 

Reserved for internal use.

◆ StyleType

Represents type of the style.

Examples

Shows how to create a list style and use it in a document.

auto doc = MakeObject<Document>();
// Create a new list style
// List formatting associated with this list style is default numbered
SharedPtr<Style> listStyle = doc->get_Styles()->Add(Aspose::Words::StyleType::List, u"MyListStyle");
// This list defines the formatting of the list style
// Note this list can not be used directly to apply formatting to paragraphs (see below)
SharedPtr<List> list1 = listStyle->get_List();
// Check some basic rules about the list that defines a list style
ASSERT_TRUE(list1->get_IsListStyleDefinition());
ASSERT_FALSE(list1->get_IsListStyleReference());
ASSERT_TRUE(list1->get_IsMultiLevel());
ASPOSE_ASSERT_EQ(listStyle, list1->get_Style());
// Modify formatting of the list style to our liking
for (auto level : System::IterateOver(list1->get_ListLevels()))
{
level->get_Font()->set_Name(u"Verdana");
level->get_Font()->set_Color(System::Drawing::Color::get_Blue());
level->get_Font()->set_Bold(true);
}
// Add some text to our document and use the list style
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"Using list style first time:");
// This creates a list based on the list style
SharedPtr<List> list2 = doc->get_Lists()->Add(listStyle);
// Check some basic rules about the list that references a list style
ASSERT_FALSE(list2->get_IsListStyleDefinition());
ASSERT_TRUE(list2->get_IsListStyleReference());
ASPOSE_ASSERT_EQ(listStyle, list2->get_Style());
// Apply the list that references the list style
builder->get_ListFormat()->set_List(list2);
builder->Writeln(u"Item 1");
builder->Writeln(u"Item 2");
builder->get_ListFormat()->RemoveNumbers();
builder->Writeln(u"Using list style second time:");
// Create and apply another list based on the list style
SharedPtr<List> list3 = doc->get_Lists()->Add(listStyle);
builder->get_ListFormat()->set_List(list3);
builder->Writeln(u"Item 1");
builder->Writeln(u"Item 2");
builder->get_ListFormat()->RemoveNumbers();
builder->get_Document()->Save(ArtifactsDir + u"Lists.CreateAndUseListStyle.docx");
Enumerator
Paragraph 

The style is a paragraph style.

Character 

The style is a character style.

Table 

The style is a table style.

List 

The style is a list style.

◆ TabAlignment

Specifies the alignment/type of a tab stop.

Enumerator
Left 

Left-aligns the text after the tab stop.

Center 

Centers the text around the tab stop.

Right 

Right-aligns the text at the tab stop.

Decimal 

Aligns the text at the decimal dot.

Bar 

Draws a vertical bar at the tab stop position.

List 

The tab is a delimiter between the number/bullet and text in a list item.

Clear 

Clears any tab stop in this position.

◆ TabLeader

Specifies the type of the leader line displayed under the tab character.

Enumerator
None 

No leader line is displayed.

Dots 

The leader line is made up from dots.

Dashes 

The leader line is made up from dashes.

Line 

The leader line is a single line.

Heavy 

The leader line is a single thick line.

MiddleDot 

The leader line is made up from middle-dots.

◆ TextDmlEffect

Dml text effect for text runs.

Enumerator
Glow 

Glow effect, in which a color blurred outline is added outside the edges of the object.

Fill 

Fill overlay effect.

Shadow 

Shadow effect.

Outline 

Outline effect.

Effect3D 

3D effect.

Reflection 

Reflection effect.

◆ TextEffect

Animation effect for text runs.

Enumerator
None 
LasVegasLights 
BlinkingBackground 
SparkleText 
MarchingBlackAnts 
MarchingRedAnts 
Shimmer 

◆ TextOrientation

Specifies orientation of text on a page, in a table cell or a text frame.

Examples

Shows how to build a formatted table that contains 2 rows and 2 columns.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Table> table = builder->StartTable();
// Insert a cell
builder->InsertCell();
builder->get_CellFormat()->set_VerticalAlignment(Aspose::Words::Tables::CellVerticalAlignment::Center);
builder->Write(u"This is row 1 cell 1");
// Use fixed column widths
// Insert a cell
builder->InsertCell();
builder->Write(u"This is row 1 cell 2");
builder->EndRow();
// Insert a cell
builder->InsertCell();
// Apply new row formatting
builder->get_RowFormat()->set_Height(100);
builder->get_RowFormat()->set_HeightRule(Aspose::Words::HeightRule::Exactly);
builder->get_CellFormat()->set_Orientation(Aspose::Words::TextOrientation::Upward);
builder->Write(u"This is row 2 cell 1");
// Insert a cell
builder->InsertCell();
builder->get_CellFormat()->set_Orientation(Aspose::Words::TextOrientation::Downward);
builder->Write(u"This is row 2 cell 2");
builder->EndRow();
builder->EndTable();
Enumerator
Horizontal 

Text is arranged horizontally (lr-tb).

Downward 

Text is rotated 90 degrees to the right to appear from top to bottom (tb-rl).

Upward 

Text is rotated 90 degrees to the left to appear from bottom to top (bt-lr).

HorizontalRotatedFarEast 

Text is arranged horizontally, but Far East characters are rotated 90 degrees to the left (lr-tb-v).

VerticalFarEast 

Far East characters appear vertical, other text is rotated 90 degrees to the right to appear from top to bottom (tb-rl-v).

VerticalRotatedFarEast 

Far East characters appear vertical, other text is rotated 90 degrees to the right to appear from top to bottom vertically, then left to right horizontally (tb-lr-v).

◆ TextureIndex

Specifies shading texture.

Examples

Shows how to apply borders and shading to a paragraph.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Set paragraph borders
SharedPtr<BorderCollection> borders = builder->get_ParagraphFormat()->get_Borders();
borders->set_DistanceFromText(20);
borders->idx_get(Aspose::Words::BorderType::Left)->set_LineStyle(Aspose::Words::LineStyle::Double);
borders->idx_get(Aspose::Words::BorderType::Right)->set_LineStyle(Aspose::Words::LineStyle::Double);
borders->idx_get(Aspose::Words::BorderType::Top)->set_LineStyle(Aspose::Words::LineStyle::Double);
borders->idx_get(Aspose::Words::BorderType::Bottom)->set_LineStyle(Aspose::Words::LineStyle::Double);
// Set paragraph shading
SharedPtr<Shading> shading = builder->get_ParagraphFormat()->get_Shading();
shading->set_Texture(Aspose::Words::TextureIndex::TextureDiagonalCross);
shading->set_BackgroundPatternColor(System::Drawing::Color::get_LightCoral());
shading->set_ForegroundPatternColor(System::Drawing::Color::get_LightSalmon());
builder->Write(u"This paragraph is formatted with a double border and shading.");
doc->Save(ArtifactsDir + u"DocumentBuilder.DocumentBuilderApplyBordersAndShading.docx");

Shows how to apply a outline border to a table.

auto doc = MakeObject<Document>(MyDir + u"Tables.docx");
auto table = System::DynamicCast<Aspose::Words::Tables::Table>(doc->GetChild(Aspose::Words::NodeType::Table, 0, true));
// Align the table to the center of the page
table->set_Alignment(Aspose::Words::Tables::TableAlignment::Center);
// Clear any existing borders and shading from the table
table->ClearBorders();
table->ClearShading();
// Set a green border around the table but not inside
table->SetBorder(Aspose::Words::BorderType::Left, Aspose::Words::LineStyle::Single, 1.5, System::Drawing::Color::get_Green(), true);
table->SetBorder(Aspose::Words::BorderType::Right, Aspose::Words::LineStyle::Single, 1.5, System::Drawing::Color::get_Green(), true);
table->SetBorder(Aspose::Words::BorderType::Top, Aspose::Words::LineStyle::Single, 1.5, System::Drawing::Color::get_Green(), true);
table->SetBorder(Aspose::Words::BorderType::Bottom, Aspose::Words::LineStyle::Single, 1.5, System::Drawing::Color::get_Green(), true);
// Fill the cells with a light green solid color
table->SetShading(Aspose::Words::TextureIndex::TextureSolid, System::Drawing::Color::get_LightGreen(), System::Drawing::Color::Empty);
doc->Save(ArtifactsDir + u"Table.SetOutlineBorders.docx");
Enumerator
Texture10Percent 
Texture12Pt5Percent 
Texture15Percent 
Texture17Pt5Percent 
Texture20Percent 
Texture22Pt5Percent 
Texture25Percent 
Texture27Pt5Percent 
Texture2Pt5Percent 
Texture30Percent 
Texture32Pt5Percent 
Texture35Percent 
Texture37Pt5Percent 
Texture40Percent 
Texture42Pt5Percent 
Texture45Percent 
Texture47Pt5Percent 
Texture50Percent 
Texture52Pt5Percent 
Texture55Percent 
Texture57Pt5Percent 
Texture5Percent 
Texture60Percent 
Texture62Pt5Percent 
Texture65Percent 
Texture67Pt5Percent 
Texture70Percent 
Texture72Pt5Percent 
Texture75Percent 
Texture77Pt5Percent 
Texture7Pt5Percent 
Texture80Percent 
Texture82Pt5Percent 
Texture85Percent 
Texture87Pt5Percent 
Texture90Percent 
Texture92Pt5Percent 
Texture95Percent 
Texture97Pt5Percent 
TextureCross 
TextureDarkCross 
TextureDarkDiagonalCross 
TextureDarkDiagonalDown 
TextureDarkDiagonalUp 
TextureDarkHorizontal 
TextureDarkVertical 
TextureDiagonalCross 
TextureDiagonalDown 
TextureDiagonalUp 
TextureHorizontal 
TextureNone 
TextureSolid 
TextureVertical 
TextureNil 

Specifies that there shall be no pattern used on the current shaded region (i.e. the pattern shall be a complete fill with the background color).

◆ TxtLeadingSpacesOptions

Specifies available options for leading space handling during import from Text file.

Examples

Shows how to trim whitespace when loading plaintext documents.

String textDoc = String(u" Line 1 \n") + u" Line 2 \n" + u" Line 3 ";
auto loadOptions = MakeObject<TxtLoadOptions>();
loadOptions->set_LeadingSpacesOptions(txtLeadingSpacesOptions);
loadOptions->set_TrailingSpacesOptions(txtTrailingSpacesOptions);
// Load the document while applying LoadOptions as a parameter and verify the result
auto doc = MakeObject<Document>(MakeObject<System::IO::MemoryStream>(System::Text::Encoding::get_UTF8()->GetBytes(textDoc)), loadOptions);
SharedPtr<ParagraphCollection> paragraphs = doc->get_FirstSection()->get_Body()->get_Paragraphs();
switch (txtLeadingSpacesOptions)
{
case Aspose::Words::TxtLeadingSpacesOptions::ConvertToIndent:
ASPOSE_ASSERT_EQ(37.8, paragraphs->idx_get(0)->get_ParagraphFormat()->get_FirstLineIndent());
ASPOSE_ASSERT_EQ(25.2, paragraphs->idx_get(1)->get_ParagraphFormat()->get_FirstLineIndent());
ASPOSE_ASSERT_EQ(6.3, paragraphs->idx_get(2)->get_ParagraphFormat()->get_FirstLineIndent());
ASSERT_TRUE(paragraphs->idx_get(0)->GetText().StartsWith(u"Line 1"));
ASSERT_TRUE(paragraphs->idx_get(1)->GetText().StartsWith(u"Line 2"));
ASSERT_TRUE(paragraphs->idx_get(2)->GetText().StartsWith(u"Line 3"));
break;
{
ASSERT_TRUE(paragraphs->LINQ_All([](SharedPtr<Node> p) { return (System::DynamicCast<Paragraph>(p))->get_ParagraphFormat()->get_FirstLineIndent() == 0.0; }));
ASSERT_TRUE(paragraphs->idx_get(0)->GetText().StartsWith(u" Line 1"));
ASSERT_TRUE(paragraphs->idx_get(1)->GetText().StartsWith(u" Line 2"));
ASSERT_TRUE(paragraphs->idx_get(2)->GetText().StartsWith(u" Line 3"));
break;
}
{
ASSERT_TRUE(paragraphs->LINQ_All([](SharedPtr<Node> p) { return (System::DynamicCast<Paragraph>(p))->get_ParagraphFormat()->get_FirstLineIndent() == 0.0; }));
ASSERT_TRUE(paragraphs->idx_get(0)->GetText().StartsWith(u"Line 1"));
ASSERT_TRUE(paragraphs->idx_get(1)->GetText().StartsWith(u"Line 2"));
ASSERT_TRUE(paragraphs->idx_get(2)->GetText().StartsWith(u"Line 3"));
break;
}
}
switch (txtTrailingSpacesOptions)
{
ASSERT_TRUE(paragraphs->idx_get(0)->GetText().EndsWith(u"Line 1 \r"));
ASSERT_TRUE(paragraphs->idx_get(1)->GetText().EndsWith(u"Line 2 \r"));
ASSERT_TRUE(paragraphs->idx_get(2)->GetText().EndsWith(u"Line 3 \f"));
break;
ASSERT_TRUE(paragraphs->idx_get(0)->GetText().EndsWith(u"Line 1\r"));
ASSERT_TRUE(paragraphs->idx_get(1)->GetText().EndsWith(u"Line 2\r"));
ASSERT_TRUE(paragraphs->idx_get(2)->GetText().EndsWith(u"Line 3\f"));
break;
}
Enumerator
ConvertToIndent 
Trim 
Preserve 

◆ TxtTrailingSpacesOptions

Specifies available options for trailing spaces handling during import from Text file.

Examples

Shows how to trim whitespace when loading plaintext documents.

String textDoc = String(u" Line 1 \n") + u" Line 2 \n" + u" Line 3 ";
auto loadOptions = MakeObject<TxtLoadOptions>();
loadOptions->set_LeadingSpacesOptions(txtLeadingSpacesOptions);
loadOptions->set_TrailingSpacesOptions(txtTrailingSpacesOptions);
// Load the document while applying LoadOptions as a parameter and verify the result
auto doc = MakeObject<Document>(MakeObject<System::IO::MemoryStream>(System::Text::Encoding::get_UTF8()->GetBytes(textDoc)), loadOptions);
SharedPtr<ParagraphCollection> paragraphs = doc->get_FirstSection()->get_Body()->get_Paragraphs();
switch (txtLeadingSpacesOptions)
{
case Aspose::Words::TxtLeadingSpacesOptions::ConvertToIndent:
ASPOSE_ASSERT_EQ(37.8, paragraphs->idx_get(0)->get_ParagraphFormat()->get_FirstLineIndent());
ASPOSE_ASSERT_EQ(25.2, paragraphs->idx_get(1)->get_ParagraphFormat()->get_FirstLineIndent());
ASPOSE_ASSERT_EQ(6.3, paragraphs->idx_get(2)->get_ParagraphFormat()->get_FirstLineIndent());
ASSERT_TRUE(paragraphs->idx_get(0)->GetText().StartsWith(u"Line 1"));
ASSERT_TRUE(paragraphs->idx_get(1)->GetText().StartsWith(u"Line 2"));
ASSERT_TRUE(paragraphs->idx_get(2)->GetText().StartsWith(u"Line 3"));
break;
{
ASSERT_TRUE(paragraphs->LINQ_All([](SharedPtr<Node> p) { return (System::DynamicCast<Paragraph>(p))->get_ParagraphFormat()->get_FirstLineIndent() == 0.0; }));
ASSERT_TRUE(paragraphs->idx_get(0)->GetText().StartsWith(u" Line 1"));
ASSERT_TRUE(paragraphs->idx_get(1)->GetText().StartsWith(u" Line 2"));
ASSERT_TRUE(paragraphs->idx_get(2)->GetText().StartsWith(u" Line 3"));
break;
}
{
ASSERT_TRUE(paragraphs->LINQ_All([](SharedPtr<Node> p) { return (System::DynamicCast<Paragraph>(p))->get_ParagraphFormat()->get_FirstLineIndent() == 0.0; }));
ASSERT_TRUE(paragraphs->idx_get(0)->GetText().StartsWith(u"Line 1"));
ASSERT_TRUE(paragraphs->idx_get(1)->GetText().StartsWith(u"Line 2"));
ASSERT_TRUE(paragraphs->idx_get(2)->GetText().StartsWith(u"Line 3"));
break;
}
}
switch (txtTrailingSpacesOptions)
{
ASSERT_TRUE(paragraphs->idx_get(0)->GetText().EndsWith(u"Line 1 \r"));
ASSERT_TRUE(paragraphs->idx_get(1)->GetText().EndsWith(u"Line 2 \r"));
ASSERT_TRUE(paragraphs->idx_get(2)->GetText().EndsWith(u"Line 3 \f"));
break;
ASSERT_TRUE(paragraphs->idx_get(0)->GetText().EndsWith(u"Line 1\r"));
ASSERT_TRUE(paragraphs->idx_get(1)->GetText().EndsWith(u"Line 2\r"));
ASSERT_TRUE(paragraphs->idx_get(2)->GetText().EndsWith(u"Line 3\f"));
break;
}
Enumerator
Trim 
Preserve 

◆ Underline

Indicates type of the underline applied to a font.

Examples

Shows how to insert a hyperlink into a document using DocumentBuilder.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Write(u"Please make sure to visit ");
// Specify font formatting for the hyperlink
builder->get_Font()->set_Color(System::Drawing::Color::get_Blue());
builder->get_Font()->set_Underline(Aspose::Words::Underline::Single);
// Insert the link
builder->InsertHyperlink(u"Aspose Website", u"https://www.aspose.com", false);
// Revert to default formatting
builder->get_Font()->ClearFormatting();
builder->Write(u" for more information.");
// Holding Ctrl and left clicking on the field in Microsoft Word will take you to the link's address in a web browser
doc->Save(ArtifactsDir + u"DocumentBuilder.InsertHyperlink.docx");
Enumerator
None 
Single 
Words 
Double 
Dotted 
Thick 
Dash 
DashLong 
DotDash 
DotDotDash 
Wavy 
DottedHeavy 
DashHeavy 
DashLongHeavy 
DotDashHeavy 
DotDotDashHeavy 
WavyHeavy 
WavyDouble 

◆ VbaModuleType

Specifies the type of a model in a VBA project.

Examples

Shows how to create a VbaProject from a scratch for using macros.

auto doc = MakeObject<Document>();
// Create a new VBA project
auto project = MakeObject<VbaProject>();
project->set_Name(u"Aspose.Project");
doc->set_VbaProject(project);
// Create a new module and specify a macro source code
auto module_ = MakeObject<VbaModule>();
module_->set_Name(u"Aspose.Module");
// VbaModuleType values:
// procedural module - A collection of subroutines and functions
// ------
// document module - A type of VBA project item that specifies a module for embedded macros and programmatic access
// operations that are associated with a document
// ------
// class module - A module that contains the definition for a new object. Each instance of a class creates
// a new object, and procedures that are defined in the module become properties and methods of the object
// ------
// designer module - A VBA module that extends the methods and properties of an ActiveX control that has been
// registered with the project
module_->set_Type(Aspose::Words::VbaModuleType::ProceduralModule);
module_->set_SourceCode(u"New source code");
// Add module to the VBA project
doc->get_VbaProject()->get_Modules()->Add(module_);
doc->Save(ArtifactsDir + u"Document.CreateVBAMacros.docm");
Enumerator
DocumentModule 

A type of VBA project item that specifies a module for embedded macros and programmatic access operations that are associated with a document.

ProceduralModule 

A collection of subroutines and functions.

ClassModule 

A module that contains the definition for a new object. Each instance of a class creates a new object, and procedures that are defined in the module become properties and methods of the object.

DesignerModule 

A VBA module that extends the methods and properties of an ActiveX control that has been registered with the project.

◆ VbaReferenceType

Allows to specify the type of a VbaReference object.

Enumerator
Registered 

Specifies an Automation type library reference type.

Project 

Specified an external VBA project reference type.

Original 

Specifies an original Automation type library reference type.

Control 

Specifies a twiddled type library reference type.

◆ VisitorAction

Allows the visitor to control the enumeration of nodes.

Enumerator
Continue 

The visitor requests the enumeration to continue.

SkipThisNode 

The visitor requests to skip the current node and continue enumeration.

Stop 

The visitor requests the enumeration of nodes to stop.

◆ WarningSource

Specifies the module that produces a warning during document loading or saving.

Enumerator
Unknown 

The warning source is not specified.

Layout 

Module that builds a document layout.

DrawingML 

Module that renders DrawingML shapes.

OfficeMath 

Module that renders OfficeMath.

Shapes 

Module that renders ordinary shapes.

Metafile 

Module that renders metafiles.

Xps 

Module that renders XPS.

Pdf 

Module that renders PDF.

Image 

Module that renders images.

Docx 

Module that reads/writes DOCX files.

Doc 

Module that reads/writes binary DOC files.

Text 

Module that reads/writes plaintext files.

Rtf 

Module that reads/writes RTF files.

WordML 

Module that reads/writes WML files.

Nrx 

Common modules that are shared between DOCX/WML reader/writer modules.

Odt 

Module that reads/writes ODT files.

Html 

Module that reads/writes HTML/MHTML files.

Validator 

Module that verifies model consistency and validity.

Xaml 

Module that reads/writes Xaml files.

Svm 

Module that reads Svm files.

MathML 

Module that reads W3C MathML files.

Font 

Module that reads font files.

Svg 

Module that reads SVG files.

Markdown 

Module that reads/writes Markdown files.

Chm 

Module that reads CHM files.

◆ WarningType

Specifies the type of a warning that is issued by Aspose.Words during document loading or saving.

Enumerator
DataLossCategory 

Some text/char/image or other data will be missing from either the document tree following load, or from the created document following save.

DataLoss 

Generic data loss, no specific code.

MajorFormattingLossCategory 

The resulting document or a particular location in it might look substantially different compared to the original document.

MajorFormattingLoss 

Generic major formatting loss, no specific code.

MinorFormattingLossCategory 

The resulting document or a particular location in it might look somewhat different compared to the original document.

MinorFormattingLoss 

Generic minor formatting loss, no specific code.

FontSubstitution 

Font has been substituted.

FontEmbedding 

Loss of embedded font information during document saving.

UnexpectedContentCategory 

Some content in the source document could not be recognized (i.e. is unsupported), this may or may not cause issues or result in data/formatting loss.

UnexpectedContent 

Generic unexpected content, no specific code.

Hint 

Advises of a potential problem or suggests an improvement.

◆ WatermarkLayout

Defines layout of the watermark relative to the watermark center.

Enumerator
Horizontal 

Horizontal watermark layout. Corresponds to 0 degrees of rotation.

Diagonal 

Diagonal watermark layout. Corresponds to 315 degrees of rotation.

◆ WatermarkType

Specifies the watermark type.

Enumerator
Text 

Indicates that the text will be used as a watermark. Such a watermark corresponds to a WordArt object.

Image 

Indicates that the image will be used as a watermark. Such a watermark corresponds to a shape with image.

None 

Indicates watermark is no set.

@ Comment
A comment in a Word document. A Comment node can have Paragraph and Table nodes.
String
@ Shape
A drawing object, such as an OfficeArt shape, image or an OLE object. A Shape node can contain Paragr...
@ Open
static constexpr char16_t SectionBreakChar
End of section character: (char)12 or "\f".
Definition: ControlChar.h:1273
@ AutoFitToContents
Aspose.Words enables the AutoFit option, removes the preferred width from the table and all cells and...
@ PageBreak
Explicit page break.
@ List
The style is a list style.
@ Trim
static ASPOSECPP_SHARED_API Color get_AliceBlue()
static ASPOSECPP_SHARED_API DateTime get_Now()
constexpr DateTime get_Date() const
static void Sign(System::SharedPtr< System::IO::Stream > srcStream, System::SharedPtr< System::IO::Stream > dstStream, System::SharedPtr< Aspose::Words::CertificateHolder > certHolder, System::SharedPtr< Aspose::Words::SignOptions > signOptions)
Signs source document using given CertificateHolder and SignOptions with digital signature and writes...
static ASPOSECPP_SHARED_API void WriteLine()
std::enable_if_t<!Details::IsIterable< Enumerable >::value, Details::EnumeratorAdapter< Enumerable, T > > IterateOver(System::SmartPtr< Enumerable > enumerable)
@ ConvertToIndent
static ASPOSECPP_SHARED_API EncodingPtr get_UTF8()
static ASPOSECPP_SHARED_API Color get_Black()
@ Original
Specifies original version of a document.
@ None
The paragraph does not have a drop cap.
@ TextBox
The shape is a textbox. Note that shapes of many other types can also have text inside them too....
static ASPOSECPP_SHARED_API Color get_LightGreen()
@ Trim
static ASPOSECPP_SHARED_API Color get_LightSalmon()
@ Left
The list label is aligned to the left of the number position.
@ Create
static ASPOSECPP_SHARED_API Color get_Green()
@ Portrait
Portrait page orientation (narrow and tall).
static double InchToPoint(double inches)
Converts inches to points.
System::ExceptionWrapper< Details_FileCorruptedException > FileCorruptedException
Thrown during document load, when the document appears to be corrupted and impossible to load.
Definition: FileCorruptedException.h:44
@ Space
A space character is placed between the list label and text of the paragraph.
static System::SharedPtr< Aspose::Words::CertificateHolder > Create(System::ArrayPtr< uint8_t > certBytes, System::SharedPtr< System::Security::SecureString > password)
Creates CertificateHolder object using byte array of PKCS12 store and its password.
static ASPOSECPP_SHARED_API Color get_Blue()
@ EndOfSection
Endnotes are output at the end of the section.
@ Unknown
Indicates an error, unknown digital signature type.
@ Footnote
A footnote or endnote in a Word document. A Footnote node can have Paragraph and Table nodes.
@ BottomOfPage
Footnotes are output at the bottom of each page.
static ASPOSECPP_SHARED_API Color get_Red()
static ASPOSECPP_SHARED_API const Color Empty
@ Footnote
The object is a footnote.
static ASPOSECPP_SHARED_API Color get_LightCoral()
@ Current
This document is used as a base during comparison.
@ Run
A run of text.
@ Paragraph
A paragraph of text. A Paragraph node is a container for inline level elements Run,...
@ Table
A Table object that represents a table in a Word document. A Table node can have Row nodes.
static System::SharedPtr< Aspose::Words::FileFormatInfo > DetectFileFormat(System::String fileName)
Detects and returns the information about a format of a document stored in a disk file.
@ Text
Border position is measured from the page margin.
@ Table
The style is a table style.
static std::enable_if< IsExceptionWrapper< T >::value, bool >::type Equals(const T &obj, const T2 &another)