Пример #1
0
        public static void ShowDesigner(IDocumentData documentData, IObjectSpace objectSpace, XafApplication application)
        {
            SnapDocumentHelper helper   = new SnapDocumentHelper(documentData, objectSpace, application);
            SnapDesigner       designer = new SnapDesigner(helper);

            designer.ShowDialog();
        }
Пример #2
0
 public static void ShowPrintPreview(IDocumentData documentData, IObjectSpace objectSpace, CriteriaOperator inPlaceCriteria)
 {
     using (SnapDocumentServer server = new SnapDocumentServer()) {
         SnapDocumentHelper helper = new SnapDocumentHelper(documentData, objectSpace, null, inPlaceCriteria);
         helper.LoadDocument(server.Document);
         // Mail Merge
         if (server.Document.DataSources.Count == 1 && server.Options.SnapMailMergeVisualOptions.DataSource == server.Document.DataSources[0].DataSource)
         {
             using (MemoryStream stream = new MemoryStream()) {
                 server.SnapMailMerge(stream, SnapDocumentFormat.Snap);
                 stream.Flush();
                 stream.Seek(0, SeekOrigin.Begin);
                 server.LoadDocument(stream, SnapDocumentFormat.Snap);
             }
         }
         using (PrintingSystem ps = new PrintingSystem()) {
             PrintableComponentLink link = new PrintableComponentLink(ps);
             link.Component = server;
             link.CreateDocument();
             link.ShowPreviewDialog();
         }
     }
 }