API Reference

Class

WordEmbeddedDocument

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word

Represents an embedded document within a WordDocument.

Inheritance

Usage

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters

Constructors

WordEmbeddedDocument 2 overloads
public WordEmbeddedDocument(WordDocument wordDocument, AltChunk altChunk) #

Initializes a new instance of the WordEmbeddedDocument class based on an existing AltChunk element.

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
Parent WordDocument.
altChunk DocumentFormat.OpenXml.Wordprocessing.AltChunk requiredposition: 1
AltChunk that defines the embedded content.
public WordEmbeddedDocument(WordDocument wordDocument, String fileNameOrContent, Nullable<WordAlternativeFormatImportPartType> alternativeFormatImportPartType, Boolean htmlFragment) #

Initializes a new instance of the WordEmbeddedDocument class using the specified file or HTML fragment.

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
Parent WordDocument.
fileNameOrContent System.String requiredposition: 1
File path or HTML content to embed.
alternativeFormatImportPartType System.Nullable{OfficeIMO.Word.WordAlternativeFormatImportPartType} requiredposition: 2
Explicit part type or null to infer from the file extension.
htmlFragment System.Boolean requiredposition: 3
When true, fileNameOrContent is treated as HTML markup rather than a file path.

Methods

public String GetHtml() #
Returns: String

Retrieves the HTML markup of the embedded document when available.

Returns

HTML content or null if the embedded document is not HTML.

public async Task<String> GetHtmlAsync(CancellationToken cancellationToken = null) #
Returns: Task<String>

Asynchronously retrieves the HTML markup of the embedded document when available.

Parameters

cancellationToken System.Threading.CancellationToken = null optionalposition: 0
public Stream OpenRead() #
Returns: Stream

Opens a readable stream for the embedded document payload.

public Void Remove() #
Returns: Void

Removes the embedded document from the parent WordDocument.

Save 2 overloads
public Void Save(Stream stream) #
Returns: Void

Saves the embedded document to the specified file.

Parameters

fileName System.String requiredposition: 0
Target file path.
Save(System.IO.Stream stream) #

Saves the embedded document to a caller-owned stream.

Parameters

stream System.IO.Stream required
SaveAsync 2 overloads
public async Task SaveAsync(Stream stream, CancellationToken cancellationToken = null) #
Returns: Task

Saves the embedded document to the specified file asynchronously.

Parameters

fileName System.String requiredposition: 0
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
SaveAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) #

Saves the embedded document to a caller-owned stream asynchronously.

Parameters

stream System.IO.Stream required
cancellationToken System.Threading.CancellationToken required
public Byte[] ToBytes() #
Returns: Byte[]

Returns a copy of the embedded document payload.

public MemoryStream ToStream() #
Returns: MemoryStream

Returns the embedded document payload in a new stream positioned at the beginning.

Properties

public String ContentType { get; } #

Gets the content type of the embedded document.