API Reference
WordEmbeddedDocument
Represents an embedded document within a WordDocument.
Inheritance
- WordElement
- WordEmbeddedDocument
Usage
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by
Accepted by parameters
Constructors
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
- Parent WordDocument.
- altChunk DocumentFormat.OpenXml.Wordprocessing.AltChunk
- 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
- Parent WordDocument.
- fileNameOrContent System.String
- File path or HTML content to embed.
- alternativeFormatImportPartType System.Nullable{OfficeIMO.Word.WordAlternativeFormatImportPartType}
- Explicit part type or null to infer from the file extension.
- htmlFragment System.Boolean
- When true, fileNameOrContent is treated as HTML markup rather than a file path.
Methods
public String GetHtml() #StringRetrieves 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) #Task<String>Asynchronously retrieves the HTML markup of the embedded document when available.
Parameters
- cancellationToken System.Threading.CancellationToken = null
public async Task SaveAsync(Stream stream, CancellationToken cancellationToken = null) #TaskSaves the embedded document to the specified file asynchronously.
Parameters
- fileName System.String
- cancellationToken System.Threading.CancellationToken = null
SaveAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) #Saves the embedded document to a caller-owned stream asynchronously.
Parameters
- stream System.IO.Stream
- cancellationToken System.Threading.CancellationToken
public MemoryStream ToStream() #MemoryStreamReturns the embedded document payload in a new stream positioned at the beginning.
Inherited Methods
Properties
public String ContentType { get; } #Gets the content type of the embedded document.