ImportFormatOptions Class
Allows to specify various import options to format output.
Inheritance Hierarchy
SystemObject
  Aspose.WordsImportFormatOptions

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
Syntax
public class ImportFormatOptions

The ImportFormatOptions type exposes the following members.

Constructors
  NameDescription
Public methodImportFormatOptions
Initializes a new instance of the ImportFormatOptions class
Properties
  NameDescription
Public propertyCode exampleIgnoreTextBoxes
Gets or sets a boolean value that indicates whether to ignore formatting in the text boxes of the source destination during the import. Default value is true.
Public propertyCode exampleKeepSourceNumbering
Gets or sets a boolean value that specifies how the numbering will be imported when it clashes in source and destination documents. The default value is false.
Public propertyCode exampleSmartStyleBehavior
Gets or sets a boolean value that specifies how styles will be imported when they have equal names in source and destination documents. The default value is false.
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Examples
Shows how to resolve styles behavior while inserting documents.
[C#]

Document destDoc = new Document(MyDir + "DocumentBuilder.SmartStyleBehavior.DestinationDocument.docx");
Document sourceDoc1 = new Document(MyDir + "DocumentBuilder.SmartStyleBehavior.SourceDocument01.docx");
Document sourceDoc2 = new Document(MyDir + "DocumentBuilder.SmartStyleBehavior.SourceDocument02.docx");

DocumentBuilder builder = new DocumentBuilder(destDoc);

builder.MoveToDocumentEnd();
builder.InsertBreak(BreakType.PageBreak);
builder.MoveToDocumentEnd();

ImportFormatOptions importFormatOptions = new ImportFormatOptions();
importFormatOptions.SmartStyleBehavior = true;

// When SmartStyleBehavior is enabled,
// a source style will be expanded into a direct attributes inside a destination document,
// if KeepSourceFormatting importing mode is used.
builder.InsertDocument(sourceDoc1, ImportFormatMode.KeepSourceFormatting, importFormatOptions);

builder.MoveToDocumentEnd();
builder.InsertBreak(BreakType.PageBreak);

// When SmartStyleBehavior is disabled,
// a source style will be expanded only if it is numbered.
// Existing destination attributes will not be overridden, including lists.
builder.InsertDocument(sourceDoc2, ImportFormatMode.UseDestinationStyles);

destDoc.Save(ArtifactsDir + @"DocumentBuilder.SmartStyleBehavior.ResultDocument.docx");
See Also