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 Document.
The DocumentBuilder has an internal cursor where the text will be inserted when you call Write(), Writeln(), InsertBreak() and other methods. You can navigate the DocumentBuilder cursor to a different location in a document using various MoveToXXX methods.
Use the Font property to specify character formatting that will apply to all text inserted from the current position in the document onwards.
Use the ParagraphFormat property to specify paragraph formatting for the current and all paragraphs that will be inserted.
Use the PageSetup property to specify page and section properties for the current section and all section that will be inserted.
Use the CellFormat and RowFormat properties to specify formatting properties for table cells and rows. User the InsertCell and 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.
Shows how to create headers and footers in a document using DocumentBuilder.
Shows how to build a table with custom borders.
Shows how to use a document builder to create a table.
#include <Aspose.Words.Cpp/DocumentBuilder.h>
Public Member Functions | |
DocumentBuilder () | |
Initializes a new instance of this class. More... | |
DocumentBuilder (const SharedPtr< Document > &doc) | |
Initializes a new instance of this class. More... | |
SharedPtr< Row > | DeleteRow (int32_t tableIndex, int32_t rowIndex) |
Deletes a row from a table. More... | |
SharedPtr< BookmarkEnd > | EndBookmark (const String &bookmarkName) |
Marks the current position in the document as a bookmark end. More... | |
SharedPtr< BookmarkEnd > | EndColumnBookmark (const String &bookmarkName) |
Marks the current position in the document as a column bookmark end. The position must be in a table cell. More... | |
SharedPtr< EditableRangeEnd > | EndEditableRange () |
Marks the current position in the document as an editable range end. More... | |
SharedPtr< EditableRangeEnd > | EndEditableRange (const SharedPtr< EditableRangeStart > &start) |
Marks the current position in the document as an editable range end. More... | |
SharedPtr< Row > | EndRow () |
Ends a table row in the document. More... | |
SharedPtr< Table > | EndTable () |
Ends a table in the document. More... | |
bool | get_Bold () |
True if the font is formatted as bold. More... | |
SharedPtr< CellFormat > | get_CellFormat () |
Returns an object that represents current table cell formatting properties. More... | |
SharedPtr< Node > | get_CurrentNode () |
Gets the node that is currently selected in this DocumentBuilder. More... | |
SharedPtr< Paragraph > | get_CurrentParagraph () |
Gets the paragraph that is currently selected in this DocumentBuilder. More... | |
SharedPtr< Section > | get_CurrentSection () |
Gets the section that is currently selected in this DocumentBuilder. More... | |
SharedPtr< Story > | get_CurrentStory () |
Gets the story that is currently selected in this DocumentBuilder. More... | |
SharedPtr< Document > | get_Document () const |
Gets or sets the Document object that this object is attached to. More... | |
SharedPtr< Font > | get_Font () |
Returns an object that represents current font formatting properties. More... | |
bool | get_IsAtEndOfParagraph () |
Returns true if the cursor is at the end of the current paragraph. 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_Italic () |
True if the font is formatted as italic. More... | |
SharedPtr< ListFormat > | get_ListFormat () |
Returns an object that represents current list formatting properties. More... | |
SharedPtr< PageSetup > | get_PageSetup () |
Returns an object that represents current page setup and section properties. More... | |
SharedPtr< ParagraphFormat > | get_ParagraphFormat () |
Returns an object that represents current paragraph formatting properties. More... | |
SharedPtr< RowFormat > | get_RowFormat () |
Returns an object that represents current table row formatting properties. More... | |
Underline | get_Underline () |
Gets/sets underline type for the current font. More... | |
virtual const TypeInfo & | GetType () const override |
void | InsertBreak (BreakType breakType) |
Inserts a break of the specified type into the document. More... | |
SharedPtr< Cell > | InsertCell () |
Inserts a table cell into the document. More... | |
SharedPtr< Shape > | InsertChart (ChartType chartType, RelativeHorizontalPosition horzPos, double left, RelativeVerticalPosition vertPos, double top, double width, double height, WrapType wrapType) |
Inserts an chart object into the document and scales it to the specified size. More... | |
SharedPtr< Shape > | InsertChart (ChartType chartType, double width, double height) |
Inserts an chart object into the document and scales it to the specified size. More... | |
SharedPtr< FormField > | InsertCheckBox (const String &name, bool checkedValue, int32_t size) |
Inserts a checkbox form field at the current position. More... | |
SharedPtr< FormField > | InsertCheckBox (const String &name, bool defaultValue, bool checkedValue, int32_t size) |
Inserts a checkbox form field at the current position. More... | |
SharedPtr< FormField > | InsertComboBox (const String &name, const ArrayPtr< String > &items, int32_t selectedIndex) |
Inserts a combobox form field at the current position. More... | |
SharedPtr< Node > | InsertDocument (const SharedPtr< Document > &srcDoc, ImportFormatMode importFormatMode) |
Inserts a document at the cursor position. More... | |
SharedPtr< Node > | InsertDocument (const SharedPtr< Document > &srcDoc, ImportFormatMode importFormatMode, const SharedPtr< ImportFormatOptions > &importFormatOptions) |
Inserts a document at the cursor position. More... | |
SharedPtr< Field > | InsertField (FieldType fieldType, bool updateField) |
Inserts a Word field into a document and optionally updates the field result. More... | |
SharedPtr< Field > | InsertField (const String &fieldCode) |
Inserts a Word field into a document and updates the field result. More... | |
SharedPtr< Field > | InsertField (const String &fieldCode, const String &fieldValue) |
Inserts a Word field into a document without updating the field result. More... | |
SharedPtr< Footnote > | InsertFootnote (FootnoteType footnoteType, const String &footnoteText) |
Inserts a footnote or endnote into the document. More... | |
SharedPtr< Footnote > | InsertFootnote (FootnoteType footnoteType, const String &footnoteText, const String &referenceMark) |
Inserts a footnote or endnote into the document. More... | |
SharedPtr< Shape > | InsertHorizontalRule () |
Inserts a horizontal rule shape into the document. More... | |
void | InsertHtml (const String &html) |
Inserts an HTML string into the document. More... | |
void | InsertHtml (const String &html, HtmlInsertOptions options) |
Inserts an HTML string into the document. Allows to specify additional options. More... | |
void | InsertHtml (const String &html, bool useBuilderFormatting) |
Inserts an HTML string into the document. More... | |
SharedPtr< Field > | InsertHyperlink (const String &displayText, const String &urlOrBookmark, bool isBookmark) |
Inserts a hyperlink into the document. More... | |
SharedPtr< Shape > | InsertImage (const ArrayPtr< uint8_t > &imageBytes) |
Inserts an image from a byte array into the document. The image is inserted inline and at 100% scale. More... | |
SharedPtr< Shape > | InsertImage (const ArrayPtr< uint8_t > &imageBytes, RelativeHorizontalPosition horzPos, double left, RelativeVerticalPosition vertPos, double top, double width, double height, WrapType wrapType) |
Inserts an image from a byte array at the specified position and size. More... | |
SharedPtr< Shape > | InsertImage (const 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... | |
SharedPtr< Shape > | InsertImage (const SharedPtr< Image > &image) |
Inserts an image from a Image object into the document. The image is inserted inline and at 100% scale. More... | |
SharedPtr< Shape > | InsertImage (const SharedPtr< Image > &image, RelativeHorizontalPosition horzPos, double left, RelativeVerticalPosition vertPos, double top, double width, double height, WrapType wrapType) |
Inserts an image from a Image object at the specified position and size. More... | |
SharedPtr< Shape > | InsertImage (const SharedPtr< Image > &image, double width, double height) |
Inserts an inline image from a Image object into the document and scales it to the specified size. More... | |
SharedPtr< Shape > | InsertImage (const SharedPtr< Stream > &stream) |
Inserts an image from a stream into the document. The image is inserted inline and at 100% scale. More... | |
SharedPtr< Shape > | InsertImage (const SharedPtr< Stream > &stream, RelativeHorizontalPosition horzPos, double left, RelativeVerticalPosition vertPos, double top, double width, double height, WrapType wrapType) |
Inserts an image from a stream at the specified position and size. More... | |
SharedPtr< Shape > | InsertImage (const SharedPtr< Stream > &stream, double width, double height) |
Inserts an inline image from a stream into the document and scales it to the specified size. More... | |
SharedPtr< Shape > | InsertImage (const String &fileName) |
Inserts an image from a file or URL into the document. The image is inserted inline and at 100% scale. More... | |
SharedPtr< Shape > | InsertImage (const String &fileName, RelativeHorizontalPosition horzPos, double left, RelativeVerticalPosition vertPos, double top, double width, double height, WrapType wrapType) |
Inserts an image from a file or URL at the specified position and size. More... | |
SharedPtr< Shape > | InsertImage (const 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... | |
template<typename CharType , typename Traits > | |
SharedPtr< Shape > | InsertImage (std::basic_istream< CharType, Traits > &stream) |
template<typename CharType , typename Traits > | |
SharedPtr< Shape > | InsertImage (std::basic_istream< CharType, Traits > &stream, RelativeHorizontalPosition horzPos, double left, RelativeVerticalPosition vertPos, double top, double width, double height, WrapType wrapType) |
template<typename CharType , typename Traits > | |
SharedPtr< Shape > | InsertImage (std::basic_istream< CharType, Traits > &stream, double width, double height) |
void | InsertNode (const SharedPtr< Node > &node) |
Inserts a text level node inside the current paragraph before the cursor. More... | |
SharedPtr< Shape > | InsertOleObject (const SharedPtr< Stream > &stream, const String &progId, bool asIcon, const SharedPtr< Stream > &presentation) |
Inserts an embedded OLE object from a stream into the document. More... | |
SharedPtr< Shape > | InsertOleObject (const String &fileName, bool isLinked, bool asIcon, const SharedPtr< Stream > &presentation) |
Inserts an embedded or linked OLE object from a file into the document. Detects OLE object type using file extension. More... | |
SharedPtr< Shape > | InsertOleObject (const String &fileName, const String &progId, bool isLinked, bool asIcon, const SharedPtr< Stream > &presentation) |
Inserts an embedded or linked OLE object from a file into the document. Detects OLE object type using given progID parameter. More... | |
template<typename CharType , typename Traits > | |
SharedPtr< Shape > | InsertOleObject (std::basic_istream< CharType, Traits > &stream, String progId, bool asIcon, std::basic_istream< CharType, Traits > &presentation) |
template<typename CharType , typename Traits > | |
SharedPtr< Shape > | InsertOleObject (String fileName, bool isLinked, bool asIcon, std::basic_istream< CharType, Traits > &presentation) |
template<typename CharType , typename Traits > | |
SharedPtr< Shape > | InsertOleObject (String fileName, String progId, bool isLinked, bool asIcon, std::basic_istream< CharType, Traits > &presentation) |
SharedPtr< Shape > | InsertOleObjectAsIcon (const SharedPtr< Stream > &stream, const String &progId, const String &iconFile, const String &iconCaption) |
Inserts an embedded OLE object as icon from a stream into the document. Allows to specify icon file and caption. Detects OLE object type using given progID parameter. More... | |
SharedPtr< Shape > | InsertOleObjectAsIcon (const String &fileName, bool isLinked, const String &iconFile, const String &iconCaption) |
Inserts an embedded or linked OLE object as icon into the document. Allows to specify icon file and caption. Detects OLE object type using file extension. More... | |
SharedPtr< Shape > | InsertOleObjectAsIcon (const String &fileName, const String &progId, bool isLinked, const String &iconFile, const String &iconCaption) |
Inserts an embedded or linked OLE object as icon into the document. Allows to specify icon file and caption. Detects OLE object type using given progID parameter. More... | |
template<typename CharType , typename Traits > | |
SharedPtr< Shape > | InsertOleObjectAsIcon (std::basic_istream< CharType, Traits > &stream, String progId, String iconFile, String iconCaption) |
SharedPtr< Shape > | InsertOnlineVideo (const String &videoUrl, RelativeHorizontalPosition horzPos, double left, RelativeVerticalPosition vertPos, double top, double width, double height, WrapType wrapType) |
Inserts an online video object into the document and scales it to the specified size. More... | |
SharedPtr< Shape > | InsertOnlineVideo (const String &videoUrl, const String &videoEmbedCode, const ArrayPtr< uint8_t > &thumbnailImageBytes, RelativeHorizontalPosition horzPos, double left, RelativeVerticalPosition vertPos, double top, double width, double height, WrapType wrapType) |
Inserts an online video object into the document and scales it to the specified size. More... | |
SharedPtr< Shape > | InsertOnlineVideo (const String &videoUrl, const String &videoEmbedCode, const ArrayPtr< uint8_t > &thumbnailImageBytes, double width, double height) |
Inserts an online video object into the document and scales it to the specified size. More... | |
SharedPtr< Shape > | InsertOnlineVideo (const String &videoUrl, double width, double height) |
Inserts an online video object into the document and scales it to the specified size. More... | |
SharedPtr< Paragraph > | InsertParagraph () |
Inserts a paragraph break into the document. More... | |
SharedPtr< Shape > | InsertShape (ShapeType shapeType, RelativeHorizontalPosition horzPos, double left, RelativeVerticalPosition vertPos, double top, double width, double height, WrapType wrapType) |
Inserts free-floating shape with specified position, size and text wrap type. More... | |
SharedPtr< Shape > | InsertShape (ShapeType shapeType, double width, double height) |
Inserts inline shape with specified type and size. More... | |
SharedPtr< Shape > | InsertSignatureLine (const SharedPtr< SignatureLineOptions > &signatureLineOptions) |
Inserts a signature line at the current position. More... | |
SharedPtr< Shape > | InsertSignatureLine (const SharedPtr< SignatureLineOptions > &signatureLineOptions, RelativeHorizontalPosition horzPos, double left, RelativeVerticalPosition vertPos, double top, WrapType wrapType) |
Inserts a signature line at the specified position. More... | |
void | InsertStyleSeparator () |
Inserts style separator into the document. More... | |
SharedPtr< Field > | InsertTableOfContents (const String &switches) |
Inserts a TOC (table of contents) field into the document. More... | |
SharedPtr< FormField > | InsertTextInput (const String &name, TextFormFieldType type, const String &format, const String &fieldValue, int32_t maxLength) |
Inserts a text form field at the current position. More... | |
virtual bool | Is (const TypeInfo &target) const override |
void | MoveTo (const SharedPtr< Node > &node) |
Moves the cursor to an inline node or to the end of a paragraph. More... | |
bool | MoveToBookmark (const String &bookmarkName) |
Moves the cursor to a bookmark. More... | |
bool | MoveToBookmark (const String &bookmarkName, bool isStart, bool isAfter) |
Moves the cursor to a bookmark with greater precision. 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 | MoveToDocumentEnd () |
Moves the cursor to the end of the document. More... | |
void | MoveToDocumentStart () |
Moves the cursor to the beginning of the document. More... | |
void | MoveToField (const SharedPtr< Field > &field, bool isAfter) |
Moves the cursor to a field in the document. More... | |
void | MoveToHeaderFooter (HeaderFooterType headerFooterType) |
Moves the cursor to the beginning of a header or footer in the current section. More... | |
bool | MoveToMergeField (const String &fieldName) |
Moves the cursor to a position just beyond the specified merge field and removes the merge field. More... | |
bool | MoveToMergeField (const String &fieldName, bool isAfter, bool isDeleteField) |
Moves the merge field to the specified merge field. More... | |
void | MoveToParagraph (int32_t paragraphIndex, int32_t characterIndex) |
Moves the cursor to a paragraph in the current section. More... | |
void | MoveToSection (int32_t sectionIndex) |
Moves the cursor to the beginning of the body in a specified section. More... | |
void | PopFont () |
Retrieves character formatting previously saved on the stack. More... | |
void | PushFont () |
Saves current character formatting onto the stack. More... | |
void | set_Bold (bool value) |
Setter for get_Bold. More... | |
void | set_Document (const SharedPtr< Document > &value) |
Setter for get_Document. More... | |
void | set_Italic (bool value) |
Setter for get_Italic. More... | |
void | set_Underline (Underline value) |
Setter for get_Underline. More... | |
SharedPtr< BookmarkStart > | StartBookmark (const String &bookmarkName) |
Marks the current position in the document as a bookmark start. More... | |
SharedPtr< BookmarkStart > | StartColumnBookmark (const String &bookmarkName) |
Marks the current position in the document as a column bookmark start. The position must be in a table cell. More... | |
SharedPtr< EditableRangeStart > | StartEditableRange () |
Marks the current position in the document as an editable range start. More... | |
SharedPtr< Table > | StartTable () |
Starts a table in the document. More... | |
void | Write (const String &text) |
Inserts a string into the document at the current insert position. More... | |
void | Writeln () |
Inserts a paragraph break into the document. More... | |
void | Writeln (const String &text) |
Inserts a string and a paragraph break into the document. More... | |
Static Public Member Functions | |
static const TypeInfo & | Type () |
Aspose::Words::DocumentBuilder::DocumentBuilder | ( | ) |
Initializes a new instance of this class.
Aspose::Words::DocumentBuilder::DocumentBuilder | ( | const System::SharedPtr< Aspose::Words::Document > & | doc | ) |
Initializes a new instance of this class.
doc | The Document object to attach to. |
Shows how to insert formatted text using DocumentBuilder.
Shows how to create headers and footers in a document using DocumentBuilder.
Shows how to insert a Table of contents (TOC) into a document using heading styles as entries.
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.
tableIndex | The index of the table. |
rowIndex | The index of the row in the table. |
Shows how to delete a row from a table.
System::SharedPtr< Aspose::Words::BookmarkEnd > Aspose::Words::DocumentBuilder::EndBookmark | ( | const 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 StartBookmark() and EndBookmark() with the same bookmarkName parameter.
Badly formed bookmarks or bookmarks with duplicate names will be ignored when the document is saved.
bookmarkName | Name of the bookmark. |
Shows how create a bookmark.
Shows how to insert a hyperlink which references a local bookmark.
System::SharedPtr< Aspose::Words::BookmarkEnd > Aspose::Words::DocumentBuilder::EndColumnBookmark | ( | const System::String & | bookmarkName | ) |
Marks the current position in the document as a column bookmark end. The position must be in a table cell.
A column bookmark covers one or more columns in a range of rows. To create a valid bookmark you need to call both StartColumnBookmark() and EndColumnBookmark() with the same bookmarkName parameter.
Badly formed bookmarks or bookmarks with duplicate names will be ignored when the document is saved.
The actual position of the inserted BookmarkEnd node may differ from the current document builder position.
bookmarkName | Name of the bookmark. |
Shows how to create a column bookmark.
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 StartEditableRange and EndEditableRange or EndEditableRange() methods.
Badly formed editable range will be ignored when the document is saved.
Shows how to work with an editable range.
System::SharedPtr< Aspose::Words::EditableRangeEnd > Aspose::Words::DocumentBuilder::EndEditableRange | ( | const 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 StartEditableRange and EndEditableRange or EndEditableRange() methods.
Badly formed editable range will be ignored when the document is saved.
start | This editable range start. |
Shows how to create nested editable ranges.
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 InsertCell immediately after that, then the table continues on a new row.
Use the RowFormat property to specify row formatting.
Shows how to merge table cells vertically.
Shows how to build a table with custom borders.
Shows how to build a formatted 2x2 table.
System::SharedPtr< Aspose::Words::Tables::Table > Aspose::Words::DocumentBuilder::EndTable | ( | ) |
Ends a table in the document.
This method should be called only once after EndRow was called. When called, EndTable moves the cursor out of the current cell to point just after the table.
Shows how to build a table with custom borders.
Shows how to build a formatted 2x2 table.
Shows how to format cells with a document builder.
bool Aspose::Words::DocumentBuilder::get_Bold | ( | ) |
True if the font is formatted as bold.
Shows how to fill MERGEFIELDs with data with a document builder instead of a mail merge.
System::SharedPtr< Aspose::Words::Tables::CellFormat > Aspose::Words::DocumentBuilder::get_CellFormat | ( | ) |
Returns an object that represents current table cell formatting properties.
Shows how to build a table with custom borders.
Shows how to build a formatted 2x2 table.
Shows how to format cells with a document builder.
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.
Shows how to move a document builder's cursor to different nodes in a document.
System::SharedPtr< Aspose::Words::Paragraph > Aspose::Words::DocumentBuilder::get_CurrentParagraph | ( | ) |
Gets the paragraph that is currently selected in this DocumentBuilder.
Shows how to move a document builder's cursor to different nodes in a document.
System::SharedPtr< Aspose::Words::Section > Aspose::Words::DocumentBuilder::get_CurrentSection | ( | ) |
Gets the section that is currently selected in this DocumentBuilder.
Shows how to insert a floating image, and specify its position and size.
System::SharedPtr< Aspose::Words::Story > Aspose::Words::DocumentBuilder::get_CurrentStory | ( | ) |
Gets the story that is currently selected in this DocumentBuilder.
Shows how to work with a document builder's current story.
System::SharedPtr< Aspose::Words::Document > Aspose::Words::DocumentBuilder::get_Document | ( | ) | const |
Gets or sets the Document object that this object is attached to.
Shows how to apply and revert page setup settings to sections in a document.
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.
Shows how to insert a string surrounded by a border into a document.
Shows how to create a formatted table using DocumentBuilder.
bool Aspose::Words::DocumentBuilder::get_IsAtEndOfParagraph | ( | ) |
Returns true if the cursor is at the end of the current paragraph.
Shows how to move a document builder's cursor to different nodes in a document.
bool Aspose::Words::DocumentBuilder::get_IsAtStartOfParagraph | ( | ) |
Returns true if the cursor is at the beginning of the current paragraph (no text before the cursor).
Shows how to move a document builder's cursor to different nodes in a document.
bool Aspose::Words::DocumentBuilder::get_Italic | ( | ) |
True if the font is formatted as italic.
Shows how to fill MERGEFIELDs with data with a document builder instead of a mail merge.
System::SharedPtr< Aspose::Words::Lists::ListFormat > Aspose::Words::DocumentBuilder::get_ListFormat | ( | ) |
Returns an object that represents current list formatting properties.
Shows how to create bulleted and numbered lists.
System::SharedPtr< Aspose::Words::PageSetup > Aspose::Words::DocumentBuilder::get_PageSetup | ( | ) |
Returns an object that represents current page setup and section properties.
Shows how to apply and revert page setup settings to sections in a document.
System::SharedPtr< Aspose::Words::ParagraphFormat > Aspose::Words::DocumentBuilder::get_ParagraphFormat | ( | ) |
Returns an object that represents current paragraph formatting properties.
Shows how to create a formatted table using DocumentBuilder.
System::SharedPtr< Aspose::Words::Tables::RowFormat > Aspose::Words::DocumentBuilder::get_RowFormat | ( | ) |
Returns an object that represents current table row formatting properties.
Shows how to build a table with custom borders.
Shows how to build a formatted 2x2 table.
Shows how to format rows with a document builder.
Aspose::Words::Underline Aspose::Words::DocumentBuilder::get_Underline | ( | ) |
Gets/sets underline type for the current font.
Shows how to format text inserted by a document builder.
|
overridevirtual |
void Aspose::Words::DocumentBuilder::InsertBreak | ( | Aspose::Words::BreakType | breakType | ) |
Inserts a break of the specified type into the document.
breakType | Specifies the type of the break to insert. |
Shows how to create headers and footers in a document using DocumentBuilder.
Shows how to insert a Table of contents (TOC) into a document using heading styles as entries.
Shows how to apply and revert page setup settings to sections in a document.
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 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 EndRow.
Use the CellFormat property to specify cell formatting.
Shows how to build a table with custom borders.
Shows how to use a document builder to create a table.
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.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
chartType | The chart type to insert into the document. |
horzPos | Specifies where the distance to the image is measured from. |
left | Distance in points from the origin to the left side of the image. |
vertPos | Specifies where the distance to the image measured from. |
top | Distance in points from the origin to the top side of the image. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
wrapType | Specifies how to wrap text around the image. |
Shows how to specify position and wrapping while inserting a chart.
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.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
chartType | The chart type to insert into the document. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
Shows how to insert a pie chart into a document.
System::SharedPtr< Aspose::Words::Fields::FormField > Aspose::Words::DocumentBuilder::InsertCheckBox | ( | const 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.
name | The name of the form field. Can be an empty string. The value longer than 20 characters will be truncated. |
checkedValue | Checked status of the checkbox form field. |
size | Specifies the size of the checkbox in points. Specify 0 for MS Word to calculate the size of the checkbox automatically. |
Shows how to insert checkboxes into the document.
System::SharedPtr< Aspose::Words::Fields::FormField > Aspose::Words::DocumentBuilder::InsertCheckBox | ( | const 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.
name | The name of the form field. Can be an empty string. The value longer than 20 characters will be truncated. |
defaultValue | Default value of the checkbox form field. |
checkedValue | Current checked status of the checkbox form field. |
size | Specifies the size of the checkbox in points. Specify 0 for MS Word to calculate the size of the checkbox automatically. |
Shows how to insert checkboxes into the document.
System::SharedPtr< Aspose::Words::Fields::FormField > Aspose::Words::DocumentBuilder::InsertComboBox | ( | const System::String & | name, |
const 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.
name | The name of the form field. Can be an empty string. The value longer than 20 characters will be truncated. |
items | The items of the ComboBox. Maximum is 25 items. |
selectedIndex | The index of the selected item in the ComboBox. |
Shows how to create form fields.
Shows how to insert a combo box form field into a document.
System::SharedPtr< Aspose::Words::Node > Aspose::Words::DocumentBuilder::InsertDocument | ( | const System::SharedPtr< Aspose::Words::Document > & | srcDoc, |
Aspose::Words::ImportFormatMode | importFormatMode | ||
) |
Inserts a document at the cursor position.
srcDoc | Source document for inserting. |
importFormatMode | Specifies how to merge style formatting that clashes. |
Shows how to insert a document into another document.
System::SharedPtr< Aspose::Words::Node > Aspose::Words::DocumentBuilder::InsertDocument | ( | const System::SharedPtr< Aspose::Words::Document > & | srcDoc, |
Aspose::Words::ImportFormatMode | importFormatMode, | ||
const System::SharedPtr< Aspose::Words::ImportFormatOptions > & | importFormatOptions | ||
) |
Inserts a document at the cursor position.
srcDoc | Source document for inserting. |
importFormatMode | Specifies how to merge style formatting that clashes. |
importFormatOptions | Allows to specify options that affect formatting of a result document. |
Shows how to resolve duplicate styles while inserting documents.
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 InsertField() overload.
fieldType | The type of the field to append. |
updateField | Specifies whether to update the field immediately. |
Shows how to insert a field into a document using FieldType.
System::SharedPtr< Aspose::Words::Fields::Field > Aspose::Words::DocumentBuilder::InsertField | ( | const 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 InsertField() overload.
fieldCode | The field code to insert (without curly braces). |
Shows how to insert fields, and move the document builder's cursor to them.
Shows how to insert a field into a document using a field code.
System::SharedPtr< Aspose::Words::Fields::Field > Aspose::Words::DocumentBuilder::InsertField | ( | const System::String & | fieldCode, |
const 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 Update on the field object returned to you or UpdateFields to update fields in the whole document.
fieldCode | The field code to insert (without curly braces). |
fieldValue | The field value to insert. Pass null for fields that do not have a value. |
Shows how to set up page numbering in a section.
System::SharedPtr< Aspose::Words::Notes::Footnote > Aspose::Words::DocumentBuilder::InsertFootnote | ( | Aspose::Words::Notes::FootnoteType | footnoteType, |
const System::String & | footnoteText | ||
) |
Inserts a footnote or endnote into the document.
footnoteType | Specifies whether to insert a footnote or an endnote. |
footnoteText | Specifies the text of the footnote. |
Shows how to reference text with a footnote and an endnote.
System::SharedPtr< Aspose::Words::Notes::Footnote > Aspose::Words::DocumentBuilder::InsertFootnote | ( | Aspose::Words::Notes::FootnoteType | footnoteType, |
const System::String & | footnoteText, | ||
const System::String & | referenceMark | ||
) |
Inserts a footnote or endnote into the document.
footnoteType | Specifies whether to insert a footnote or an endnote. |
footnoteText | Specifies the text of the footnote. |
referenceMark | Specifies the custom reference mark of the footnote. |
Shows how to reference text with a footnote and an endnote.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertHorizontalRule | ( | ) |
Inserts a horizontal rule shape into the document.
Shows how to insert a horizontal rule shape, and customize its formatting.
void Aspose::Words::DocumentBuilder::InsertHtml | ( | const System::String & | html | ) |
Inserts an HTML string into the document.
html | An HTML string to insert into the document. |
Shows how to use a document builder to insert html content into a document.
Shows how to execute a mail merge with a custom callback that handles merge data in the form of HTML documents.
void Aspose::Words::DocumentBuilder::InsertHtml | ( | const System::String & | html, |
Aspose::Words::HtmlInsertOptions | options | ||
) |
Inserts an HTML string into the document. Allows to specify additional options.
html | An HTML string to insert into the document. |
options | Options that are used when HTML string is inserted. |
Shows how to use options while inserting html.
void Aspose::Words::DocumentBuilder::InsertHtml | ( | const System::String & | html, |
bool | useBuilderFormatting | ||
) |
Inserts an HTML string into the document.
You can use this method to insert an HTML fragment or whole HTML document.
When useBuilderFormatting is false
, 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 DocumentBuilder formatting, and the text looks as if it were inserted with Write().
html | An HTML string to insert into the document. |
useBuilderFormatting | A value indicating whether formatting specified in DocumentBuilder is used as base formatting for text imported from HTML. |
Shows how to apply a document builder's formatting while inserting HTML content.
System::SharedPtr< Aspose::Words::Fields::Field > Aspose::Words::DocumentBuilder::InsertHyperlink | ( | const System::String & | displayText, |
const 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 Font property.
This methods internally calls InsertField() to insert an MS Word HYPERLINK field into the document.
displayText | Text of the link to be displayed in the document. |
urlOrBookmark | Link 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. |
isBookmark | True if the previous parameter is a name of a bookmark inside the document; false is the previous parameter is a URL. |
Shows how to insert a hyperlink field.
Shows how to use a document builder's formatting stack.
Shows how to insert a hyperlink which references a local bookmark.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const System::ArrayPtr< uint8_t > & | imageBytes | ) |
Inserts an image from a byte array into the document. The image is inserted inline and at 100% scale.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
imageBytes | The byte array that contains the image. |
Shows how to insert an image from a byte array into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const 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.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
imageBytes | The byte array that contains the image. |
horzPos | Specifies where the distance to the image is measured from. |
left | Distance in points from the origin to the left side of the image. |
vertPos | Specifies where the distance to the image measured from. |
top | Distance in points from the origin to the top side of the image. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
wrapType | Specifies how to wrap text around the image. |
Shows how to insert an image from a byte array into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const 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.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
imageBytes | The byte array that contains the image. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
Shows how to insert an image from a byte array into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const System::SharedPtr< System::Drawing::Image > & | image | ) |
Inserts an image from a Image object into the document. The image is inserted inline and at 100% scale.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
image | The image to insert into the document. |
Shows how to insert an image from an object into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const 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 Image object at the specified position and size.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
image | The image to insert into the document. |
horzPos | Specifies where the distance to the image is measured from. |
left | Distance in points from the origin to the left side of the image. |
vertPos | Specifies where the distance to the image measured from. |
top | Distance in points from the origin to the top side of the image. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
wrapType | Specifies how to wrap text around the image. |
Shows how to insert an image from an object into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const System::SharedPtr< System::Drawing::Image > & | image, |
double | width, | ||
double | height | ||
) |
Inserts an inline image from a Image object into the document and scales it to the specified size.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
image | The image to insert into the document. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
Shows how to insert an image from an object into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const System::SharedPtr< System::IO::Stream > & | stream | ) |
Inserts an image from a stream into the document. The image is inserted inline and at 100% scale.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
stream | The stream that contains the image. |
Shows how to insert an image from a stream into a document.
Shows how to insert a shape with an image from a stream into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const 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.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
stream | The stream that contains the image. |
horzPos | Specifies where the distance to the image is measured from. |
left | Distance in points from the origin to the left side of the image. |
vertPos | Specifies where the distance to the image measured from. |
top | Distance in points from the origin to the top side of the image. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
wrapType | Specifies how to wrap text around the image. |
Shows how to insert an image from a stream into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const 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.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
stream | The stream that contains the image. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
Shows how to insert an image from a stream into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const System::String & | fileName | ) |
Inserts an image from a file or URL into the document. The image is inserted inline and at 100% scale.
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 Shape object returned by this method.
fileName | The file with the image. Can be any valid local or remote URI. |
Shows how to insert an image from the local file system into a document.
Shows how to determine which image will be inserted.
Shows how to insert gif image to the document.
Shows how to insert a shape with an image into a document.
Shows how to insert a floating image to the center of a page.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const 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.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
fileName | The file that contains the image. |
horzPos | Specifies where the distance to the image is measured from. |
left | Distance in points from the origin to the left side of the image. |
vertPos | Specifies where the distance to the image measured from. |
top | Distance in points from the origin to the top side of the image. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
wrapType | Specifies how to wrap text around the image. |
Shows how to insert an image.
Shows how to insert an image from the local file system into a document while preserving its dimensions.
Shows how to insert an image from the local file system into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertImage | ( | const 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.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
fileName | The file that contains the image. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
Shows how to insert an image from the local file system into a document.
|
inline |
|
inline |
|
inline |
void Aspose::Words::DocumentBuilder::InsertNode | ( | const System::SharedPtr< Aspose::Words::Node > & | node | ) |
Inserts a text level node inside the current paragraph before the cursor.
Shows how to insert a linked image into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertOleObject | ( | const System::SharedPtr< System::IO::Stream > & | stream, |
const System::String & | progId, | ||
bool | asIcon, | ||
const System::SharedPtr< System::IO::Stream > & | presentation | ||
) |
Inserts an embedded OLE object from a stream into the document.
stream | Stream containing application data. |
progId | Programmatic Identifier of OLE object. |
asIcon | Specifies either Iconic or Normal mode of OLE object being inserted. |
presentation | Image presentation of OLE object. If value is null Aspose.Words will use one of the predefined images. |
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertOleObject | ( | const System::String & | fileName, |
bool | isLinked, | ||
bool | asIcon, | ||
const System::SharedPtr< System::IO::Stream > & | presentation | ||
) |
Inserts an embedded or linked OLE object from a file into the document. Detects OLE object type using file extension.
fileName | Full path to the file. |
isLinked | If true then linked OLE object is inserted otherwise embedded OLE object is inserted. |
asIcon | Specifies either Iconic or Normal mode of OLE object being inserted. |
presentation | Image presentation of OLE object. If value is null Aspose.Words will use one of the predefined images. |
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertOleObject | ( | const System::String & | fileName, |
const System::String & | progId, | ||
bool | isLinked, | ||
bool | asIcon, | ||
const System::SharedPtr< System::IO::Stream > & | presentation | ||
) |
Inserts an embedded or linked OLE object from a file into the document. Detects OLE object type using given progID parameter.
fileName | Full path to the file. |
progId | ProgId of OLE object. |
isLinked | If true then linked OLE object is inserted otherwise embedded OLE object is inserted. |
asIcon | Specifies either Iconic or Normal mode of OLE object being inserted. |
presentation | Image presentation of OLE object. If value is null Aspose.Words will use one of the predefined images. |
|
inline |
|
inline |
|
inline |
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertOleObjectAsIcon | ( | const System::SharedPtr< System::IO::Stream > & | stream, |
const System::String & | progId, | ||
const System::String & | iconFile, | ||
const System::String & | iconCaption | ||
) |
Inserts an embedded OLE object as icon from a stream into the document. Allows to specify icon file and caption. Detects OLE object type using given progID parameter.
stream | Stream containing application data. |
progId | ProgId of OLE object. |
iconFile | Full path to the ICO file. If the value is null, Aspose.Words will use a predefined image. |
iconCaption | Icon caption. If the value is null, Aspose.Words will use the a predefined icon caption. |
Shows how to insert an embedded or linked OLE object as icon into the document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertOleObjectAsIcon | ( | const System::String & | fileName, |
bool | isLinked, | ||
const System::String & | iconFile, | ||
const System::String & | iconCaption | ||
) |
Inserts an embedded or linked OLE object as icon into the document. Allows to specify icon file and caption. Detects OLE object type using file extension.
fileName | Full path to the file. |
isLinked | If true then linked OLE object is inserted otherwise embedded OLE object is inserted. |
iconFile | Full path to the ICO file. If the value is null, Aspose.Words will use a predefined image. |
iconCaption | Icon caption. If the value is null, Aspose.Words will use the file name. |
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertOleObjectAsIcon | ( | const System::String & | fileName, |
const System::String & | progId, | ||
bool | isLinked, | ||
const System::String & | iconFile, | ||
const System::String & | iconCaption | ||
) |
Inserts an embedded or linked OLE object as icon into the document. Allows to specify icon file and caption. Detects OLE object type using given progID parameter.
fileName | Full path to the file. |
progId | ProgId of OLE object. |
isLinked | If true then linked OLE object is inserted otherwise embedded OLE object is inserted. |
iconFile | Full path to the ICO file. If the value is null, Aspose.Words will use a predefined image. |
iconCaption | Icon caption. If the value is null, Aspose.Words will use the file name. |
Shows how to insert an embedded or linked OLE object as icon into the document.
|
inline |
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertOnlineVideo | ( | const System::String & | videoUrl, |
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.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
Insertion of online video from the following resources is supported:
If your online video is not displaying correctly, use InsertOnlineVideo(), which accepts custom embedded html code.
The code for embedding video can vary between providers, consult your corresponding provider of choice for details.
videoUrl | The URL to the video. |
horzPos | Specifies where the distance to the image is measured from. |
left | Distance in points from the origin to the left side of the image. |
vertPos | Specifies where the distance to the image measured from. |
top | Distance in points from the origin to the top side of the image. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
wrapType | Specifies how to wrap text around the image. |
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertOnlineVideo | ( | const System::String & | videoUrl, |
const System::String & | videoEmbedCode, | ||
const 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.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
videoUrl | The URL to the video. |
videoEmbedCode | The embed code for the video. |
thumbnailImageBytes | The thumbnail image bytes. |
horzPos | Specifies where the distance to the image is measured from. |
left | Distance in points from the origin to the left side of the image. |
vertPos | Specifies where the distance to the image measured from. |
top | Distance in points from the origin to the top side of the image. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
wrapType | Specifies how to wrap text around the image. |
Shows how to insert an online video into a document with a custom thumbnail.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertOnlineVideo | ( | const System::String & | videoUrl, |
const System::String & | videoEmbedCode, | ||
const System::ArrayPtr< uint8_t > & | thumbnailImageBytes, | ||
double | width, | ||
double | height | ||
) |
Inserts an online video object into the document and scales it to the specified size.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
videoUrl | The URL to the video. |
videoEmbedCode | The embed code for the video. |
thumbnailImageBytes | The thumbnail image bytes. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
Shows how to insert an online video into a document with a custom thumbnail.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertOnlineVideo | ( | const System::String & | videoUrl, |
double | width, | ||
double | height | ||
) |
Inserts an online video object into the document and scales it to the specified size.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
Insertion of online video from the following resources is supported:
If your online video is not displaying correctly, use InsertOnlineVideo(), which accepts custom embedded html code.
The code for embedding video can vary between providers, consult your corresponding provider of choice for details.
videoUrl | The URL to the video. |
width | The width of the image in points. Can be a negative or zero value to request 100% scale. |
height | The height of the image in points. Can be a negative or zero value to request 100% scale. |
Shows how to insert an online video into a document using a URL.
System::SharedPtr< Aspose::Words::Paragraph > Aspose::Words::DocumentBuilder::InsertParagraph | ( | ) |
Inserts a paragraph break into the document.
Current paragraph formatting specified by the 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.
Shows how to insert a paragraph into the document.
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.
shapeType | The shape type to insert into the document |
horzPos | Specifies where the horizontal distance to the shape is measured from. |
left | Distance in points from the origin to the left side of the shape. |
vertPos | Specifies where the vertical distance to the shape is measured from. |
top | Distance in points from the origin to the top side of the shape. |
width | The width of the shape in points. |
height | The width of the shape in points. |
wrapType | Specifies how to wrap text around the shape. |
Shows how to insert DML shapes into a document.
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.
shapeType | The shape type to insert into the document. |
width | The width of the shape in points. |
height | The height of the shape in points. |
Shows how to insert DML shapes into a document.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertSignatureLine | ( | const System::SharedPtr< Aspose::Words::SignatureLineOptions > & | signatureLineOptions | ) |
Inserts a signature line at the current position.
signatureLineOptions | The object that stores parameters of creating signature line. |
Shows how to sign a document with a personal certificate and a signature line.
System::SharedPtr< Aspose::Words::Drawing::Shape > Aspose::Words::DocumentBuilder::InsertSignatureLine | ( | const System::SharedPtr< Aspose::Words::SignatureLineOptions > & | signatureLineOptions, |
Aspose::Words::Drawing::RelativeHorizontalPosition | horzPos, | ||
double | left, | ||
Aspose::Words::Drawing::RelativeVerticalPosition | vertPos, | ||
double | top, | ||
Aspose::Words::Drawing::WrapType | wrapType | ||
) |
Inserts a signature line at the specified position.
You can change the image size, location, positioning method and other settings using the Shape object returned by this method.
signatureLineOptions | The object that stores parameters of creating signature line. |
horzPos | Specifies where the distance to the signature line is measured from. |
left | Distance in points from the origin to the left side of the signature line. |
vertPos | Specifies where the distance to the signature line measured from. |
top | Distance in points from the origin to the top side of the signature line. |
wrapType | Specifies how to wrap text around the signature line. |
Shows how to insert an inline signature line into a document.
void Aspose::Words::DocumentBuilder::InsertStyleSeparator | ( | ) |
Inserts style separator into the document.
Shows how to work with style separators.
System::SharedPtr< Aspose::Words::Fields::Field > Aspose::Words::DocumentBuilder::InsertTableOfContents | ( | const 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.
switches | The TOC field switches. |
Shows how to insert a Table of contents (TOC) into a document using heading styles as entries.
System::SharedPtr< Aspose::Words::Fields::FormField > Aspose::Words::DocumentBuilder::InsertTextInput | ( | const System::String & | name, |
Aspose::Words::Fields::TextFormFieldType | type, | ||
const System::String & | format, | ||
const 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.
name | The name of the form field. Can be an empty string. |
type | Specifies the type of the text form field. |
format | Format string used to format the value of the form field. |
fieldValue | Text that will be shown in the field. |
maxLength | Maximum length the user can enter into the form field. Set to zero for unlimited length. |
Shows how to create form fields.
Shows how to insert a text input form field into a document.
Shows how to insert a text input form field.
|
overridevirtual |
void Aspose::Words::DocumentBuilder::MoveTo | ( | const 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.
node | The node must be a paragraph or a direct child of a paragraph. |
Shows how to move a document builder's cursor to different nodes in a document.
Shows how to move a DocumentBuilder's cursor position to a specified node.
bool Aspose::Words::DocumentBuilder::MoveToBookmark | ( | const 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.
bookmarkName | The name of the bookmark to move the cursor to. |
Shows how to move a document builder's cursor to different nodes in a document.
bool Aspose::Words::DocumentBuilder::MoveToBookmark | ( | const 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.
bookmarkName | The name of the bookmark to move the cursor to. |
isStart | When true, moves the cursor to the beginning of the bookmark. When false, moves the cursor to the end of the bookmark. |
isAfter | When 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. |
Shows how to move a document builder's node insertion point cursor to a bookmark.
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.
tableIndex | The index of the table to move to. |
rowIndex | The index of the row in the table. |
columnIndex | The index of the column in the table. |
characterIndex | The index of the character inside the cell. A negative value allows you to specify a position from the end of the cell. Use -1 to move to the end of the cell. |
Shows how to move a document builder's cursor to a cell in a table.
void Aspose::Words::DocumentBuilder::MoveToDocumentEnd | ( | ) |
Moves the cursor to the end of the document.
Shows how to move a document builder's cursor to different nodes in a document.
void Aspose::Words::DocumentBuilder::MoveToDocumentStart | ( | ) |
Moves the cursor to the beginning of the document.
Shows how to move a document builder's cursor to different nodes in a document.
void Aspose::Words::DocumentBuilder::MoveToField | ( | const System::SharedPtr< Aspose::Words::Fields::Field > & | field, |
bool | isAfter | ||
) |
Moves the cursor to a field in the document.
field | The field to move the cursor to. |
isAfter | When true, moves the cursor to be after the field end. When false, moves the cursor to be before the field start. |
Shows how to move a document builder's node insertion point cursor to a specific field.
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 DifferentFirstPageHeaderFooter.
If you want to create headers and footers different for even and odd pages, you need to set OddAndEvenPagesHeaderFooter.
Use MoveToSection() to move out of the header into the main text.
headerFooterType | Specifies the header or footer to move to. |
Shows how to create headers and footers in a document using DocumentBuilder.
Shows how to insert an image, and use it as a watermark.
bool Aspose::Words::DocumentBuilder::MoveToMergeField | ( | const 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.
fieldName | The case-insensitive name of the mail merge field. |
Shows how to fill MERGEFIELDs with data with a document builder instead of a mail merge.
bool Aspose::Words::DocumentBuilder::MoveToMergeField | ( | const System::String & | fieldName, |
bool | isAfter, | ||
bool | isDeleteField | ||
) |
Moves the merge field to the specified merge field.
fieldName | The case-insensitive name of the mail merge field. |
isAfter | When true, moves the cursor to be after the field end. When false, moves the cursor to be before the field start. |
isDeleteField | When true, deletes the merge field. |
Shows how to insert fields, and move the document builder's cursor to them.
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.
paragraphIndex | The index of the paragraph to move to. |
characterIndex | The index of the character inside the paragraph. A negative value allows you to specify a position from the end of the paragraph. Use -1 to move to the end of the paragraph. |
Shows how to move a builder's cursor position to a specified paragraph.
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.
sectionIndex | The index of the section to move to. |
Shows how to create headers and footers in a document using DocumentBuilder.
void Aspose::Words::DocumentBuilder::PopFont | ( | ) |
Retrieves character formatting previously saved on the stack.
Shows how to use a document builder's formatting stack.
void Aspose::Words::DocumentBuilder::PushFont | ( | ) |
Saves current character formatting onto the stack.
Shows how to use a document builder's formatting stack.
void Aspose::Words::DocumentBuilder::set_Bold | ( | bool | value | ) |
Setter for Aspose::Words::DocumentBuilder::get_Bold.
void Aspose::Words::DocumentBuilder::set_Document | ( | const System::SharedPtr< Aspose::Words::Document > & | value | ) |
Setter for Aspose::Words::DocumentBuilder::get_Document.
void Aspose::Words::DocumentBuilder::set_Italic | ( | bool | value | ) |
Setter for Aspose::Words::DocumentBuilder::get_Italic.
void Aspose::Words::DocumentBuilder::set_Underline | ( | Aspose::Words::Underline | value | ) |
Setter for Aspose::Words::DocumentBuilder::get_Underline.
System::SharedPtr< Aspose::Words::BookmarkStart > Aspose::Words::DocumentBuilder::StartBookmark | ( | const 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 StartBookmark() and EndBookmark() with the same bookmarkName parameter.
Badly formed bookmarks or bookmarks with duplicate names will be ignored when the document is saved.
bookmarkName | Name of the bookmark. |
Shows how create a bookmark.
Shows how to insert a hyperlink which references a local bookmark.
System::SharedPtr< Aspose::Words::BookmarkStart > Aspose::Words::DocumentBuilder::StartColumnBookmark | ( | const System::String & | bookmarkName | ) |
Marks the current position in the document as a column bookmark start. The position must be in a table cell.
A column bookmark covers one or more columns in a range of rows. To create a valid bookmark you need to call both StartColumnBookmark() and EndColumnBookmark() with the same bookmarkName parameter.
Badly formed bookmarks or bookmarks with duplicate names will be ignored when the document is saved.
The actual position of the inserted BookmarkStart node may differ from the current document builder position.
bookmarkName | Name of the bookmark. |
Shows how to create a column bookmark.
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 StartEditableRange and EndEditableRange or EndEditableRange() methods.
Badly formed editable range will be ignored when the document is saved.
Shows how to work with an editable range.
Shows how to create nested editable ranges.
System::SharedPtr< Aspose::Words::Tables::Table > Aspose::Words::DocumentBuilder::StartTable | ( | ) |
Starts a table in the document.
The next method to call is InsertCell.
This method starts a nested table when called inside a cell.
Shows how to build a table with custom borders.
Shows how to build a formatted 2x2 table.
Shows how to format cells with a document builder.
|
static |
void Aspose::Words::DocumentBuilder::Write | ( | const System::String & | text | ) |
Inserts a string into the document at the current insert position.
text | The string to insert into the document. |
Shows how to insert a string surrounded by a border into a document.
Shows how to build a table with custom borders.
Shows how to use a document builder to create a table.
Shows how to build a formatted 2x2 table.
void Aspose::Words::DocumentBuilder::Writeln | ( | ) |
Inserts a paragraph break into the document.
Calls InsertParagraph.
void Aspose::Words::DocumentBuilder::Writeln | ( | const System::String & | text | ) |
Inserts a string and a paragraph break into the document.
text | The string to insert into the document. |
Shows how to create headers and footers in a document using DocumentBuilder.
Shows how to build a formatted 2x2 table.