예제 #1
0
        private static void DumpRtfRecursively_List(List list, OutlinerNote outlinerNote)
        {
            foreach (var note in outlinerNote.SubNotes)
            {
                MemoryStream sectionStream = ExportToXaml_Printing.TransformFlowDocumentToSection(note.DefaultRichTextDocument);
                ListItem     newItem       = new ListItem();

                Section section = XamlReader.Load(sectionStream) as Section;
                if (section == null)
                {
                    section = new Section();
                }

                newItem.Blocks.Add(section);
                list.ListItems.Add(newItem);

                if (outlinerNote.SubNotes.Count > 0)
                {
                    List newList = new List();
                    list.FontFamily = UVOutliner.Settings.DefaultFontFamily;
                    list.FontSize   = UVOutliner.Settings.DefaultFontSize;

                    newItem.Blocks.Add(newList);
                    DumpRtfRecursively_List(newList, note);
                }
            }
        }
예제 #2
0
        private void UpdateExportedDocument()
        {
            string documentAsXaml = ExportToXaml_Printing.ExportToXaml(Document, __MainWindow);

            MemoryStream stream = new MemoryStream();
            StreamWriter writer = new StreamWriter(stream);

            writer.Write(documentAsXaml);
            writer.Flush();
            stream.Seek(0, SeekOrigin.Begin);

            FlowDocument document = XamlReader.Load(stream) as FlowDocument;

            string fileName = System.IO.Path.GetTempFileName() + ".xps";

            PrintHelpers.SaveAsXps(document, fileName, new Size(800, 1024));
            XpsDocument           xpsDocument = new XpsDocument(fileName, FileAccess.ReadWrite);
            FixedDocumentSequence fixedDocSeq = xpsDocument.GetFixedDocumentSequence();

            //pDialog.PrintDocument(fixedDocSeq.DocumentPaginator, "UV Outliner document");

            DocumentViewer.Document = fixedDocSeq;
            PleaseWait.Visibility   = Visibility.Collapsed;
        }