Aspose::Words::DocumentBuilder Class Reference

Provides methods to insert text, images and other content, specify font, paragraph and section formatting. More...

#include "Aspose.Words.Cpp/Model/Document/DocumentBuilder.h"

Inherits IRunAttrSource, IRowAttrSource, and ICellAttrSource.

Public Member Functions

System::SharedPtr< Aspose::Words::Documentget_Document () const
 Gets or sets the Aspose::Words::DocumentBuilder::get_Document object that this object is attached to. More...
 
void set_Document (System::SharedPtr< Aspose::Words::Document > value)
 Setter for Aspose::Words::DocumentBuilder::get_Document. More...
 
System::SharedPtr< Aspose::Words::Fontget_Font ()
 Returns an object that represents current font formatting properties. More...
 
bool get_Bold ()
 True if the font is formatted as bold. More...
 
void set_Bold (bool value)
 Setter for Aspose::Words::DocumentBuilder::get_Bold. More...
 
bool get_Italic ()
 True if the font is formatted as italic. More...
 
void set_Italic (bool value)
 Setter for Aspose::Words::DocumentBuilder::get_Italic. More...
 
Aspose::Words::Underline get_Underline ()
 Gets/sets underline type for the current font. More...
 
void set_Underline (Aspose::Words::Underline value)
 Setter for Aspose::Words::DocumentBuilder::get_Underline. More...
 
System::SharedPtr< Aspose::Words::ParagraphFormatget_ParagraphFormat ()
 Returns an object that represents current paragraph formatting properties. More...
 
System::SharedPtr< Aspose::Words::ListFormatget_ListFormat ()
 Returns an object that represents current list formatting properties. More...
 
System::SharedPtr< Aspose::Words::PageSetupget_PageSetup ()
 Returns an object that represents current page setup and section properties. More...
 
System::SharedPtr< Aspose::Words::Tables::RowFormatget_RowFormat ()
 Returns an object that represents current table row formatting properties. More...
 
System::SharedPtr< Aspose::Words::Tables::CellFormatget_CellFormat ()
 Returns an object that represents current table cell formatting properties. More...
 
bool get_IsAtStartOfParagraph ()
 Returns true if the cursor is at the beginning of the current paragraph (no text before the cursor). More...
 
bool get_IsAtEndOfParagraph ()
 Returns true if the cursor is at the end of the current paragraph. More...
 
System::SharedPtr< Aspose::Words::Nodeget_CurrentNode ()
 Gets the node that is currently selected in this DocumentBuilder. More...
 
System::SharedPtr< Aspose::Words::Paragraphget_CurrentParagraph ()
 Gets the paragraph that is currently selected in this DocumentBuilder. More...
 
System::SharedPtr< Aspose::Words::Storyget_CurrentStory ()
 Gets the story that is currently selected in this DocumentBuilder. More...
 
System::SharedPtr< Aspose::Words::Sectionget_CurrentSection ()
 Gets the section that is currently selected in this DocumentBuilder. More...
 
 DocumentBuilder ()
 Initializes a new instance of this class. More...
 
 DocumentBuilder (System::SharedPtr< Aspose::Words::Document > doc)
 Initializes a new instance of this class. More...
 
void MoveToDocumentStart ()
 Moves the cursor to the beginning of the document. More...
 
void MoveToDocumentEnd ()
 Moves the cursor to the end of the document. More...
 
void MoveToSection (int32_t sectionIndex)
 Moves the cursor to the beginning of the body in a specified section. More...
 
void MoveToHeaderFooter (Aspose::Words::HeaderFooterType headerFooterType)
 Moves the cursor to the beginning of a header or footer in the current section. More...
 
bool MoveToMergeField (System::String fieldName)
 Moves the cursor to a position just beyond the specified merge field and removes the merge field. More...
 
bool MoveToMergeField (System::String fieldName, bool isAfter, bool isDeleteField)
 Moves the merge field to the specified merge field. More...
 
void MoveToField (System::SharedPtr< Aspose::Words::Fields::Field > field, bool isAfter)
 Moves the cursor to a field in the document. More...
 
bool MoveToBookmark (System::String bookmarkName)
 Moves the cursor to a bookmark. More...
 
bool MoveToBookmark (System::String bookmarkName, bool isStart, bool isAfter)
 Moves the cursor to a bookmark with greater precision. More...
 
void MoveToParagraph (int32_t paragraphIndex, int32_t characterIndex)
 Moves the cursor to a paragraph in the current section. More...
 
void MoveToCell (int32_t tableIndex, int32_t rowIndex, int32_t columnIndex, int32_t characterIndex)
 Moves the cursor to a table cell in the current section. More...
 
void MoveTo (System::SharedPtr< Aspose::Words::Node > node)
 Moves the cursor to an inline node or to the end of a paragraph. More...
 
System::SharedPtr< Aspose::Words::Tables::RowDeleteRow (int32_t tableIndex, int32_t rowIndex)
 Deletes a row from a table. More...
 
void Write (System::String text)
 Inserts a string into the document at the current insert position. More...
 
void Writeln (System::String text)
 Inserts a string and a paragraph break into the document. More...
 
void Writeln ()
 Inserts a paragraph break into the document. More...
 
System::SharedPtr< Aspose::Words::ParagraphInsertParagraph ()
 Inserts a paragraph break into the document. More...
 
void InsertStyleSeparator ()
 Inserts style separator into the document. More...
 
void InsertBreak (Aspose::Words::BreakType breakType)
 Inserts a break of the specified type into the document. More...
 
System::SharedPtr< Aspose::Words::Fields::FieldInsertTableOfContents (System::String switches)
 Inserts a TOC (table of contents) field into the document. More...
 
System::SharedPtr< Aspose::Words::Fields::FieldInsertField (Aspose::Words::Fields::FieldType fieldType, bool updateField)
 Inserts a Word field into a document and optionally updates the field result. More...
 
System::SharedPtr< Aspose::Words::Fields::FieldInsertField (System::String fieldCode)
 Inserts a Word field into a document and updates the field result. More...
 
System::SharedPtr< Aspose::Words::Fields::FieldInsertField (System::String fieldCode, System::String fieldValue)
 Inserts a Word field into a document without updating the field result. More...
 
System::SharedPtr< Aspose::Words::Fields::FieldInsertHyperlink (System::String displayText, System::String urlOrBookmark, bool isBookmark)
 Inserts a hyperlink into the document. More...
 
System::SharedPtr< Aspose::Words::Fields::FormFieldInsertTextInput (System::String name, Aspose::Words::Fields::TextFormFieldType type, System::String format, System::String fieldValue, int32_t maxLength)
 Inserts a text form field at the current position. More...
 
System::SharedPtr< Aspose::Words::Fields::FormFieldInsertCheckBox (System::String name, bool checkedValue, int32_t size)
 Inserts a checkbox form field at the current position. More...
 
System::SharedPtr< Aspose::Words::Fields::FormFieldInsertCheckBox (System::String name, bool defaultValue, bool checkedValue, int32_t size)
 Inserts a checkbox form field at the current position. More...
 
System::SharedPtr< Aspose::Words::Fields::FormFieldInsertComboBox (System::String name, System::ArrayPtr< System::String > items, int32_t selectedIndex)
 Inserts a combobox form field at the current position. More...
 
System::SharedPtr< Aspose::Words::FootnoteInsertFootnote (Aspose::Words::FootnoteType footnoteType, System::String footnoteText)
 Inserts a footnote or endnote into the document. More...
 
System::SharedPtr< Aspose::Words::FootnoteInsertFootnote (Aspose::Words::FootnoteType footnoteType, System::String footnoteText, System::String referenceMark)
 Inserts a footnote or endnote into the document. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::SharedPtr< System::Drawing::Image > image)
 Inserts an image from a .NET System::Drawing::Image object into the document. The image is inserted inline and at 100% scale. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::String fileName)
 Inserts an image from a file or URL into the document. The image is inserted inline and at 100% scale. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::SharedPtr< System::IO::Stream > stream)
 Inserts an image from a stream into the document. The image is inserted inline and at 100% scale. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::ArrayPtr< uint8_t > imageBytes)
 Inserts an image from a byte array into the document. The image is inserted inline and at 100% scale. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::SharedPtr< System::Drawing::Image > image, double width, double height)
 Inserts an inline image from a .NET System::Drawing::Image object into the document and scales it to the specified size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::String fileName, double width, double height)
 Inserts an inline image from a file or URL into the document and scales it to the specified size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::SharedPtr< System::IO::Stream > stream, double width, double height)
 Inserts an inline image from a stream into the document and scales it to the specified size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::ArrayPtr< uint8_t > imageBytes, double width, double height)
 Inserts an inline image from a byte array into the document and scales it to the specified size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::SharedPtr< System::Drawing::Image > image, Aspose::Words::Drawing::RelativeHorizontalPosition horzPos, double left, Aspose::Words::Drawing::RelativeVerticalPosition vertPos, double top, double width, double height, Aspose::Words::Drawing::WrapType wrapType)
 Inserts an image from a .NET System::Drawing::Image object at the specified position and size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::String fileName, Aspose::Words::Drawing::RelativeHorizontalPosition horzPos, double left, Aspose::Words::Drawing::RelativeVerticalPosition vertPos, double top, double width, double height, Aspose::Words::Drawing::WrapType wrapType)
 Inserts an image from a file or URL at the specified position and size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::SharedPtr< System::IO::Stream > stream, Aspose::Words::Drawing::RelativeHorizontalPosition horzPos, double left, Aspose::Words::Drawing::RelativeVerticalPosition vertPos, double top, double width, double height, Aspose::Words::Drawing::WrapType wrapType)
 Inserts an image from a stream at the specified position and size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertImage (System::ArrayPtr< uint8_t > imageBytes, Aspose::Words::Drawing::RelativeHorizontalPosition horzPos, double left, Aspose::Words::Drawing::RelativeVerticalPosition vertPos, double top, double width, double height, Aspose::Words::Drawing::WrapType wrapType)
 Inserts an image from a byte array at the specified position and size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertOleObject (System::SharedPtr< System::IO::Stream > stream, System::String progId, bool asIcon, System::SharedPtr< System::Drawing::Image > presentation)
 Inserts an embedded OLE object from a stream into the document. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertOleObject (System::String fileName, bool isLinked, bool asIcon, System::SharedPtr< System::Drawing::Image > presentation)
 Inserts an embedded or linked OLE object from a file into the document. Detects OLE object type using file extension. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertOleObject (System::String fileName, System::String progId, bool isLinked, bool asIcon, System::SharedPtr< System::Drawing::Image > presentation)
 Inserts an embedded or linked OLE object from a file into the document. Detects OLE object type using given progID parameter. More...
 
void InsertHtml (System::String html)
 Inserts an HTML string into the document. More...
 
void InsertHtml (System::String html, bool useBuilderFormatting)
 Inserts an HTML string into the document. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertShape (Aspose::Words::Drawing::ShapeType shapeType, double width, double height)
 Inserts inline shape with specified type and size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertShape (Aspose::Words::Drawing::ShapeType shapeType, Aspose::Words::Drawing::RelativeHorizontalPosition horzPos, double left, Aspose::Words::Drawing::RelativeVerticalPosition vertPos, double top, double width, double height, Aspose::Words::Drawing::WrapType wrapType)
 Inserts free-floating shape with specified position, size and text wrap type. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertChart (Aspose::Words::Drawing::Charts::ChartType chartType, double width, double height)
 Inserts an chart object into the document and scales it to the specified size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertChart (Aspose::Words::Drawing::Charts::ChartType chartType, Aspose::Words::Drawing::RelativeHorizontalPosition horzPos, double left, Aspose::Words::Drawing::RelativeVerticalPosition vertPos, double top, double width, double height, Aspose::Words::Drawing::WrapType wrapType)
 Inserts an chart object into the document and scales it to the specified size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertOnlineVideo (System::String videoUrl, System::String videoEmbedCode, System::ArrayPtr< uint8_t > thumbnailImageBytes, double width, double height)
 Inserts an online video object into the document and scales it to the specified size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertOnlineVideo (System::String videoUrl, System::String videoEmbedCode, System::ArrayPtr< uint8_t > thumbnailImageBytes, Aspose::Words::Drawing::RelativeHorizontalPosition horzPos, double left, Aspose::Words::Drawing::RelativeVerticalPosition vertPos, double top, double width, double height, Aspose::Words::Drawing::WrapType wrapType)
 Inserts an online video object into the document and scales it to the specified size. More...
 
System::SharedPtr< Aspose::Words::Drawing::ShapeInsertHorizontalRule ()
 Inserts a horizontal rule shape into the document. More...
 
System::SharedPtr< Aspose::Words::Tables::CellInsertCell ()
 Inserts a table cell into the document. More...
 
System::SharedPtr< Aspose::Words::Tables::TableStartTable ()
 Starts a table in the document. More...
 
System::SharedPtr< Aspose::Words::Tables::TableEndTable ()
 Ends a table in the document. More...
 
System::SharedPtr< Aspose::Words::Tables::RowEndRow ()
 Ends a table row in the document. More...
 
System::SharedPtr< Aspose::Words::BookmarkStartStartBookmark (System::String bookmarkName)
 Marks the current position in the document as a bookmark start. More...
 
System::SharedPtr< Aspose::Words::BookmarkEndEndBookmark (System::String bookmarkName)
 Marks the current position in the document as a bookmark end. More...
 
System::SharedPtr< Aspose::Words::EditableRangeStartStartEditableRange ()
 Marks the current position in the document as an editable range start. More...
 
System::SharedPtr< Aspose::Words::EditableRangeEndEndEditableRange ()
 Marks the current position in the document as an editable range end. More...
 
System::SharedPtr< Aspose::Words::EditableRangeEndEndEditableRange (System::SharedPtr< Aspose::Words::EditableRangeStart > start)
 Marks the current position in the document as an editable range end. More...
 
System::SharedPtr< Aspose::Words::NodeInsertDocument (System::SharedPtr< Aspose::Words::Document > srcDoc, Aspose::Words::ImportFormatMode importFormatMode)
 Inserts a document at the cursor position. More...
 
System::SharedPtr< Aspose::Words::NodeInsertDocument (System::SharedPtr< Aspose::Words::Document > srcDoc, Aspose::Words::ImportFormatMode importFormatMode, System::SharedPtr< Aspose::Words::ImportFormatOptions > importFormatOptions)
 Inserts a document at the cursor position. More...
 
void PushFont ()
 Saves current character formatting onto the stack. More...
 
void PopFont ()
 Retrieves character formatting previously saved on the stack. More...
 
void InsertNode (System::SharedPtr< Aspose::Words::Node > node)
 Inserts a text level node inside the current paragraph before the cursor. More...
 
System::SharedPtr< System::ObjectGetDirectRunAttr (int32_t fontAttr)
 
System::SharedPtr< System::ObjectFetchInheritedRunAttr (int32_t fontAttr)
 
void SetRunAttr (int32_t fontAttr, System::SharedPtr< System::Object > value)
 
void RemoveRunAttr (int32_t key)
 
void ClearRunAttrs ()
 
System::SharedPtr< System::ObjectGetDirectRowAttr (int32_t key)
 
System::SharedPtr< System::ObjectFetchRowAttr (int32_t key)
 
System::SharedPtr< System::ObjectFetchInheritedRowAttr (int32_t key)
 
void SetRowAttr (int32_t key, System::SharedPtr< System::Object > value)
 
void ClearRowAttrs ()
 
void ResetToDefaultAttrs ()
 
System::SharedPtr< System::ObjectGetDirectCellAttr (int32_t key)
 
System::SharedPtr< System::ObjectFetchCellAttr (int32_t key)
 
System::SharedPtr< System::ObjectFetchInheritedCellAttr (int32_t key)
 
void SetCellAttr (int32_t key, System::SharedPtr< System::Object > value)
 
void ClearCellAttrs ()
 

Detailed Description

Provides methods to insert text, images and other content, specify font, paragraph and section formatting.

DocumentBuilder makes the process of building a Document easier. Document is a composite object consisting of a tree of nodes and while inserting content nodes directly into the tree is possible, it requires good understanding of the tree structure. DocumentBuilder is a "facade" for the complex structure of Document and allows to insert content and formatting quickly and easily.

Create a DocumentBuilder and associate it with a Aspose::Words::DocumentBuilder::get_Document.

The DocumentBuilder has an internal cursor where the text will be inserted when you call Aspose::Words::DocumentBuilder::Write(System::String), Aspose::Words::DocumentBuilder::Writeln(System::String), Aspose::Words::DocumentBuilder::InsertBreak(Aspose::Words::BreakType) and other methods. You can navigate the DocumentBuilder cursor to a different location in a document using various MoveToXXX methods.

Use the Aspose::Words::DocumentBuilder::get_Font property to specify character formatting that will apply to all text inserted from the current position in the document onwards.

Use the Aspose::Words::DocumentBuilder::get_ParagraphFormat property to specify paragraph formatting for the current and all paragraphs that will be inserted.

Use the Aspose::Words::DocumentBuilder::get_PageSetup property to specify page and section properties for the current section and all section that will be inserted.

Use the Aspose::Words::DocumentBuilder::get_CellFormat and Aspose::Words::DocumentBuilder::get_RowFormat properties to specify formatting properties for table cells and rows. User the Aspose::Words::DocumentBuilder::InsertCell and Aspose::Words::DocumentBuilder::EndRow methods to build a table.

Note that Font, ParagraphFormat and PageSetup properties are updated whenever you navigate to a different place in the document to reflect formatting properties available at the new location.

Constructor & Destructor Documentation

◆ DocumentBuilder() [1/2]

Aspose::Words::DocumentBuilder::DocumentBuilder ( )

Initializes a new instance of this class.

Creates a new DocumentBuilder object and attaches it to a new Aspose::Words::DocumentBuilder::get_Document object.

◆ DocumentBuilder() [2/2]

Aspose::Words::DocumentBuilder::DocumentBuilder ( System::SharedPtr< Aspose::Words::Document doc)

Initializes a new instance of this class.

Creates a new DocumentBuilder object, attaches to the specified Aspose::Words::DocumentBuilder::get_Document object. The cursor is positioned at the beginning of the document.

Parameters
docThe Document object to attach to.

Member Function Documentation

◆ ClearCellAttrs()

void Aspose::Words::DocumentBuilder::ClearCellAttrs ( )

◆ ClearRowAttrs()

void Aspose::Words::DocumentBuilder::ClearRowAttrs ( )

◆ ClearRunAttrs()

void Aspose::Words::DocumentBuilder::ClearRunAttrs ( )

◆ DeleteRow()

System::SharedPtr<Aspose::Words::Tables::Row> Aspose::Words::DocumentBuilder::DeleteRow ( int32_t  tableIndex,
int32_t  rowIndex 
)

Deletes a row from a table.

If the cursor is inside the row that is being deleted, the cursor is moved out to the next row or to the next paragraph after the table.

If you delete a row from a table that contains only one row, the whole table is deleted.

For the index parameters, when index is greater than or equal to 0, it specifies an index from the beginning with 0 being the first element. When index is less than 0, it specified an index from the end with -1 being the last element.

Parameters
tableIndexThe index of the table.
rowIndexThe index of the row in the table.
Returns
The row node that was just removed.

◆ EndBookmark()

System::SharedPtr<Aspose::Words::BookmarkEnd> Aspose::Words::DocumentBuilder::EndBookmark ( System::String  bookmarkName)

Marks the current position in the document as a bookmark end.

Bookmarks in a document can overlap and span any range. To create a valid bookmark you need to call both Aspose::Words::DocumentBuilder::StartBookmark(System::String) and Aspose::Words::DocumentBuilder::EndBookmark(System::String) with the same bookmarkName parameter.

Badly formed bookmarks or bookmarks with duplicate names will be ignored when the document is saved.

Parameters
bookmarkNameName of the bookmark.
Returns
The bookmark end node that was just created.

◆ EndEditableRange() [1/2]

System::SharedPtr<Aspose::Words::EditableRangeEnd> Aspose::Words::DocumentBuilder::EndEditableRange ( )

Marks the current position in the document as an editable range end.

Editable range in a document can overlap and span any range. To create a valid editable range you need to call both Aspose::Words::DocumentBuilder::StartEditableRange and Aspose::Words::DocumentBuilder::EndEditableRange or Aspose::Words::DocumentBuilder::EndEditableRange(System::SharedPtr<Aspose::Words::EditableRangeStart>) methods.

Badly formed editable range will be ignored when the document is saved.

Returns
The editable range end node that was just created.

◆ EndEditableRange() [2/2]

System::SharedPtr<Aspose::Words::EditableRangeEnd> Aspose::Words::DocumentBuilder::EndEditableRange ( System::SharedPtr< Aspose::Words::EditableRangeStart start)

Marks the current position in the document as an editable range end.

Use this overload during creating nested editable ranges.

Editable range in a document can overlap and span any range. To create a valid editable range you need to call both Aspose::Words::DocumentBuilder::StartEditableRange and Aspose::Words::DocumentBuilder::EndEditableRange or Aspose::Words::DocumentBuilder::EndEditableRange(System::SharedPtr<Aspose::Words::EditableRangeStart>) methods.

Badly formed editable range will be ignored when the document is saved.

Parameters
startThis editable range start.
Returns
The editable range end node that was just created.

◆ EndRow()

System::SharedPtr<Aspose::Words::Tables::Row> Aspose::Words::DocumentBuilder::EndRow ( )

Ends a table row in the document.

Call EndRow to end a table row. If you call Aspose::Words::DocumentBuilder::InsertCell immediately after that, then the table continues on a new row.

Use the Aspose::Words::DocumentBuilder::get_RowFormat property to specify row formatting.

Returns
The row node that was just finished.

◆ EndTable()

System::SharedPtr<Aspose::Words::Tables::Table> Aspose::Words::DocumentBuilder::EndTable ( )

Ends a table in the document.

This method should be called only once after Aspose::Words::DocumentBuilder::EndRow was called. When called, EndTable moves the cursor out of the current cell to point just after the table.

Returns
The table node that was just finished.

◆ FetchCellAttr()

System::SharedPtr<System::Object> Aspose::Words::DocumentBuilder::FetchCellAttr ( int32_t  key)

◆ FetchInheritedCellAttr()

System::SharedPtr<System::Object> Aspose::Words::DocumentBuilder::FetchInheritedCellAttr ( int32_t  key)

◆ FetchInheritedRowAttr()

System::SharedPtr<System::Object> Aspose::Words::DocumentBuilder::FetchInheritedRowAttr ( int32_t  key)

◆ FetchInheritedRunAttr()

System::SharedPtr<System::Object> Aspose::Words::DocumentBuilder::FetchInheritedRunAttr ( int32_t  fontAttr)

◆ FetchRowAttr()

System::SharedPtr<System::Object> Aspose::Words::DocumentBuilder::FetchRowAttr ( int32_t  key)

◆ get_Bold()

bool Aspose::Words::DocumentBuilder::get_Bold ( )

True if the font is formatted as bold.

◆ get_CellFormat()

System::SharedPtr<Aspose::Words::Tables::CellFormat> Aspose::Words::DocumentBuilder::get_CellFormat ( )

Returns an object that represents current table cell formatting properties.

◆ get_CurrentNode()

System::SharedPtr<Aspose::Words::Node> Aspose::Words::DocumentBuilder::get_CurrentNode ( )

Gets the node that is currently selected in this DocumentBuilder.

CurrentNode is a cursor of DocumentBuilder and points to a Node that is a direct child of a Paragraph. Any insert operations you perform using DocumentBuilder will insert before the CurrentNode.

When the current paragraph is empty or the cursor is positioned just before the end of the paragraph, CurrentNode returns null.

See also
Aspose::Words::DocumentBuilder::get_CurrentParagraph

◆ get_CurrentParagraph()

System::SharedPtr<Aspose::Words::Paragraph> Aspose::Words::DocumentBuilder::get_CurrentParagraph ( )

Gets the paragraph that is currently selected in this DocumentBuilder.

Aspose::Words::DocumentBuilder::get_CurrentNode

◆ get_CurrentSection()

System::SharedPtr<Aspose::Words::Section> Aspose::Words::DocumentBuilder::get_CurrentSection ( )

Gets the section that is currently selected in this DocumentBuilder.

◆ get_CurrentStory()

System::SharedPtr<Aspose::Words::Story> Aspose::Words::DocumentBuilder::get_CurrentStory ( )

Gets the story that is currently selected in this DocumentBuilder.

◆ get_Document()

System::SharedPtr<Aspose::Words::Document> Aspose::Words::DocumentBuilder::get_Document ( ) const

Gets or sets the Aspose::Words::DocumentBuilder::get_Document object that this object is attached to.

◆ get_Font()

System::SharedPtr<Aspose::Words::Font> Aspose::Words::DocumentBuilder::get_Font ( )

Returns an object that represents current font formatting properties.

Use Font to access and modify font formatting properties.

Specify font formatting before inserting text.

◆ get_IsAtEndOfParagraph()

bool Aspose::Words::DocumentBuilder::get_IsAtEndOfParagraph ( )

Returns true if the cursor is at the end of the current paragraph.

◆ get_IsAtStartOfParagraph()

bool Aspose::Words::DocumentBuilder::get_IsAtStartOfParagraph ( )

Returns true if the cursor is at the beginning of the current paragraph (no text before the cursor).

◆ get_Italic()

bool Aspose::Words::DocumentBuilder::get_Italic ( )

True if the font is formatted as italic.

◆ get_ListFormat()

System::SharedPtr<Aspose::Words::ListFormat> Aspose::Words::DocumentBuilder::get_ListFormat ( )

Returns an object that represents current list formatting properties.

◆ get_PageSetup()

System::SharedPtr<Aspose::Words::PageSetup> Aspose::Words::DocumentBuilder::get_PageSetup ( )

Returns an object that represents current page setup and section properties.

◆ get_ParagraphFormat()

System::SharedPtr<Aspose::Words::ParagraphFormat> Aspose::Words::DocumentBuilder::get_ParagraphFormat ( )

Returns an object that represents current paragraph formatting properties.

◆ get_RowFormat()

System::SharedPtr<Aspose::Words::Tables::RowFormat> Aspose::Words::DocumentBuilder::get_RowFormat ( )

Returns an object that represents current table row formatting properties.

◆ get_Underline()

Aspose::Words::Underline Aspose::Words::DocumentBuilder::get_Underline ( )

Gets/sets underline type for the current font.

◆ GetDirectCellAttr()

System::SharedPtr<System::Object> Aspose::Words::DocumentBuilder::GetDirectCellAttr ( int32_t  key)

◆ GetDirectRowAttr()

System::SharedPtr<System::Object> Aspose::Words::DocumentBuilder::GetDirectRowAttr ( int32_t  key)

◆ GetDirectRunAttr()

System::SharedPtr<System::Object> Aspose::Words::DocumentBuilder::GetDirectRunAttr ( int32_t  fontAttr)

◆ InsertBreak()

void Aspose::Words::DocumentBuilder::InsertBreak ( Aspose::Words::BreakType  breakType)

Inserts a break of the specified type into the document.

Use this method to insert paragraph, page, column, section or line break into the document.

Parameters
breakTypeSpecifies the type of the break to insert.

◆ InsertCell()

System::SharedPtr<Aspose::Words::Tables::Cell> Aspose::Words::DocumentBuilder::InsertCell ( )

Inserts a table cell into the document.

To start a table, just call InsertCell. After this, any content you add using other methods of the Aspose::Words::DocumentBuilder class will be added to the current cell.

To start a new cell in the same row, call InsertCell again.

To end a table row call Aspose::Words::DocumentBuilder::EndRow.

Use the Aspose::Words::DocumentBuilder::get_CellFormat property to specify cell formatting.

Returns
The cell node that was just inserted.

◆ InsertChart() [1/2]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertChart ( Aspose::Words::Drawing::Charts::ChartType  chartType,
Aspose::Words::Drawing::RelativeHorizontalPosition  horzPos,
double  left,
Aspose::Words::Drawing::RelativeVerticalPosition  vertPos,
double  top,
double  width,
double  height,
Aspose::Words::Drawing::WrapType  wrapType 
)

Inserts an chart object into the document and scales it to the specified size.

Parameters
chartTypeThe chart type to insert into the document.
horzPosSpecifies where the distance to the image is measured from.
leftDistance in points from the origin to the left side of the image.
vertPosSpecifies where the distance to the image measured from.
topDistance in points from the origin to the top side of the image.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
wrapTypeSpecifies how to wrap text around the image.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertChart() [2/2]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertChart ( Aspose::Words::Drawing::Charts::ChartType  chartType,
double  width,
double  height 
)

Inserts an chart object into the document and scales it to the specified size.

Parameters
chartTypeThe chart type to insert into the document.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertCheckBox() [1/2]

System::SharedPtr<Aspose::Words::Fields::FormField> Aspose::Words::DocumentBuilder::InsertCheckBox ( System::String  name,
bool  checkedValue,
int32_t  size 
)

Inserts a checkbox form field at the current position.

If you specify a name for the form field, then a bookmark is automatically created with the same name.

Parameters
nameThe name of the form field. Can be an empty string. The value longer than 20 characters will be truncated.
checkedValueChecked status of the checkbox form field.
sizeSpecifies the size of the checkbox in points. Specify 0 for MS Word to calculate the size of the checkbox automatically.
Returns
The form field node that was just inserted.

◆ InsertCheckBox() [2/2]

System::SharedPtr<Aspose::Words::Fields::FormField> Aspose::Words::DocumentBuilder::InsertCheckBox ( System::String  name,
bool  defaultValue,
bool  checkedValue,
int32_t  size 
)

Inserts a checkbox form field at the current position.

If you specify a name for the form field, then a bookmark is automatically created with the same name.

Parameters
nameThe name of the form field. Can be an empty string. The value longer than 20 characters will be truncated.
defaultValueDefault value of the checkbox form field.
checkedValueCurrent checked status of the checkbox form field.
sizeSpecifies the size of the checkbox in points. Specify 0 for MS Word to calculate the size of the checkbox automatically.
Returns
The form field node that was just inserted.

◆ InsertComboBox()

System::SharedPtr<Aspose::Words::Fields::FormField> Aspose::Words::DocumentBuilder::InsertComboBox ( System::String  name,
System::ArrayPtr< System::String items,
int32_t  selectedIndex 
)

Inserts a combobox form field at the current position.

If you specify a name for the form field, then a bookmark is automatically created with the same name.

Parameters
nameThe name of the form field. Can be an empty string. The value longer than 20 characters will be truncated.
itemsThe items of the ComboBox. Maximum is 25 items.
selectedIndexThe index of the selected item in the ComboBox.
Returns
The form field node that was just inserted.

◆ InsertDocument() [1/2]

System::SharedPtr<Aspose::Words::Node> Aspose::Words::DocumentBuilder::InsertDocument ( System::SharedPtr< Aspose::Words::Document srcDoc,
Aspose::Words::ImportFormatMode  importFormatMode 
)

Inserts a document at the cursor position.

This method mimics the MS Word behavior, as if CTRL+'A' (select all content) was pressed, then CTRL+'C' (copy selected into the buffer) inside one document and then CTRL+'V' (insert content from the buffer) inside another document.

Parameters
srcDocSource document for inserting.
importFormatModeSpecifies how to merge style formatting that clashes.
Returns
First node of the inserted content.

◆ InsertDocument() [2/2]

System::SharedPtr<Aspose::Words::Node> Aspose::Words::DocumentBuilder::InsertDocument ( System::SharedPtr< Aspose::Words::Document srcDoc,
Aspose::Words::ImportFormatMode  importFormatMode,
System::SharedPtr< Aspose::Words::ImportFormatOptions importFormatOptions 
)

Inserts a document at the cursor position.

This method mimics the MS Word behavior, as if CTRL+'A' (select all content) was pressed, then CTRL+'C' (copy selected into the buffer) inside one document and then CTRL+'V' (insert content from the buffer) inside another document.

Parameters
srcDocSource document for inserting.
importFormatModeSpecifies how to merge style formatting that clashes.
importFormatOptionsAllows to specify options that affect formatting of a result document.
Returns
First node of the inserted content.

◆ InsertField() [1/3]

System::SharedPtr<Aspose::Words::Fields::Field> Aspose::Words::DocumentBuilder::InsertField ( Aspose::Words::Fields::FieldType  fieldType,
bool  updateField 
)

Inserts a Word field into a document and optionally updates the field result.

This method inserts a field into a document. Aspose.Words can update fields of most types, but not all. For more details see the Aspose::Words::DocumentBuilder::InsertField(System::String, System::String) overload.

See also
Aspose::Words::Fields::Field
Parameters
fieldTypeThe type of the field to append.
updateFieldSpecifies whether to update the field immediately.
Returns
A Aspose::Words::Fields::Field object that represents the inserted field.

◆ InsertField() [2/3]

System::SharedPtr<Aspose::Words::Fields::Field> Aspose::Words::DocumentBuilder::InsertField ( System::String  fieldCode)

Inserts a Word field into a document and updates the field result.

This method inserts a field into a document and updates the field result immediately. Aspose.Words can update fields of most types, but not all. For more details see the Aspose::Words::DocumentBuilder::InsertField(System::String, System::String) overload.

See also
Aspose::Words::Fields::Field
Parameters
fieldCodeThe field code to insert (without curly braces).
Returns
A Aspose::Words::Fields::Field object that represents the inserted field.

◆ InsertField() [3/3]

System::SharedPtr<Aspose::Words::Fields::Field> Aspose::Words::DocumentBuilder::InsertField ( System::String  fieldCode,
System::String  fieldValue 
)

Inserts a Word field into a document without updating the field result.

Fields in Microsoft Word documents consist of a field code and a field result. The field code is like a formula and the field result is like the value that the formula produces. The field code may also contain field switches that are like additional instructions to perform a specific action.

You can switch between displaying field codes and results in your document in Microsoft Word using the keyboard shortcut Alt+F9. Field codes appear between curly braces ( { } ).

To create a field, you need to specify a field type, field code and a "placeholder" field value. If you are not sure about a particular field code syntax, create the field in Microsoft Word first and switch to see its field code.

Aspose.Words can calculate field results for most of the field types, but this method does not update the field result automatically. Because the field result is not calculated automatically, you are expected to pass some string value (or even an empty string) that will be inserted into the field result. This value will remain in the field result as a placeholder until the field is updated. To update the field result you can call Aspose::Words::Fields::Field::Update on the field object returned to you or Aspose::Words::Document::UpdateFields to update fields in the whole document.

See also
Aspose::Words::Fields::Field
Parameters
fieldCodeThe field code to insert (without curly braces).
fieldValueThe field value to insert. Pass null for fields that do not have a value.
Returns
A Aspose::Words::Fields::Field object that represents the inserted field.

◆ InsertFootnote() [1/2]

System::SharedPtr<Aspose::Words::Footnote> Aspose::Words::DocumentBuilder::InsertFootnote ( Aspose::Words::FootnoteType  footnoteType,
System::String  footnoteText 
)

Inserts a footnote or endnote into the document.

Parameters
footnoteTypeSpecifies whether to insert a footnote or an endnote.
footnoteTextSpecifies the text of the footnote.
Returns
Returns a footnote object that was just created.

◆ InsertFootnote() [2/2]

System::SharedPtr<Aspose::Words::Footnote> Aspose::Words::DocumentBuilder::InsertFootnote ( Aspose::Words::FootnoteType  footnoteType,
System::String  footnoteText,
System::String  referenceMark 
)

Inserts a footnote or endnote into the document.

Parameters
footnoteTypeSpecifies whether to insert a footnote or an endnote.
footnoteTextSpecifies the text of the footnote.
referenceMarkSpecifies the custom reference mark of the footnote.
Returns
Returns a footnote object that was just created.

◆ InsertHorizontalRule()

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertHorizontalRule ( )

Inserts a horizontal rule shape into the document.

Returns
The shape that is a horizontal rule.

◆ InsertHtml() [1/2]

void Aspose::Words::DocumentBuilder::InsertHtml ( System::String  html)

Inserts an HTML string into the document.

You can use InsertHtml to insert an HTML fragment or whole HTML document.

Parameters
htmlAn HTML string to insert into the document.

◆ InsertHtml() [2/2]

void Aspose::Words::DocumentBuilder::InsertHtml ( System::String  html,
bool  useBuilderFormatting 
)

Inserts an HTML string into the document.

You can use InsertHtml to insert an HTML fragment or whole HTML document.

Parameters
htmlAn HTML string to insert into the document.
useBuilderFormattingA value indicating whether formatting specified in Aspose::Words::DocumentBuilder is used as base formatting for text imported from HTML.

When useBuilderFormatting is false, Aspose::Words::DocumentBuilder formating is ignored and formatting of inserted text is based on default HTML formatting. As a result, the text looks as it is rendered in browsers.

When useBuilderFormatting is true, formatting of inserted text is based on Aspose::Words::DocumentBuilder formatting, and the text looks as if it were inserted with Aspose::Words::DocumentBuilder::Write(System::String).

◆ InsertHyperlink()

System::SharedPtr<Aspose::Words::Fields::Field> Aspose::Words::DocumentBuilder::InsertHyperlink ( System::String  displayText,
System::String  urlOrBookmark,
bool  isBookmark 
)

Inserts a hyperlink into the document.

Note that you need to specify font formatting for the hyperlink display text explicitly using the Aspose::Words::DocumentBuilder::get_Font property.

This methods internally calls Aspose::Words::DocumentBuilder::InsertField(System::String) to insert an MS Word HYPERLINK field into the document.

Parameters
displayTextText of the link to be displayed in the document.
urlOrBookmarkLink destination. Can be a url or a name of a bookmark inside the document. This method always adds apostrophes at the beginning and end of the url.
isBookmarkTrue if the previous parameter is a name of a bookmark inside the document; false is the previous parameter is a URL.
Returns
A Aspose::Words::Fields::Field object that represents the inserted field.

◆ InsertImage() [1/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::ArrayPtr< uint8_t >  imageBytes)

Inserts an image from a byte array into the document. The image is inserted inline and at 100% scale.

Parameters
imageBytesThe byte array that contains the image.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertImage() [2/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::ArrayPtr< uint8_t >  imageBytes,
Aspose::Words::Drawing::RelativeHorizontalPosition  horzPos,
double  left,
Aspose::Words::Drawing::RelativeVerticalPosition  vertPos,
double  top,
double  width,
double  height,
Aspose::Words::Drawing::WrapType  wrapType 
)

Inserts an image from a byte array at the specified position and size.

Parameters
imageBytesThe byte array that contains the image.
Parameters
horzPosSpecifies where the distance to the image is measured from.
leftDistance in points from the origin to the left side of the image.
vertPosSpecifies where the distance to the image measured from.
topDistance in points from the origin to the top side of the image.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
wrapTypeSpecifies how to wrap text around the image.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertImage() [3/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::ArrayPtr< uint8_t >  imageBytes,
double  width,
double  height 
)

Inserts an inline image from a byte array into the document and scales it to the specified size.

Parameters
imageBytesThe byte array that contains the image.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertImage() [4/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::SharedPtr< System::Drawing::Image image)

Inserts an image from a .NET System::Drawing::Image object into the document. The image is inserted inline and at 100% scale.

Parameters
imageThe image to insert into the document.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertImage() [5/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::SharedPtr< System::Drawing::Image image,
Aspose::Words::Drawing::RelativeHorizontalPosition  horzPos,
double  left,
Aspose::Words::Drawing::RelativeVerticalPosition  vertPos,
double  top,
double  width,
double  height,
Aspose::Words::Drawing::WrapType  wrapType 
)

Inserts an image from a .NET System::Drawing::Image object at the specified position and size.

Parameters
imageThe image to insert into the document.
horzPosSpecifies where the distance to the image is measured from.
leftDistance in points from the origin to the left side of the image.
vertPosSpecifies where the distance to the image measured from.
topDistance in points from the origin to the top side of the image.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
wrapTypeSpecifies how to wrap text around the image.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertImage() [6/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::SharedPtr< System::Drawing::Image image,
double  width,
double  height 
)

Inserts an inline image from a .NET System::Drawing::Image object into the document and scales it to the specified size.

Parameters
imageThe image to insert into the document.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertImage() [7/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::SharedPtr< System::IO::Stream stream)

Inserts an image from a stream into the document. The image is inserted inline and at 100% scale.

Parameters
streamThe stream that contains the image.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertImage() [8/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::SharedPtr< System::IO::Stream stream,
Aspose::Words::Drawing::RelativeHorizontalPosition  horzPos,
double  left,
Aspose::Words::Drawing::RelativeVerticalPosition  vertPos,
double  top,
double  width,
double  height,
Aspose::Words::Drawing::WrapType  wrapType 
)

Inserts an image from a stream at the specified position and size.

Parameters
streamThe stream that contains the image.
Parameters
horzPosSpecifies where the distance to the image is measured from.
leftDistance in points from the origin to the left side of the image.
vertPosSpecifies where the distance to the image measured from.
topDistance in points from the origin to the top side of the image.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
wrapTypeSpecifies how to wrap text around the image.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertImage() [9/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::SharedPtr< System::IO::Stream stream,
double  width,
double  height 
)

Inserts an inline image from a stream into the document and scales it to the specified size.

Parameters
streamThe stream that contains the image.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertImage() [10/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::String  fileName)

Inserts an image from a file or URL into the document. The image is inserted inline and at 100% scale.

Parameters
fileNameThe file with the image. Can be any valid local or remote URI.
Returns
The image node that was just inserted.

This overload will automatically download the image before inserting into the document if you specify a remote URI.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertImage() [11/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::String  fileName,
Aspose::Words::Drawing::RelativeHorizontalPosition  horzPos,
double  left,
Aspose::Words::Drawing::RelativeVerticalPosition  vertPos,
double  top,
double  width,
double  height,
Aspose::Words::Drawing::WrapType  wrapType 
)

Inserts an image from a file or URL at the specified position and size.

Parameters
fileNameThe file that contains the image.
horzPosSpecifies where the distance to the image is measured from.
leftDistance in points from the origin to the left side of the image.
vertPosSpecifies where the distance to the image measured from.
topDistance in points from the origin to the top side of the image.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
wrapTypeSpecifies how to wrap text around the image.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertImage() [12/12]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertImage ( System::String  fileName,
double  width,
double  height 
)

Inserts an inline image from a file or URL into the document and scales it to the specified size.

Parameters
fileNameThe file that contains the image.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertNode()

void Aspose::Words::DocumentBuilder::InsertNode ( System::SharedPtr< Aspose::Words::Node node)

Inserts a text level node inside the current paragraph before the cursor.

◆ InsertOleObject() [1/3]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertOleObject ( System::SharedPtr< System::IO::Stream stream,
System::String  progId,
bool  asIcon,
System::SharedPtr< System::Drawing::Image presentation 
)

Inserts an embedded OLE object from a stream into the document.

Parameters
streamStream containing application data.
progIdProgrammatic Identifier of OLE object.
asIconSpecifies either Iconic or Normal mode of OLE object being inserted.
presentationImage presentation of OLE object. If value is null Aspose.Words will use one of the predefined images.
Returns
Shape node containing Ole object and inserted at the current Builder position.

◆ InsertOleObject() [2/3]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertOleObject ( System::String  fileName,
bool  isLinked,
bool  asIcon,
System::SharedPtr< System::Drawing::Image presentation 
)

Inserts an embedded or linked OLE object from a file into the document. Detects OLE object type using file extension.

Parameters
fileNameFull path to the file.
isLinkedIf true then linked OLE object is inserted otherwise embedded OLE object is inserted.
asIconSpecifies either Iconic or Normal mode of OLE object being inserted.
presentationImage presentation of OLE object. If value is null Aspose.Words will use one of the predefined images.
Returns
Shape node containing Ole object and inserted at the current Builder position.

◆ InsertOleObject() [3/3]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertOleObject ( System::String  fileName,
System::String  progId,
bool  isLinked,
bool  asIcon,
System::SharedPtr< System::Drawing::Image presentation 
)

Inserts an embedded or linked OLE object from a file into the document. Detects OLE object type using given progID parameter.

Parameters
fileNameFull path to the file.
progIdProgId of OLE object.
isLinkedIf true then linked OLE object is inserted otherwise embedded OLE object is inserted.
asIconSpecifies either Iconic or Normal mode of OLE object being inserted.
presentationImage presentation of OLE object. If value is null Aspose.Words will use one of the predefined images.
Returns
Shape node containing Ole object and inserted at the current Builder position.

◆ InsertOnlineVideo() [1/2]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertOnlineVideo ( System::String  videoUrl,
System::String  videoEmbedCode,
System::ArrayPtr< uint8_t >  thumbnailImageBytes,
Aspose::Words::Drawing::RelativeHorizontalPosition  horzPos,
double  left,
Aspose::Words::Drawing::RelativeVerticalPosition  vertPos,
double  top,
double  width,
double  height,
Aspose::Words::Drawing::WrapType  wrapType 
)

Inserts an online video object into the document and scales it to the specified size.

Parameters
videoUrlThe URL to the video.
videoEmbedCodeThe embed code for the video.
thumbnailImageBytesThe thumbnail image bytes.
horzPosSpecifies where the distance to the image is measured from.
leftDistance in points from the origin to the left side of the image.
vertPosSpecifies where the distance to the image measured from.
topDistance in points from the origin to the top side of the image.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
wrapTypeSpecifies how to wrap text around the image.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertOnlineVideo() [2/2]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertOnlineVideo ( System::String  videoUrl,
System::String  videoEmbedCode,
System::ArrayPtr< uint8_t >  thumbnailImageBytes,
double  width,
double  height 
)

Inserts an online video object into the document and scales it to the specified size.

Parameters
videoUrlThe URL to the video.
videoEmbedCodeThe embed code for the video.
thumbnailImageBytesThe thumbnail image bytes.
widthThe width of the image in points. Can be a negative or zero value to request 100% scale.
heightThe height of the image in points. Can be a negative or zero value to request 100% scale.
Returns
The image node that was just inserted.

You can change the image size, location, positioning method and other settings using the Aspose::Words::Drawing::Shape object returned by this method.

◆ InsertParagraph()

System::SharedPtr<Aspose::Words::Paragraph> Aspose::Words::DocumentBuilder::InsertParagraph ( )

Inserts a paragraph break into the document.

Current paragraph formatting specified by the Aspose::Words::DocumentBuilder::get_ParagraphFormat property is used.

Breaks the current paragraph in two. After inserting the paragraph, the cursor is placed at the beginning of the new paragraph.

Returns
The paragraph node that was just inserted. It is the same node as Aspose::Words::DocumentBuilder::get_CurrentParagraph.

◆ InsertShape() [1/2]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertShape ( Aspose::Words::Drawing::ShapeType  shapeType,
Aspose::Words::Drawing::RelativeHorizontalPosition  horzPos,
double  left,
Aspose::Words::Drawing::RelativeVerticalPosition  vertPos,
double  top,
double  width,
double  height,
Aspose::Words::Drawing::WrapType  wrapType 
)

Inserts free-floating shape with specified position, size and text wrap type.

Parameters
shapeTypeThe shape type to insert into the document
horzPosSpecifies where the horizontal distance to the shape is measured from.
leftDistance in points from the origin to the left side of the shape.
vertPosSpecifies where the vertical distance to the shape is measured from.
topDistance in points from the origin to the top side of the shape.
widthThe width of the shape in points.
heightThe width of the shape in points.
wrapTypeSpecifies how to wrap text around the shape.
Returns
The shape node that was inserted.

◆ InsertShape() [2/2]

System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBuilder::InsertShape ( Aspose::Words::Drawing::ShapeType  shapeType,
double  width,
double  height 
)

Inserts inline shape with specified type and size.

Parameters
shapeTypeThe shape type to insert into the document.
widthThe width of the shape in points.
heightThe height of the shape in points.
Returns
The shape node that was inserted.

◆ InsertStyleSeparator()

void Aspose::Words::DocumentBuilder::InsertStyleSeparator ( )

Inserts style separator into the document.

This method allows to apply different paragraph styles to two different parts of a text line.

◆ InsertTableOfContents()

System::SharedPtr<Aspose::Words::Fields::Field> Aspose::Words::DocumentBuilder::InsertTableOfContents ( System::String  switches)

Inserts a TOC (table of contents) field into the document.

This method inserts a TOC (table of contents) field into the document at the current position.

A table of contents in a Word document can be built in a number of ways and formatted using a variety of options. The way the table is built and displayed by Microsoft Word is controlled by the field switches.

The easiest way to specify the switches is to insert and configure a table of contents into a Word document using the Insert->Reference->Index and Tables menu, then switch display of field codes on to see the switches. You can press Alt+F9 in Microsoft Word to toggle display of field codes on or off.

For example, after creating a table of contents, the following field is inserted into the document: { TOC \o "1-3" \h \z \u }. You can copy \o "1-3" \h \z \u and use it as the switches parameter.

Note that InsertTableOfContents will only insert a TOC field, but will not actually build the table of contents. The table of contents is built by Microsoft Word when the field is updated.

If you insert a table of contents using this method and then open the file in Microsoft Word, you will not see the table of contents because the TOC field has not yet been updated.

In Microsoft Word, fields are not automatically updated when a document is opened, but you can update fields in a document at any time by pressing F9.

Parameters
switchesThe TOC field switches.

◆ InsertTextInput()

System::SharedPtr<Aspose::Words::Fields::FormField> Aspose::Words::DocumentBuilder::InsertTextInput ( System::String  name,
Aspose::Words::Fields::TextFormFieldType  type,
System::String  format,
System::String  fieldValue,
int32_t  maxLength 
)

Inserts a text form field at the current position.

If you specify a name for the form field, then a bookmark is automatically created with the same name.

Parameters
nameThe name of the form field. Can be an empty string.
typeSpecifies the type of the text form field.
formatFormat string used to format the value of the form field.
fieldValueText that will be shown in the field.
maxLengthMaximum length the user can enter into the form field. Set to zero for unlimited length.
Returns
The form field node that was just inserted.

◆ MoveTo()

void Aspose::Words::DocumentBuilder::MoveTo ( System::SharedPtr< Aspose::Words::Node node)

Moves the cursor to an inline node or to the end of a paragraph.

When node is an inline-level node, the cursor is moved to this node and further content will be inserted before that node.

When node is a Paragraph, the cursor is moved to the end of the paragraph and further content will be inserted just before the paragraph break.

When node is a block-level node but not a Paragraph, the cursor is moved to the end of the first paragraph into block-level node and further content will be inserted just before the paragraph break.

Parameters
nodeThe node must be a paragraph or a direct child of a paragraph.

◆ MoveToBookmark() [1/2]

bool Aspose::Words::DocumentBuilder::MoveToBookmark ( System::String  bookmarkName)

Moves the cursor to a bookmark.

Moves the cursor to a position just after the start of the bookmark with the specified name.

The comparison is not case-sensitive. If the bookmark was not found, false is returned and the cursor is not moved.

Inserting new text does not replace existing text of the bookmark.

Note that some bookmarks in the document are assigned to form fields. Moving to such a bookmark and inserting text there inserts the text into the form field code. Although this will not invalidate the form field, the inserted text will not be visible because it becomes part of the field code.

Parameters
bookmarkNameThe name of the bookmark to move the cursor to.
Returns
True if the bookmark was found; false otherwise.

◆ MoveToBookmark() [2/2]

bool Aspose::Words::DocumentBuilder::MoveToBookmark ( System::String  bookmarkName,
bool  isStart,
bool  isAfter 
)

Moves the cursor to a bookmark with greater precision.

Moves the cursor to a position before or after the bookmark start or end.

If desired position is not at inline level, moves to the next paragraph.

The comparison is not case-sensitive. If the bookmark was not found, false is returned and the cursor is not moved.

Parameters
bookmarkNameThe name of the bookmark to move the cursor to.
isStartWhen true, moves the cursor to the beginning of the bookmark. When false, moves the cursor to the end of the bookmark.
isAfterWhen true, moves the cursor to be after the bookmark start or end position. When false, moves the cursor to be before the bookmark start or end position.
Returns
True if the bookmark was found; false otherwise.

◆ MoveToCell()

void Aspose::Words::DocumentBuilder::MoveToCell ( int32_t  tableIndex,
int32_t  rowIndex,
int32_t  columnIndex,
int32_t  characterIndex 
)

Moves the cursor to a table cell in the current section.

The navigation is performed inside the current story of the current section.

For the index parameters, when index is greater than or equal to 0, it specifies an index from the beginning with 0 being the first element. When index is less than 0, it specified an index from the end with -1 being the last element.

Parameters
tableIndexThe index of the table to move to.
rowIndexThe index of the row in the table.
columnIndexThe index of the column in the table.
characterIndexThe index of the character inside the cell. Currently can only specify 0 to move to the beginning of the cell or -1 to move to the end of the cell.

◆ MoveToDocumentEnd()

void Aspose::Words::DocumentBuilder::MoveToDocumentEnd ( )

Moves the cursor to the end of the document.

◆ MoveToDocumentStart()

void Aspose::Words::DocumentBuilder::MoveToDocumentStart ( )

Moves the cursor to the beginning of the document.

◆ MoveToField()

void Aspose::Words::DocumentBuilder::MoveToField ( System::SharedPtr< Aspose::Words::Fields::Field field,
bool  isAfter 
)

Moves the cursor to a field in the document.

Parameters
fieldThe field to move the cursor to.
isAfterWhen true, moves the cursor to be after the field end. When false, moves the cursor to be before the field start.

◆ MoveToHeaderFooter()

void Aspose::Words::DocumentBuilder::MoveToHeaderFooter ( Aspose::Words::HeaderFooterType  headerFooterType)

Moves the cursor to the beginning of a header or footer in the current section.

After you moved the cursor into a header or footer, you can use the rest of DocumentBuilder methods to modify the contents of the header or footer.

If you want to create headers and footers different for the first page, you need to set Aspose::Words::PageSetup::get_DifferentFirstPageHeaderFooter.

If you want to create headers and footers different for even and odd pages, you need to set Aspose::Words::PageSetup::get_OddAndEvenPagesHeaderFooter.

Use Aspose::Words::DocumentBuilder::MoveToSection(int32_t) to move out of the header into the main text.

Parameters
headerFooterTypeSpecifies the header or footer to move to.

◆ MoveToMergeField() [1/2]

bool Aspose::Words::DocumentBuilder::MoveToMergeField ( System::String  fieldName)

Moves the cursor to a position just beyond the specified merge field and removes the merge field.

Note that this method deletes the merge field from the document after moving the cursor.

Parameters
fieldNameThe case-insensitive name of the mail merge field.
Returns
True if the merge field was found and the cursor was moved; false otherwise.

◆ MoveToMergeField() [2/2]

bool Aspose::Words::DocumentBuilder::MoveToMergeField ( System::String  fieldName,
bool  isAfter,
bool  isDeleteField 
)

Moves the merge field to the specified merge field.

Parameters
fieldNameThe case-insensitive name of the mail merge field.
isAfterWhen true, moves the cursor to be after the field end. When false, moves the cursor to be before the field start.
isDeleteFieldWhen true, deletes the merge field.
Returns
True if the merge field was found and the cursor was moved; false otherwise.

◆ MoveToParagraph()

void Aspose::Words::DocumentBuilder::MoveToParagraph ( int32_t  paragraphIndex,
int32_t  characterIndex 
)

Moves the cursor to a paragraph in the current section.

The navigation is performed inside the current story of the current section. That is, if you moved the cursor to the primary header of the first section, then paragraphIndex specified the index of the paragraph inside that header of that section.

When paragraphIndex is greater than or equal to 0, it specifies an index from the beginning of the section with 0 being the first paragraph. When paragraphIndex is less than 0, it specified an index from the end of the section with -1 being the last paragraph.

Parameters
paragraphIndexThe index of the paragraph to move to.
characterIndexThe index of the character inside the paragraph. Currently can only specify 0 to move to the beginning of the paragraph or -1 to move to the end of the paragraph.

◆ MoveToSection()

void Aspose::Words::DocumentBuilder::MoveToSection ( int32_t  sectionIndex)

Moves the cursor to the beginning of the body in a specified section.

When sectionIndex is greater than or equal to 0, it specifies an index from the beginning of the document with 0 being the first section. When sectionIndex is less than 0, it specified an index from the end of the document with -1 being the last section.

The cursor is moved to the first paragraph in the Body of the specified section.

Parameters
sectionIndexThe index of the section to move to.

◆ PopFont()

void Aspose::Words::DocumentBuilder::PopFont ( )

Retrieves character formatting previously saved on the stack.

See also
Aspose::Words::DocumentBuilder::get_Font, Aspose::Words::DocumentBuilder::PushFont

◆ PushFont()

void Aspose::Words::DocumentBuilder::PushFont ( )

Saves current character formatting onto the stack.

See also
Aspose::Words::DocumentBuilder::get_Font, Aspose::Words::DocumentBuilder::PopFont

◆ RemoveRunAttr()

void Aspose::Words::DocumentBuilder::RemoveRunAttr ( int32_t  key)

◆ ResetToDefaultAttrs()

void Aspose::Words::DocumentBuilder::ResetToDefaultAttrs ( )

◆ set_Bold()

void Aspose::Words::DocumentBuilder::set_Bold ( bool  value)

◆ set_Document()

void Aspose::Words::DocumentBuilder::set_Document ( System::SharedPtr< Aspose::Words::Document value)

◆ set_Italic()

void Aspose::Words::DocumentBuilder::set_Italic ( bool  value)

◆ set_Underline()

void Aspose::Words::DocumentBuilder::set_Underline ( Aspose::Words::Underline  value)

◆ SetCellAttr()

void Aspose::Words::DocumentBuilder::SetCellAttr ( int32_t  key,
System::SharedPtr< System::Object value 
)

◆ SetRowAttr()

void Aspose::Words::DocumentBuilder::SetRowAttr ( int32_t  key,
System::SharedPtr< System::Object value 
)

◆ SetRunAttr()

void Aspose::Words::DocumentBuilder::SetRunAttr ( int32_t  fontAttr,
System::SharedPtr< System::Object value 
)

◆ StartBookmark()

System::SharedPtr<Aspose::Words::BookmarkStart> Aspose::Words::DocumentBuilder::StartBookmark ( System::String  bookmarkName)

Marks the current position in the document as a bookmark start.

Bookmarks in a document can overlap and span any range. To create a valid bookmark you need to call both Aspose::Words::DocumentBuilder::StartBookmark(System::String) and Aspose::Words::DocumentBuilder::EndBookmark(System::String) with the same bookmarkName parameter.

Badly formed bookmarks or bookmarks with duplicate names will be ignored when the document is saved.

Parameters
bookmarkNameName of the bookmark.
Returns
The bookmark start node that was just created.

◆ StartEditableRange()

System::SharedPtr<Aspose::Words::EditableRangeStart> Aspose::Words::DocumentBuilder::StartEditableRange ( )

Marks the current position in the document as an editable range start.

Editable range in a document can overlap and span any range. To create a valid editable range you need to call both Aspose::Words::DocumentBuilder::StartEditableRange and Aspose::Words::DocumentBuilder::EndEditableRange or Aspose::Words::DocumentBuilder::EndEditableRange(System::SharedPtr<Aspose::Words::EditableRangeStart>) methods.

Badly formed editable range will be ignored when the document is saved.

Returns
The editable range start node that was just created.

◆ StartTable()

System::SharedPtr<Aspose::Words::Tables::Table> Aspose::Words::DocumentBuilder::StartTable ( )

Starts a table in the document.

The next method to call is Aspose::Words::DocumentBuilder::InsertCell.

This method starts a nested table when called inside a cell.

Returns
The table node that was just created.

◆ Write()

void Aspose::Words::DocumentBuilder::Write ( System::String  text)

Inserts a string into the document at the current insert position.

Current font formatting specified by the Aspose::Words::DocumentBuilder::get_Font property is used.

Parameters
textThe string to insert into the document.

◆ Writeln() [1/2]

void Aspose::Words::DocumentBuilder::Writeln ( )

Inserts a paragraph break into the document.

Calls Aspose::Words::DocumentBuilder::InsertParagraph.

◆ Writeln() [2/2]

void Aspose::Words::DocumentBuilder::Writeln ( System::String  text)

Inserts a string and a paragraph break into the document.

Current font and paragraph formatting specified by the Aspose::Words::DocumentBuilder::get_Font and Aspose::Words::DocumentBuilder::get_ParagraphFormat properties are used.

Parameters
textThe string to insert into the document.