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.11
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 (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
Shows how to resolve styles behavior while inserting documents.
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