Table of Contents

Method SetContent

Namespace
DocWright.Dom
Assembly
DocWright.Dom.dll

SetContent(byte[])

Replaces the part's bytes in memory.

public void SetContent(byte[] content)

Parameters

content byte[]

The new bytes.

Remarks

A preserved part is opaque to the model, so writing one back is the only way to edit it. Custom XML data binding needs exactly this: a bound content control's value lives in a customXml/itemN.xml part, and updating the control without updating the part leaves Word free to overwrite the control from the data the next time it refreshes.

The writer already copies preserved parts through OpenStream(), so a replaced part reaches the output with no further plumbing. The array is stored by reference and must not be mutated afterwards.

Exceptions

ArgumentNullException

content is null.