Not
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
This example demonstrates how to save the contents of a FlowDocumentScrollViewer (represented by the Document property) as a XAML file.
Example
The following example defines an empty, named FlowDocumentScrollViewer that will be manipulated by the code example below.
<FlowDocumentScrollViewer
Name="flowDocScrollViewer"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
IsSelectionEnabled="True"
IsToolBarVisible="True"
MinZoom="50" MaxZoom="1000"
Zoom="120" ZoomIncrement="5"
/>
To save the contents of the FlowDocumentScrollViewer to a file, open or create the file stream and use the Save method provided by the XamlWriter class to write the FlowDocument to the file stream.
The following example performs these steps.
void SaveFlowDocumentScrollViewerWithXAMLFile(string fileName)
{
// Open or create the output file.
FileStream xamlFile = new FileStream(fileName, FileMode.Create, FileAccess.ReadWrite);
// Save the contents of the FlowDocumentReader to the file stream that was just opened.
XamlWriter.Save(flowDocScrollViewer.Document, xamlFile);
xamlFile.Close();
}