com.aspose.words
Class Document

java.lang.Object
  extended by Node
      extended by CompositeNode
          extended by DocumentBase
              extended by com.aspose.words.Document
All Implemented Interfaces:
java.lang.Iterable, java.lang.Cloneable

public class Document 
extends DocumentBase

Represents a Word document.

The Document is a central object in the Aspose.Words library.

To load an existing document in any of the LoadFormat formats, pass a file name or a stream into one of the Document constructors. To create a blank document, call the constructor without parameters.

Use one of the Save method overloads to save the document in any of the SaveFormat formats.

To draw document pages directly onto a Graphics object use #Error Cref: M:Aspose.Words.Document.RenderToScale(System.Int32,System.Drawing.Graphics,System.Single,System.Single,System.Single) or #Error Cref: M:Aspose.Words.Document.RenderToSize(System.Int32,System.Drawing.Graphics,System.Single,System.Single,System.Single,System.Single) method.

To print the document, use one of the #Error Cref: M:Aspose.Words.Document.Print(System.String) methods.

MailMerge is the Aspose.Words's reporting engine that allows to populate reports designed in Microsoft Word with data from various data sources quickly and easily. The data can be from a java.sql.ResultSet or an array of values. MailMerge will go through the records found in the data source and insert them into mail merge fields in the document growing it as necessary.

Document stores document-wide information such as Styles, BuiltInDocumentProperties, CustomDocumentProperties, lists and macros. Most of these objects are accessible via the corresponding properties of the Document.

The Document is a root node of a tree that contains all other nodes of the document. The tree is a Composite design pattern and in many ways similar to XmlDocument. The content of the document can be manipulated freely programmatically:

Consider using DocumentBuilder that simplifies the task of programmatically creating or populating the document tree.

The Document can contain only Section objects.

In Microsoft Word, a valid document needs to have at least one section.


Constructor Summary
Document()
           Creates a blank Word document.
Document(java.lang.String fileName)
           Opens an existing document from a file. Automatically detects the file format.
Document(java.lang.String fileName, LoadOptions loadOptions)
           Opens an existing document from a file. Allows to specify additional options such as an encryption password.
Document(java.io.InputStream stream)
           Opens an existing document from a stream. Automatically detects the file format.
Document(java.io.InputStream stream, LoadOptions loadOptions)
           Opens an existing document from a stream. Allows to specify additional options such as an encryption password.
 
Property Getters/Setters Summary
java.lang.StringgetAttachedTemplate()
voidsetAttachedTemplate(java.lang.String value)
           Gets or sets the full path of the template attached to the document.
booleangetAutomaticallyUpdateSyles()
voidsetAutomaticallyUpdateSyles(boolean value)
           Gets or sets a flag indicating whether the styles in the document are updated to match the styles in the attached template each time the document is opened in MS Word.
ShapegetBackgroundShape()→ inherited from DocumentBase
voidsetBackgroundShape(Shape value)
           Gets or sets the background shape of the document. Can be null.
Aspose.Words.Properties.BuiltInDocumentPropertiesgetBuiltInDocumentProperties()
           Returns a collection that represents all the built-in document properties of the document.
NodeCollectiongetChildNodes()→ inherited from CompositeNode
           Gets all immediate child nodes of this node.
Aspose.Words.Settings.CompatibilityOptionsgetCompatibilityOptions()
           Provides access to document compatibility options (that is, the user preferences entered on the Compatibility tab of the Options dialog in Word).
Aspose.Words.Saving.OoxmlCompliancegetCompliance()
           Gets the OOXML compliance version determined from the loaded document content. Makes sense only for OOXML documents.
intgetCount()→ inherited from CompositeNode
           Gets the number of immediate children of this node.
Aspose.Words.Properties.CustomDocumentPropertiesgetCustomDocumentProperties()
           Returns a collection that represents all the custom document properties of the document.
Aspose.Words.Markup.CustomXmlPartCollectiongetCustomXmlParts()
           Gets or sets the collection of Custom XML Data Storage Parts.
doublegetDefaultTabStop()
voidsetDefaultTabStop(double value)
           Gets or sets the interval (in points) between the default tab stops.
DigitalSignatureCollectiongetDigitalSignatures()
           Gets the collection of digital signatures for this document and their validation results.
DocumentBasegetDocument()→ inherited from Node
           Gets the document to which this node belongs.
EndnoteOptionsgetEndnoteOptions()
           Provides options that control numbering and positioning of endnotes in this document.
Aspose.Words.Fields.FieldOptionsgetFieldOptions()
           Gets a FieldOptions object that represents options to control field handling in the document.
NodegetFirstChild()→ inherited from CompositeNode
           Gets the first child of the node.
SectiongetFirstSection()
           Gets the first section in the document.
Aspose.Words.Fonts.FontInfoCollectiongetFontInfos()→ inherited from DocumentBase
           Provides access to properties of fonts used in this document.
Aspose.Words.Fonts.FontSettingsgetFontSettings()
           Gets or sets document font settings.
FootnoteOptionsgetFootnoteOptions()
           Provides options that control numbering and positioning of footnotes in this document.
GlossaryDocumentgetGlossaryDocument()
voidsetGlossaryDocument(GlossaryDocument value)
           Gets or sets the glossary document within this document or template. A glossary document is a storage for AutoText, AutoCorrect and Building Block entries defined in a document.
booleanhasChildNodes()→ inherited from CompositeNode
           Returns true if this node has any child nodes.
booleanhasMacros()
           Returns true if the document has a VBA project (macros).
booleanhasRevisions()
           Returns true if the document has any tracked changes.
Aspose.Words.Settings.HyphenationOptionsgetHyphenationOptions()
           Provides access to document hyphenation options.
booleanisComposite()→ inherited from CompositeNode
           Returns true as this node can have child nodes.
NodegetLastChild()→ inherited from CompositeNode
           Gets the last child of the node.
SectiongetLastSection()
           Gets the last section in the document.
Aspose.Words.Layout.LayoutOptionsgetLayoutOptions()
           Gets a LayoutOptions object that represents options to control the layout process of this document.
Aspose.Words.Lists.ListCollectiongetLists()→ inherited from DocumentBase
           Provides access to the list formatting used in the document.
Aspose.Words.MailMerging.MailMergegetMailMerge()
           Returns a MailMerge object that represents the mail merge functionality for the document.
Aspose.Words.Settings.MailMergeSettingsgetMailMergeSettings()
           Gets or sets the object that contains all of the mail merge information for a document.
NodegetNextSibling()→ inherited from Node
           Gets the node immediately following this node.
INodeChangingCallbackgetNodeChangingCallback()→ inherited from DocumentBase
voidsetNodeChangingCallback(INodeChangingCallback value)
           Called when a node is inserted or removed in the document.
intgetNodeType()
           Returns NodeType.Document. The value of the property is NodeType integer constant.
java.lang.StringgetOriginalFileName()
           Gets the original file name of the document.
intgetOriginalLoadFormat()
           Gets the format of the original document that was loaded into this object. The value of the property is LoadFormat integer constant.
Aspose.Words.Markup.CustomPartCollectiongetPackageCustomParts()
           Gets or sets the collection of custom parts (arbitrary content) that are linked to the OOXML package using "unknown relationships".
java.awt.ColorgetPageColor()→ inherited from DocumentBase
           Gets or sets the page color of the document. This property is a simpler version of BackgroundShape.
intgetPageCount()
           Gets the number of pages in the document as calculated by the most recent page layout operation.
CompositeNodegetParentNode()→ inherited from Node
           Gets the immediate parent of this node.
NodegetPreviousSibling()→ inherited from Node
           Gets the node immediately preceding this node.
intgetProtectionType()
           Gets the currently active document protection type. The value of the property is ProtectionType integer constant.
RangegetRange()→ inherited from Node
           Returns a Range object that represents the portion of a document that is contained in this node.
Aspose.Words.Loading.IResourceLoadingCallbackgetResourceLoadingCallback()→ inherited from DocumentBase
           Allows to control how external resources are loaded.
RevisionCollectiongetRevisions()
           Gets a collection of revisions (tracked changes) that exist in this document.
SectionCollectiongetSections()
           Returns a collection that represents all sections in the document.
booleangetShadeFormData()
voidsetShadeFormData(boolean value)
           Specifies whether to turn on the gray shading on form fields.
StyleCollectiongetStyles()→ inherited from DocumentBase
           Returns a collection of styles defined in the document.
Aspose.Words.Themes.ThemegetTheme()
           Gets the Theme object for this document.
booleangetTrackRevisions()
voidsetTrackRevisions(boolean value)
          True if changes are tracked when this document is edited in Microsoft Word.
VariableCollectiongetVariables()
           Returns the collection of variables added to a document or template.
intgetVersionsCount()
           Gets the number of document versions that was stored in the DOC document.
Aspose.Words.Settings.ViewOptionsgetViewOptions()
           Provides options to control how the document is displayed in Microsoft Word.
IWarningCallbackgetWarningCallback()→ inherited from DocumentBase
voidsetWarningCallback(IWarningCallback value)
           Called during various document processing procedures when an issue is detected that might result in data or formatting fidelity loss.
Aspose.Words.Settings.WriteProtectiongetWriteProtection()
           Provides access to the document write protection options.
 
Method Summary
booleanaccept(DocumentVisitor visitor)
           Accepts a visitor.
voidacceptAllRevisions()
           Accepts all tracked changes in the document.
NodeappendChild(Node newChild)→ inherited from CompositeNode
           Adds the specified node to the end of the list of child nodes for this node.
voidappendDocument(Document srcDoc, int importFormatMode)
           Appends the specified document to the end of this document.
voidcleanup()
           Cleans unused styles and lists from the document.
voidcleanup(CleanupOptions options)
           Cleans unused styles and lists from the document depending on given CleanupOptions.
voidclearSectionAttrs()
          Reserved for internal use.
voidcompare(Document document, java.lang.String author, java.util.Date dateTime)
           Compares this document with another document producing changes as number of edit and format revisions Revision.
voidcompare(Document document, java.lang.String author, java.util.Date dateTime, CompareOptions options)
           Compares this document with another document producing changes as a number of edit and format revisions Revision. Allows to specify comparison options using CompareOptions.
DocumentdeepClone()
           Performs a deep copy of the Document.
NodedeepClone(boolean isCloneChildren)→ inherited from Node
           Creates a duplicate of the node.
voidensureMinimum()
           If the document contains no sections, creates one section with one paragraph.
voidexpandTableStylesToDirectFormatting()
           Converts formatting specified in table styles into direct formatting on tables in the document.
java.lang.ObjectfetchInheritedSectionAttr(int key)
          Reserved for internal use.
CompositeNodegetAncestor(int ancestorType)→ inherited from Node
           Gets the first ancestor of the specified NodeType.
CompositeNodegetAncestor(java.lang.Class ancestorType)→ inherited from Node
           Gets the first ancestor of the specified object type.
NodegetChild(int nodeType, int index, boolean isDeep)→ inherited from CompositeNode
           Returns an Nth child node that matches the specified type.
NodeCollectiongetChildNodes(int nodeType, boolean isDeep)→ inherited from CompositeNode
           Returns a live collection of child nodes that match the specified type.
CompositeNodegetContainer()→ inherited from CompositeNode
          Reserved for internal use.
java.lang.ObjectgetDirectSectionAttr(int key)
          Reserved for internal use.
NodegetNextMatchingNode(aspose.obfuscated.type curNode)→ inherited from CompositeNode
          Reserved for internal use.
Aspose.Words.Rendering.PageInfogetPageInfo(int pageIndex)
           Gets the page size, orientation and other information about a page that might be useful for printing or rendering.
java.lang.StringgetText()→ inherited from CompositeNode
           Gets the text of this node and of all its children.
NodeimportNode(Node srcNode, boolean isImportChildren)→ inherited from DocumentBase
          

Imports a node from another document to the current document.

NodeimportNode(Node srcNode, boolean isImportChildren, int importFormatMode)→ inherited from DocumentBase
          

Imports a node from another document to the current document with an option to control formatting.

intindexOf(Node child)→ inherited from CompositeNode
           Returns the index of the specified child node in the child node array.
NodeinsertAfter(Node newChild, Node refChild)→ inherited from CompositeNode
           Inserts the specified node immediately after the specified reference node.
NodeinsertBefore(Node newChild, Node refChild)→ inherited from CompositeNode
           Inserts the specified node immediately before the specified reference node.
voidinvalidateFieldTypes()
           Changes field type values #Error Cref: P:Aspose.Words.Fields.FieldChar.FieldType of Aspose.Words.Fields.FieldStart, Aspose.Words.Fields.FieldSeparator, Aspose.Words.Fields.FieldEnd in the whole document so that they correspond to the field types contained in the field codes.
java.util.Iteratoriterator()→ inherited from CompositeNode
           Provides support for the for each style iteration over the child nodes of this node.
intjoinRunsWithSameFormatting()
           Joins runs with same formatting in all paragraphs of the document.
NodenextPreOrder(Node rootNode)→ inherited from Node
           Gets next node according to the pre-order tree traversal algorithm.
voidnormalizeFieldTypes()
           Changes field type values #Error Cref: P:Aspose.Words.Fields.FieldChar.FieldType of Aspose.Words.Fields.FieldStart, Aspose.Words.Fields.FieldSeparator, Aspose.Words.Fields.FieldEnd in the whole document so that they correspond to the field types contained in the field codes.
NodeprependChild(Node newChild)→ inherited from CompositeNode
           Adds the specified node to the beginning of the list of child nodes for this node.
NodepreviousPreOrder(Node rootNode)→ inherited from Node
           Gets the previous node according to the pre-order tree traversal algorithm.
voidprotect(int type)
           Protects the document from changes without changing the existing password or assigns a random password.
voidprotect(int type, java.lang.String password)
           Protects the document from changes and optionally sets a protection password.
voidremove()→ inherited from Node
           Removes itself from the parent.
voidremoveAllChildren()→ inherited from CompositeNode
           Removes all the child nodes of the current node.
NoderemoveChild(Node oldChild)→ inherited from CompositeNode
           Removes the specified child node.
voidremoveExternalSchemaReferences()
           Removes external XML schema references from this document.
voidremoveMacros()
           Removes all macros (the VBA project) as well as toolbars and command customizations from the document.
voidremoveSmartTags()→ inherited from CompositeNode
           Removes all Aspose.Words.Markup.SmartTag descendant nodes of the current node.
voidremoveUnusedResources()
           Cleans unused resources from the document.
voidsave(java.io.OutputStream outputStream, com.aspose.words.SaveOptions saveOptions)
           Saves the document to a stream using the specified save options.
voidsave(java.io.OutputStream outputStream, int saveFormat)
           Saves the document to a stream using the specified format.
Aspose.Words.Saving.SaveOutputParameterssave(java.lang.String fileName)
           Saves the document to a file. Automatically determines the save format from the extension.
Aspose.Words.Saving.SaveOutputParameterssave(java.lang.String fileName, int saveFormat)
           Saves the document to a file in the specified format.
NodeListselectNodes(java.lang.String xpath)→ inherited from CompositeNode
           Selects a list of nodes matching the XPath expression.
NodeselectSingleNode(java.lang.String xpath)→ inherited from CompositeNode
           Selects the first Node that matches the XPath expression.
voidsetSectionAttr(int key, java.lang.Object value)
          Reserved for internal use.
voidstartTrackRevisions(java.lang.String author)
           Starts automatically marking all further changes you make to the document programmatically as revision changes.
voidstartTrackRevisions(java.lang.String author, java.util.Date dateTime)
           Starts automatically marking all further changes you make to the document programmatically as revision changes.
voidstopTrackRevisions()
           Stops automatic marking of document changes as revisions.
java.lang.StringtoString(int saveFormat)→ inherited from Node
           Exports the content of the node into a string in the specified format.
java.lang.StringtoTxt()→ inherited from Node
           Exports the content of the node into a string in plain text format.
voidunlinkFields()
           Unlinks fields in the whole document.
voidunprotect()
           Removes protection from the document regardless of the password.
booleanunprotect(java.lang.String password)
           Removes protection from the document if a correct password is specified.
voidupdateFields()
           Updates the values of fields in the whole document.
voidupdateListLabels()
           Updates list labels for all list items in the document.
voidupdatePageLayout()
           Rebuilds the page layout of the document.
voidupdateTableLayout()
           Updates widths of cells and tables in the document according to their preferred widths and content. You do not need to call this method if the tables appear correct in the output document.
voidupdateThumbnail()
           Updates #Error Cref: P:Aspose.Words.Properties.BuiltInDocumentProperties.Thumbnail of the document using default options.
voidupdateWordCount()
           Updates word count properties of the document.
voidupdateWordCount(boolean updateLinesCount)
           Updates word count properties of the document, optionally updates #Error Cref: P:Aspose.Words.Properties.BuiltInDocumentProperties.Lines property.
 

Constructor Detail

Document

public Document()
         throws java.lang.Exception
Creates a blank Word document.

The document paper size is Letter by default. If you want to change page setup, use Section.PageSetup.

After creation, you can use DocumentBuilder to add document content easily.


Document

public Document(java.lang.String fileName)
         throws java.lang.Exception
Opens an existing document from a file. Automatically detects the file format.
Parameters:
fileName - File name of the document to open.

Document

public Document(java.lang.String fileName, LoadOptions loadOptions)
         throws java.lang.Exception
Opens an existing document from a file. Allows to specify additional options such as an encryption password.
Parameters:
fileName - File name of the document to open.
loadOptions - Additional options to use when loading a document. Can be null.

Document

public Document(java.io.InputStream stream)
         throws java.lang.Exception
Opens an existing document from a stream. Automatically detects the file format.

The document must be stored at the beginning of the stream.

Parameters:
stream - Stream where to load the document from.

Document

public Document(java.io.InputStream stream, LoadOptions loadOptions)
         throws java.lang.Exception
Opens an existing document from a stream. Allows to specify additional options such as an encryption password.

The document must be stored at the beginning of the stream.

Parameters:
stream - The stream where to load the document from.
loadOptions - Additional options to use when loading a document. Can be null.

Property Getters/Setters Detail

getAttachedTemplate/setAttachedTemplate

public java.lang.String getAttachedTemplate() / public void setAttachedTemplate(java.lang.String value)
Gets or sets the full path of the template attached to the document.

Empty string means the document is attached to the Normal template.

See Also:
#Error Cref: P:Aspose.Words.Properties.BuiltInDocumentProperties.Template

getAutomaticallyUpdateSyles/setAutomaticallyUpdateSyles

public boolean getAutomaticallyUpdateSyles() / public void setAutomaticallyUpdateSyles(boolean value)
Gets or sets a flag indicating whether the styles in the document are updated to match the styles in the attached template each time the document is opened in MS Word.

getBackgroundShape/setBackgroundShape

→ inherited from DocumentBase
public Shape getBackgroundShape() / public void setBackgroundShape(Shape value)
Gets or sets the background shape of the document. Can be null.

Microsoft Word allows only a shape that has its ShapeBase.ShapeType property equal to ShapeType.RECTANGLE to be used as a background shape for a document.

Microsoft Word supports only the fill properties of a background shape. All other properties are ignored.

Setting this property to a non-null value will also set the #Error Cref: P:Aspose.Words.Settings.ViewOptions.DisplayBackgroundShape to true.

See Also:
#Error Cref: P:Aspose.Words.Settings.ViewOptions.DisplayBackgroundShape, PageColor

getBuiltInDocumentProperties

public Aspose.Words.Properties.BuiltInDocumentProperties getBuiltInDocumentProperties()
Returns a collection that represents all the built-in document properties of the document.

getChildNodes

→ inherited from CompositeNode
public NodeCollection getChildNodes()
Gets all immediate child nodes of this node.

Note, ChildNodes is equivalent to calling GetChildNodes(NodeType.Any, false) and creates and returns a new collection every time it is accessed.

If there are no child nodes, this property returns an empty collection.


getCompatibilityOptions

public Aspose.Words.Settings.CompatibilityOptions getCompatibilityOptions()
Provides access to document compatibility options (that is, the user preferences entered on the Compatibility tab of the Options dialog in Word).

getCompliance

public Aspose.Words.Saving.OoxmlCompliance getCompliance()
Gets the OOXML compliance version determined from the loaded document content. Makes sense only for OOXML documents.

If you created a new blank document or load non OOXML document returns the #Error Cref: F:Aspose.Words.Saving.OoxmlCompliance.Ecma376_2006 value.


getCount

→ inherited from CompositeNode
public int getCount()
Gets the number of immediate children of this node.

getCustomDocumentProperties

public Aspose.Words.Properties.CustomDocumentProperties getCustomDocumentProperties()
Returns a collection that represents all the custom document properties of the document.

getCustomXmlParts

public Aspose.Words.Markup.CustomXmlPartCollection getCustomXmlParts()
Gets or sets the collection of Custom XML Data Storage Parts.

Aspose.Words loads and saves Custom XML Parts into OOXML and DOC documents only.

This property cannot be null.

See Also:
Aspose.Words.Markup.CustomXmlPart

getDefaultTabStop/setDefaultTabStop

public double getDefaultTabStop() / public void setDefaultTabStop(double value)
Gets or sets the interval (in points) between the default tab stops.
See Also:
TabStopCollection, TabStop

getDigitalSignatures

public DigitalSignatureCollection getDigitalSignatures()
Gets the collection of digital signatures for this document and their validation results.

This collection contains digital signatures that were loaded from the original document. These digital signatures will not be saved when you save this Document object into a file or stream because saving or converting will produce a document that is different from the original and the original digital signatures will no longer be valid.

This collection is never null. If the document is not signed, it will contain zero elements.


getDocument

→ inherited from Node
public DocumentBase getDocument()
Gets the document to which this node belongs.

The node always belongs to a document even if it has just been created and not yet added to the tree, or if it has been removed from the tree.


getEndnoteOptions

public EndnoteOptions getEndnoteOptions()
Provides options that control numbering and positioning of endnotes in this document.

getFieldOptions

public Aspose.Words.Fields.FieldOptions getFieldOptions()
Gets a FieldOptions object that represents options to control field handling in the document.

getFirstChild

→ inherited from CompositeNode
public Node getFirstChild()
Gets the first child of the node. If there is no first child node, a null is returned.

getFirstSection

public Section getFirstSection()
Gets the first section in the document. Returns null if there are no sections.

getFontInfos

→ inherited from DocumentBase
public Aspose.Words.Fonts.FontInfoCollection getFontInfos()
Provides access to properties of fonts used in this document.

This collection of font definitions is loaded as is from the document. Font definitions might be optional, missing or incomplete in some documents.

Do not rely on this collection to ascertain that a particular font is used in the document. You should only use this collection to get information about fonts that might be used in the document.

See Also:
Aspose.Words.Fonts.FontInfoCollection, Aspose.Words.Fonts.FontInfo

getFontSettings

public Aspose.Words.Fonts.FontSettings getFontSettings()
Gets or sets document font settings.

This property allows to specify font settings per document. If set to null, default static font settings #Error Cref: P:Aspose.Words.Fonts.FontSettings.DefaultInstance will be used.

The default value is null.


getFootnoteOptions

public FootnoteOptions getFootnoteOptions()
Provides options that control numbering and positioning of footnotes in this document.

getGlossaryDocument/setGlossaryDocument

public GlossaryDocument getGlossaryDocument() / public void setGlossaryDocument(GlossaryDocument value)
Gets or sets the glossary document within this document or template. A glossary document is a storage for AutoText, AutoCorrect and Building Block entries defined in a document.

This property returns null if the document does not have a glossary document.

You can add a glossary document to a document by creating a GlossaryDocument object and assigning to this property.

See Also:
GlossaryDocument

hasChildNodes

→ inherited from CompositeNode
public boolean hasChildNodes()
Returns true if this node has any child nodes.

hasMacros

public boolean hasMacros()
Returns true if the document has a VBA project (macros).
See Also:
removeMacros()

hasRevisions

public boolean hasRevisions()
Returns true if the document has any tracked changes. This property is a shortcut for comparing RevisionCollection.Count to zero.

getHyphenationOptions

public Aspose.Words.Settings.HyphenationOptions getHyphenationOptions()
Provides access to document hyphenation options.

isComposite

→ inherited from CompositeNode
public boolean isComposite()
Returns true as this node can have child nodes.

getLastChild

→ inherited from CompositeNode
public Node getLastChild()
Gets the last child of the node. If there is no last child node, a null is returned.

getLastSection

public Section getLastSection()
Gets the last section in the document. Returns null if there are no sections.

getLayoutOptions

public Aspose.Words.Layout.LayoutOptions getLayoutOptions()
Gets a LayoutOptions object that represents options to control the layout process of this document.

getLists

→ inherited from DocumentBase
public Aspose.Words.Lists.ListCollection getLists()
Provides access to the list formatting used in the document.

For more information see the description of the Aspose.Words.Lists.ListCollection class.

See Also:
Aspose.Words.Lists.ListCollection, Aspose.Words.Lists.List, ListFormat

getMailMerge

public Aspose.Words.MailMerging.MailMerge getMailMerge()
Returns a MailMerge object that represents the mail merge functionality for the document.

getMailMergeSettings

public Aspose.Words.Settings.MailMergeSettings getMailMergeSettings()
Gets or sets the object that contains all of the mail merge information for a document.

You can use this object to specify a mail merge data source for a document and this information (along with the available data fields) will appear in Microsoft Word when the user opens this document. Or you can use this object to query mail merge settings that the user has specified in Microsoft Word for this document.

This object is never null.


getNextSibling

→ inherited from Node
public Node getNextSibling()
Gets the node immediately following this node. If there is no next node, a null is returned.

getNodeChangingCallback/setNodeChangingCallback

→ inherited from DocumentBase
public INodeChangingCallback getNodeChangingCallback() / public void setNodeChangingCallback(INodeChangingCallback value)
Called when a node is inserted or removed in the document.

getNodeType

public int getNodeType()
Returns NodeType.Document. The value of the property is NodeType integer constant.

getOriginalFileName

public java.lang.String getOriginalFileName()
Gets the original file name of the document.

Returns null if the document was loaded from a stream or created blank.


getOriginalLoadFormat

public int getOriginalLoadFormat()
Gets the format of the original document that was loaded into this object. The value of the property is LoadFormat integer constant.

If you created a new blank document, returns the LoadFormat.DOC value.


getPackageCustomParts

public Aspose.Words.Markup.CustomPartCollection getPackageCustomParts()
Gets or sets the collection of custom parts (arbitrary content) that are linked to the OOXML package using "unknown relationships".

Do not confuse these custom parts with Custom XML Data. If you need to access Custom XML parts, use the CustomXmlParts property.

This collection contains OOXML parts whose parent is the OOXML package and they targets are of an "unknown relationship". For more information see Aspose.Words.Markup.CustomPart.

Aspose.Words loads and saves custom parts into OOXML documents only.

This property cannot be null.

See Also:
Aspose.Words.Markup.CustomPart

getPageColor

→ inherited from DocumentBase
public java.awt.Color getPageColor()
Gets or sets the page color of the document. This property is a simpler version of BackgroundShape.

This property provides a simple way to specify a solid page color for the document. Setting this property creates and sets an appropriate BackgroundShape.

If the page color is not set (e.g. there is no background shape in the document) returns a zero color.

See Also:
BackgroundShape

getPageCount

public int getPageCount()
Gets the number of pages in the document as calculated by the most recent page layout operation.
See Also:
updatePageLayout()

getParentNode

→ inherited from Node
public CompositeNode getParentNode()
Gets the immediate parent of this node.

If a node has just been created and not yet added to the tree, or if it has been removed from the tree, the parent is null.


getPreviousSibling

→ inherited from Node
public Node getPreviousSibling()
Gets the node immediately preceding this node. If there is no preceding node, a null is returned.

getProtectionType

public int getProtectionType()
Gets the currently active document protection type. The value of the property is ProtectionType integer constant.

This property allows to retrieve the currently set document protection type. To change the document protection type use the protect(int,java.lang.String) and unprotect() methods.

When a document is protected, the user can make only limited changes, such as adding annotations, making revisions, or completing a form.

Note that document protection is different from write protection. Write protection is specified using the WriteProtection

See Also:
protect(int,java.lang.String), unprotect(), WriteProtection

getRange

→ inherited from Node
public Range getRange()
Returns a Range object that represents the portion of a document that is contained in this node.

getResourceLoadingCallback

→ inherited from DocumentBase
public Aspose.Words.Loading.IResourceLoadingCallback getResourceLoadingCallback()
Allows to control how external resources are loaded.

getRevisions

public RevisionCollection getRevisions()
Gets a collection of revisions (tracked changes) that exist in this document.

The returned collection is a "live" collection, which means if you remove parts of a document that contain revisions, the deleted revisions will automatically disappear from this collection.


getSections

public SectionCollection getSections()
Returns a collection that represents all sections in the document.

getShadeFormData/setShadeFormData

public boolean getShadeFormData() / public void setShadeFormData(boolean value)
Specifies whether to turn on the gray shading on form fields.

getStyles

→ inherited from DocumentBase
public StyleCollection getStyles()
Returns a collection of styles defined in the document.

For more information see the description of the StyleCollection class.

See Also:
StyleCollection, Style

getTheme

public Aspose.Words.Themes.Theme getTheme()
Gets the Theme object for this document.

getTrackRevisions/setTrackRevisions

public boolean getTrackRevisions() / public void setTrackRevisions(boolean value)
True if changes are tracked when this document is edited in Microsoft Word.

Setting this option only instructs Microsoft Word whether the track changes is turned on or off. This property has no effect on changes to the document that you make programmatically via Aspose.Words.

If you want to automatically track changes as they are made programmatically by Aspose.Words to this document use the startTrackRevisions(java.lang.String,java.util.Date) method.


getVariables

public VariableCollection getVariables()
Returns the collection of variables added to a document or template.

getVersionsCount

public int getVersionsCount()
Gets the number of document versions that was stored in the DOC document.

Versions in Microsoft Word are accessed via the File/Versions menu. Microsoft Word supports versions only for DOC files.

This property allows to detect if there were document versions stored in this document before it was opened in Aspose.Words. Aspose.Words provides no other support for document versions. If you save this document using Aspose.Words, the document will be saved without versions.


getViewOptions

public Aspose.Words.Settings.ViewOptions getViewOptions()
Provides options to control how the document is displayed in Microsoft Word.

getWarningCallback/setWarningCallback

→ inherited from DocumentBase
public IWarningCallback getWarningCallback() / public void setWarningCallback(IWarningCallback value)
Called during various document processing procedures when an issue is detected that might result in data or formatting fidelity loss. Document may generate warnings at any stage of its existence, so it's important to setup warning callback as early as possible to avoid the warnings loss. E.g. such properties as PageCount actually build the document layout which is used later for rendering, and the layout warnings may be lost if warning callback is specified just for the rendering calls later.

getWriteProtection

public Aspose.Words.Settings.WriteProtection getWriteProtection()
Provides access to the document write protection options.

Method Detail

accept

public boolean accept(DocumentVisitor visitor)
              throws java.lang.Exception
Accepts a visitor.

Enumerates over this node and all of its children. Each node calls a corresponding method on DocumentVisitor.

For more info see the Visitor design pattern.

Calls DocumentVisitor.VisitDocumentStart, then calls Accept for all child nodes of the document and calls DocumentVisitor.VisitDocumentEnd at the end.
Parameters:
visitor - The visitor that will visit the nodes.
Returns:
True if all nodes were visited; false if DocumentVisitor stopped the operation before visiting all nodes.

acceptAllRevisions

public void acceptAllRevisions()
                       throws java.lang.Exception
Accepts all tracked changes in the document. This method is a shortcut for RevisionCollection.acceptAll().

appendChild

→ inherited from CompositeNode
public Node appendChild(Node newChild)
Adds the specified node to the end of the list of child nodes for this node.

If the newChild is already in the tree, it is first removed.

If the node being inserted was created from another document, you should use importNode(com.aspose.words.Node,boolean,int) to import the node to the current document. The imported node can then be inserted into the current document.

Parameters:
newChild - The node to add.
Returns:
The node added.

appendDocument

public void appendDocument(Document srcDoc, int importFormatMode)
Appends the specified document to the end of this document.
Parameters:
srcDoc - The document to append.
importFormatMode - A ImportFormatMode value. Specifies how to merge style formatting that clashes.

cleanup

public void cleanup()
            throws java.lang.Exception
Cleans unused styles and lists from the document.

cleanup

public void cleanup(CleanupOptions options)
            throws java.lang.Exception
Cleans unused styles and lists from the document depending on given CleanupOptions.

clearSectionAttrs

public void clearSectionAttrs()
Reserved for internal use.

compare

public void compare(Document document, java.lang.String author, java.util.Date dateTime)
            throws java.lang.Exception
Compares this document with another document producing changes as number of edit and format revisions Revision. The following document nodes are not compared at the moment:
  • Aspose.Words.Markup.StructuredDocumentTag
  • Item3
Note: Documents must not have revisions before comparison.
Parameters:
document - Document to compare.
author - Initials of the author to use for revisions.
dateTime - The date and time to use for revisions.

compare

public void compare(Document document, java.lang.String author, java.util.Date dateTime, CompareOptions options)
            throws java.lang.Exception
Compares this document with another document producing changes as a number of edit and format revisions Revision. Allows to specify comparison options using CompareOptions.

deepClone

public Document deepClone()
Performs a deep copy of the Document.
Returns:
The cloned document.

deepClone

→ inherited from Node
public Node deepClone(boolean isCloneChildren)
Creates a duplicate of the node.

This method serves as a copy constructor for nodes. The cloned node has no parent, but belongs to the same document as the original node.

This method always performs a deep copy of the node. The isCloneChildren parameter specifies whether to perform copy all child nodes as well.

Parameters:
isCloneChildren - True to recursively clone the subtree under the specified node; false to clone only the node itself.
Returns:
The cloned node.

ensureMinimum

public void ensureMinimum()
If the document contains no sections, creates one section with one paragraph.

expandTableStylesToDirectFormatting

public void expandTableStylesToDirectFormatting()
                                        throws java.lang.Exception
Converts formatting specified in table styles into direct formatting on tables in the document.

This method exists because this version of Aspose.Words provides only limited support for table styles (see below). This method might be useful when you load a DOCX or WordprocessingML document that contains tables formatted with table styles and you need to query formatting of tables, cells, paragraphs or text.

This version of Aspose.Words provides limited support for table styles as follows:

  • Table styles defined in DOCX or WordprocessingML documents are preserved as table styles when saving the document as DOCX or WordprocessingML.
  • Table styles defined in DOCX or WordprocessingML documents are automatically converted to direct formatting on tables when saving the document into any other format, rendering or printing.
  • Table styles defined in DOC documents are preserved as table styles when saving the document as DOC only.

fetchInheritedSectionAttr

public java.lang.Object fetchInheritedSectionAttr(int key)
Reserved for internal use.

getAncestor

→ inherited from Node
public CompositeNode getAncestor(int ancestorType)
Gets the first ancestor of the specified NodeType.
Parameters:
ancestorType - A NodeType value. The node type of the ancestor to retrieve.
Returns:
The ancestor of the specified type or null if no ancestor of this type was found.

getAncestor

→ inherited from Node
public CompositeNode getAncestor(java.lang.Class ancestorType)
Gets the first ancestor of the specified object type.

The ancestor type matches if it is equal to ancestorType or derived from ancestorType.

Parameters:
ancestorType - The object type of the ancestor to retrieve.
Returns:
The ancestor of the specified type or null if no ancestor of this type was found.

getChild

→ inherited from CompositeNode
public Node getChild(int nodeType, int index, boolean isDeep)
Returns an Nth child node that matches the specified type.

If index is out of range, a null is returned.

Note that markup nodes (NodeType.STRUCTURED_DOCUMENT_TAG and NodeType.SMART_TAG) are traversed even when isDeep = false and GetChild is invoked for non-markup node type. For example if the first run in a para is wrapped in a StructuredDocumentTag, it will still be returned by GetChild(NodeType.Run, 0, false).
Parameters:
nodeType - A NodeType value. Specifies the type of the child node.
index - Zero based index of the child node to select. Negative indexes are also allowed and indicate access from the end, that is -1 means the last node.
isDeep - True to select from all child nodes recursively. False to select only among immediate children. See remarks for more info.
Returns:
The child node that matches the criteria or null if no matching node is found.

getChildNodes

→ inherited from CompositeNode
public NodeCollection getChildNodes(int nodeType, boolean isDeep)
Returns a live collection of child nodes that match the specified type.

The collection of nodes returned by this method is always live.

A live collection is always in sync with the document. For example, if you selected all sections in a document and enumerate through the collection deleting the sections, the section is removed from the collection immediately when it is removed from the document.

Parameters:
nodeType - A NodeType value. Specifies the type of nodes to select.
isDeep - True to select from all child nodes recursively. False to select only among immediate children.
Returns:
A live collection of child nodes of the specified type.

getContainer

→ inherited from CompositeNode
public CompositeNode getContainer()
Reserved for internal use.

getDirectSectionAttr

public java.lang.Object getDirectSectionAttr(int key)
Reserved for internal use.

getNextMatchingNode

→ inherited from CompositeNode
public Node getNextMatchingNode(aspose.obfuscated.type curNode)
Reserved for internal use.

getPageInfo

public Aspose.Words.Rendering.PageInfo getPageInfo(int pageIndex)
                    throws java.lang.Exception
Gets the page size, orientation and other information about a page that might be useful for printing or rendering.
Parameters:
pageIndex - The 0-based page index.

getText

→ inherited from CompositeNode
public java.lang.String getText()
Gets the text of this node and of all its children.

The returned string includes all control and special characters as described in ControlChar.


importNode

→ inherited from DocumentBase
public Node importNode(Node srcNode, boolean isImportChildren)

Imports a node from another document to the current document.

This method uses the ImportFormatMode.USE_DESTINATION_STYLES option to resolve formatting.

Importing a node creates a copy of the source node belonging to the importing document. The returned node has no parent. The source node is not altered or removed from the original document.

Before a node from another document can be inserted into this document, it must be imported. During import, document-specific properties such as references to styles and lists are translated from the original to the importing document. After the node was imported, it can be inserted into the appropriate place in the document using insertBefore(com.aspose.words.Node,com.aspose.words.Node) or insertAfter(com.aspose.words.Node,com.aspose.words.Node).

If the source node already belongs to the destination document, then simply a deep clone of the source node is created.

Parameters:
srcNode - The node being imported.
isImportChildren - True to import all child nodes recursively; otherwise, false.
Returns:
The cloned node that belongs to the current document.
See Also:
NodeImporter

importNode

→ inherited from DocumentBase
public Node importNode(Node srcNode, boolean isImportChildren, int importFormatMode)

Imports a node from another document to the current document with an option to control formatting.

This overload is useful to control how styles and list formatting are imported.

Importing a node creates a copy of the source node belonging to the importing document. The returned node has no parent. The source node is not altered or removed from the original document.

Before a node from another document can be inserted into this document, it must be imported. During import, document-specific properties such as references to styles and lists are translated from the original to the importing document. After the node was imported, it can be inserted into the appropriate place in the document using insertBefore(com.aspose.words.Node,com.aspose.words.Node) or insertAfter(com.aspose.words.Node,com.aspose.words.Node).

If the source node already belongs to the destination document, then simply a deep clone of the source node is created.

Parameters:
srcNode - The node to imported.
isImportChildren - True to import all child nodes recursively; otherwise, false.
importFormatMode - A ImportFormatMode value. Specifies how to merge style formatting that clashes.
Returns:
The cloned, imported node. The node belongs to the destination document, but has no parent.
See Also:
ImportFormatMode, NodeImporter

indexOf

→ inherited from CompositeNode
public int indexOf(Node child)
Returns the index of the specified child node in the child node array. Returns -1 if the node is not found in the child nodes.

insertAfter

→ inherited from CompositeNode
public Node insertAfter(Node newChild, Node refChild)
Inserts the specified node immediately after the specified reference node.

If refChild is null, inserts newChild at the beginning of the list of child nodes.

If the newChild is already in the tree, it is first removed.

If the node being inserted was created from another document, you should use importNode(com.aspose.words.Node,boolean,int) to import the node to the current document. The imported node can then be inserted into the current document.

Parameters:
newChild - The Node to insert.
refChild - The Node that is the reference node. The newNode is placed after the refNode.
Returns:
The inserted node.

insertBefore

→ inherited from CompositeNode
public Node insertBefore(Node newChild, Node refChild)
Inserts the specified node immediately before the specified reference node.

If refChild is null, inserts newChild at the end of the list of child nodes.

If the newChild is already in the tree, it is first removed.

If the node being inserted was created from another document, you should use importNode(com.aspose.words.Node,boolean,int) to import the node to the current document. The imported node can then be inserted into the current document.

Parameters:
newChild - The Node to insert.
refChild - The Node that is the reference node. The newChild is placed before this node.
Returns:
The inserted node.

invalidateFieldTypes

public void invalidateFieldTypes()
Changes field type values #Error Cref: P:Aspose.Words.Fields.FieldChar.FieldType of Aspose.Words.Fields.FieldStart, Aspose.Words.Fields.FieldSeparator, Aspose.Words.Fields.FieldEnd in the whole document so that they correspond to the field types contained in the field codes.

Use this method after document changes that affect field types.

To change field type values in a specific part of the document use Range.normalizeFieldTypes().


iterator

→ inherited from CompositeNode
public java.util.Iterator iterator()
Provides support for the for each style iteration over the child nodes of this node.

joinRunsWithSameFormatting

public int joinRunsWithSameFormatting()
Joins runs with same formatting in all paragraphs of the document.

This is an optimization method. Some documents contain adjacent runs with same formatting. Usually this occurs if a document was intensively edited manually. You can reduce the document size and speed up further processing by joining these runs.

The operation checks every Paragraph node in the document for adjacent Run nodes having identical properties. It ignores unique identifiers used to track editing sessions of run creation and modification. First run in every joining sequence accumulates all text. Remaining runs are deleted from the document.

Returns:
Number of joins performed. When N adjacent runs are being joined they count as N - 1 joins.

nextPreOrder

→ inherited from Node
public Node nextPreOrder(Node rootNode)
Gets next node according to the pre-order tree traversal algorithm.
Parameters:
rootNode - The top node (limit) of traversal.
Returns:
Next node in pre-order order. Null if reached the rootNode.

normalizeFieldTypes

public void normalizeFieldTypes()
Changes field type values #Error Cref: P:Aspose.Words.Fields.FieldChar.FieldType of Aspose.Words.Fields.FieldStart, Aspose.Words.Fields.FieldSeparator, Aspose.Words.Fields.FieldEnd in the whole document so that they correspond to the field types contained in the field codes.

Use this method after document changes that affect field types.

To change field type values in a specific part of the document use Range.normalizeFieldTypes().


prependChild

→ inherited from CompositeNode
public Node prependChild(Node newChild)
Adds the specified node to the beginning of the list of child nodes for this node.

If the newChild is already in the tree, it is first removed.

If the node being inserted was created from another document, you should use importNode(com.aspose.words.Node,boolean,int) to import the node to the current document. The imported node can then be inserted into the current document.

Parameters:
newChild - The node to add.
Returns:
The node added.

previousPreOrder

→ inherited from Node
public Node previousPreOrder(Node rootNode)
Gets the previous node according to the pre-order tree traversal algorithm.
Parameters:
rootNode - The top node (limit) of traversal.
Returns:
Previous node in pre-order order. Null if reached the rootNode.

protect

public void protect(int type)
Protects the document from changes without changing the existing password or assigns a random password.

When a document is protected, the user can make only limited changes, such as adding annotations, making revisions, or completing a form.

When you protect a document, and the document already has a protection password, the existing protection password is not changed.

When you protect a document, and the document does not have a protection password, this method assigns a random password that makes it impossible to unprotect the document in Microsoft Word, but you still can unprotect the document in Aspose.Words as it does not require a password when unprotecting.

Parameters:
type - A ProtectionType value. Specifies the protection type for the document.

protect

public void protect(int type, java.lang.String password)
Protects the document from changes and optionally sets a protection password.

When a document is protected, the user can make only limited changes, such as adding annotations, making revisions, or completing a form.

Note that document protection is different from write protection. Write protection is specified using the WriteProtection.

Parameters:
type - A ProtectionType value. Specifies the protection type for the document.
password - The password to protect the document with. Specify null or empty string if you want to protect the document without a password.

remove

→ inherited from Node
public void remove()
Removes itself from the parent.

removeAllChildren

→ inherited from CompositeNode
public void removeAllChildren()
Removes all the child nodes of the current node.

removeChild

→ inherited from CompositeNode
public Node removeChild(Node oldChild)
Removes the specified child node.

The parent of oldChild is set to null after the node is removed.

Parameters:
oldChild - The node to remove.
Returns:
The removed node.

removeExternalSchemaReferences

public void removeExternalSchemaReferences()
Removes external XML schema references from this document.

removeMacros

public void removeMacros()
Removes all macros (the VBA project) as well as toolbars and command customizations from the document.

By removing all macros from a document you can ensure the document contains no macro viruses.


removeSmartTags

→ inherited from CompositeNode
public void removeSmartTags()
Removes all Aspose.Words.Markup.SmartTag descendant nodes of the current node. This method does not remove the content of the smart tags.

removeUnusedResources

public void removeUnusedResources()
                          throws java.lang.Exception
Cleans unused resources from the document.

save

public void save(java.io.OutputStream outputStream, com.aspose.words.SaveOptions saveOptions)
         throws java.lang.Exception
Saves the document to a stream using the specified save options.
Parameters:
stream - Stream where to save the document.
saveOptions - Specifies the options that control how the document is saved. Can be null. If this is null, the document will be saved in the binary DOC format.
Returns:
Additional information that you can optionally use.

save

public void save(java.io.OutputStream outputStream, int saveFormat)
         throws java.lang.Exception
Saves the document to a stream using the specified format.
Parameters:
stream - Stream where to save the document.
saveFormat - The format in which to save the document.
Returns:
Additional information that you can optionally use.

save

public Aspose.Words.Saving.SaveOutputParameters save(java.lang.String fileName)
                         throws java.lang.Exception
Saves the document to a file. Automatically determines the save format from the extension.
Parameters:
fileName - The name for the document. If a document with the specified file name already exists, the existing document is overwritten.
Returns:
Additional information that you can optionally use.

save

public Aspose.Words.Saving.SaveOutputParameters save(java.lang.String fileName, int saveFormat)
                         throws java.lang.Exception
Saves the document to a file in the specified format.
Parameters:
fileName - The name for the document. If a document with the specified file name already exists, the existing document is overwritten.
saveFormat - A SaveFormat value. The format in which to save the document.
Returns:
Additional information that you can optionally use.

selectNodes

→ inherited from CompositeNode
public NodeList selectNodes(java.lang.String xpath)
Selects a list of nodes matching the XPath expression.

Only expressions with element names are supported at the moment. Expressions that use attribute names are not supported.

Parameters:
xpath - The XPath expression.
Returns:
A list of nodes matching the XPath query.

selectSingleNode

→ inherited from CompositeNode
public Node selectSingleNode(java.lang.String xpath)
Selects the first Node that matches the XPath expression.

Only expressions with element names are supported at the moment. Expressions that use attribute names are not supported.

Parameters:
xpath - The XPath expression.
Returns:
The first Node that matches the XPath query or null if no matching node is found.

setSectionAttr

public void setSectionAttr(int key, java.lang.Object value)
Reserved for internal use.

startTrackRevisions

public void startTrackRevisions(java.lang.String author)
Starts automatically marking all further changes you make to the document programmatically as revision changes.

If you call this method and then make some changes to the document programmatically, save the document and later open the document in MS Word you will see these changes as revisions.

Currently Aspose.Words supports tracking of node insertions and deletions only. Formatting changes are not recorded as revisions.

Automatic tracking of changes is supported both when modifying this document through node manipulations as well as when using DocumentBuilder

This method does not change the TrackRevisions option and does not use its value for the purposes of revision tracking.

Parameters:
author - Initials of the author to use for revisions.
See Also:
stopTrackRevisions()

startTrackRevisions

public void startTrackRevisions(java.lang.String author, java.util.Date dateTime)
Starts automatically marking all further changes you make to the document programmatically as revision changes.

If you call this method and then make some changes to the document programmatically, save the document and later open the document in MS Word you will see these changes as revisions.

Currently Aspose.Words supports tracking of node insertions and deletions only. Formatting changes are not recorded as revisions.

Automatic tracking of changes is supported both when modifying this document through node manipulations as well as when using DocumentBuilder

This method does not change the TrackRevisions option and does not use its value for the purposes of revision tracking.

Parameters:
author - Initials of the author to use for revisions.
dateTime - The date and time to use for revisions.
See Also:
stopTrackRevisions()

stopTrackRevisions

public void stopTrackRevisions()
Stops automatic marking of document changes as revisions.
See Also:
startTrackRevisions(java.lang.String,java.util.Date)

toString

→ inherited from Node
public java.lang.String toString(int saveFormat)
               throws java.lang.Exception
Exports the content of the node into a string in the specified format.
Returns:
The content of the node in the specified format.
Parameters:
saveFormat - A SaveFormat value.

toTxt

→ inherited from Node
public java.lang.String toTxt()
            throws java.lang.Exception
Exports the content of the node into a string in plain text format.

This method removes field codes and Microsoft Word control characters, uses CrLf (or any other) combination of characters to mark ends of paragraphs in the resulting string. It produces a different result from getText() which just gets the text from the node without removing field codes or special characters.

Returns:
The content of the node in plain text format.
See Also:
#Error Cref: P:Aspose.Words.Saving.TxtSaveOptions.ParagraphBreak, #Error Cref: P:Aspose.Words.Saving.TxtSaveOptions.ExportHeadersFooters

unlinkFields

public void unlinkFields()
                 throws java.lang.Exception
Unlinks fields in the whole document.

Replaces all the fields in the whole document with their most recent results.

To unlink fields in a specific part of the document use Range.unlinkFields().


unprotect

public void unprotect()
Removes protection from the document regardless of the password.

This method unprotects the document even if it has a protection password.

Note that document protection is different from write protection. Write protection is specified using the WriteProtection.


unprotect

public boolean unprotect(java.lang.String password)
Removes protection from the document if a correct password is specified.

This method unprotects the document only if a correct password is specified.

Note that document protection is different from write protection. Write protection is specified using the WriteProtection.

Parameters:
password - The password to unprotect the document with.
Returns:
True if a correct password was specified and the document was unprotected.

updateFields

public void updateFields()
                 throws java.lang.Exception
Updates the values of fields in the whole document.

When you open, modify and then save a document, Aspose.Words does not update fields automatically, it keeps them intact. Therefore, you would usually want to call this method before saving if you have modified the document programmatically and want to make sure the proper (calculated) field values appear in the saved document.

There is no need to update fields after executing a mail merge because mail merge is a kind of field update and automatically updates all fields in the document.

This method does not update all field types. For the detailed list of supported field types, see the Programmers Guide.

This method does not update fields that are related to the page layout algorithms (e.g. PAGE, PAGES, PAGEREF). The page layout-related fields are updated when you render a document or call updatePageLayout().

Use the normalizeFieldTypes() method before fields updating if there were document changes that affected field types.

To update fields in a specific part of the document use Range.updateFields().


updateListLabels

public void updateListLabels()
                     throws java.lang.Exception
Updates list labels for all list items in the document.

This method updates list label properties such as #Error Cref: P:Aspose.Words.Lists.ListLabel.LabelValue and #Error Cref: P:Aspose.Words.Lists.ListLabel.LabelString for each Paragraph.ListLabel object in the document.

Also, this method is sometimes implicitly called when updating fields in the document. This is required because some fields that may reference list numbers (such as TOC or REF) need them be up-to-date.


updatePageLayout

public void updatePageLayout()
                     throws java.lang.Exception
Rebuilds the page layout of the document.

This method formats a document into pages and updates the page number related fields in the document such as PAGE, PAGES, PAGEREF and REF. The up-to-date page layout information is required for a correct rendering of the document to fixed-page formats.

This method is automatically invoked when you first convert a document to PDF, XPS, image or print it. However, if you modify the document after rendering and then attempt to render it again - Aspose.Words will not update the page layout automatically. In this case you should call updatePageLayout() before rendering again.


updateTableLayout

public void updateTableLayout()
Updates widths of cells and tables in the document according to their preferred widths and content. You do not need to call this method if the tables appear correct in the output document.

You do not normally need to call this method as cell and table widths are maintained automatically. You can call this method before exporting to PDF (or any other fixed-page format), only in rare cases where you confirmed that tables appear incorrectly laid out in the output document. Calling this method might help to correct the output.


updateThumbnail

public void updateThumbnail()
                    throws java.lang.Exception
Updates #Error Cref: P:Aspose.Words.Properties.BuiltInDocumentProperties.Thumbnail of the document using default options.

updateWordCount

public void updateWordCount()
                    throws java.lang.Exception
Updates word count properties of the document.

UpdateWordCount recalculates and updates Characters, Words and Paragraphs properties in the BuiltInDocumentProperties collection of the Document.

Note that UpdateWordCount does not update number of lines and pages properties. Use the updateWordCount() overload and pass True value as a parameter to do that.

When you use an evaluation version, the evaluation watermark will also be included in the word count.


updateWordCount

public void updateWordCount(boolean updateLinesCount)
                    throws java.lang.Exception
Updates word count properties of the document, optionally updates #Error Cref: P:Aspose.Words.Properties.BuiltInDocumentProperties.Lines property. This method will rebuild page layout of the document.
Parameters:
updateLinesCount - True if number of lines in the document shall be calculated.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.