If you wish to export your document and store it in a variable defined in code, you can do that using one of our format providers
. If you simply wish to save the contents of the document as plain text, you can use the TxtFormatProvider. On the other hand, if you need the content of the document as rich text and do not have any requirements for a specific format, we usually recommend using the XamlFormatProvider as it is native for the document's structure. You can find code samples in the help article I referenced.
If, however, you wish to adopt a data-bound scenario, you can refer to our data providers
. They basically encapsulate the format providers and allow usage in XAML.