Edit

Share via


Word.InsertFileOptions interface

Specifies the options to determine what to copy when inserting a file.

Remarks

[ API set: WordApi 1.5 ]

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/insert-external-document.yaml

// Inserts content (applying selected settings) from another document passed in as a Base64-encoded string.
await Word.run(async (context) => {
  // Use the Base64-encoded string representation of the selected .docx file.
  context.document.insertFileFromBase64(externalDocument, "Replace", {
    importTheme: true,
    importStyles: true,
    importParagraphSpacing: true,
    importPageColor: true,
    importChangeTrackingMode: true,
    importCustomProperties: true,
    importCustomXmlParts: true,
    importDifferentOddEvenPages: true
  });
  await context.sync();
});

Properties

importChangeTrackingMode

If provided, specifies whether the change tracking mode status from the source document should be imported.

importCustomProperties

If provided, specifies whether the custom properties from the source document should be imported. Overwrites existing properties with the same name.

importCustomXmlParts

If provided, specifies whether the custom XML parts from the source document should be imported.

importDifferentOddEvenPages

If provided, specifies whether to import the Different Odd and Even Pages setting for the header and footer from the source document.

importPageColor

If provided, specifies whether the page color and other background information from the source document should be imported.

importParagraphSpacing

If provided, specifies whether the paragraph spacing from the source document should be imported.

importStyles

If provided, specifies whether the styles from the source document should be imported.

importTheme

If provided, specifies whether the theme from the source document should be imported.

Property Details

importChangeTrackingMode

If provided, specifies whether the change tracking mode status from the source document should be imported.

importChangeTrackingMode?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi 1.5 ]

importCustomProperties

If provided, specifies whether the custom properties from the source document should be imported. Overwrites existing properties with the same name.

importCustomProperties?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi 1.6 ]

importCustomXmlParts

If provided, specifies whether the custom XML parts from the source document should be imported.

importCustomXmlParts?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi 1.6 ]

importDifferentOddEvenPages

If provided, specifies whether to import the Different Odd and Even Pages setting for the header and footer from the source document.

importDifferentOddEvenPages?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi 1.7 ]

importPageColor

If provided, specifies whether the page color and other background information from the source document should be imported.

importPageColor?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi 1.5 ]

importParagraphSpacing

If provided, specifies whether the paragraph spacing from the source document should be imported.

importParagraphSpacing?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi 1.5 ]

importStyles

If provided, specifies whether the styles from the source document should be imported.

importStyles?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi 1.5 ]

importTheme

If provided, specifies whether the theme from the source document should be imported.

importTheme?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi 1.5 ]