Exemplo n.º 1
0
        private void btnExport_Click(object sender, RoutedEventArgs e)
        {
            DateTime dtBegin      = (DateTime)deBegin.EditValue;
            DateTime dtEnd        = (DateTime)deEnd.EditValue;
            string   formatString = "dd.MM.yy HH_mm";

            DocumentPreviewWindow preview = new DocumentPreviewWindow();
            CollectionViewLink    link    = new CollectionViewLink();

            link.PrintingSystem.ExportOptions.PrintPreview.DefaultExportFormat = DevExpress.XtraPrinting.PrintingSystemCommand.ExportXlsx;
            link.PrintingSystem.ExportOptions.PrintPreview.DefaultFileName     = string.Format("{0} (с {1} по {2})", Item.Description, dtBegin.ToString(formatString), dtEnd.ToString(formatString));
            link.PaperKind        = DevExpress.Xpf.Drawing.Printing.PaperKind.A4;
            link.Margins.Bottom   = link.Margins.Top = link.Margins.Left = link.Margins.Right = 10;
            link.ExportServiceUri = string.Format("http://{0}/ExportService.svc", Global.Default.ServerIPAddress);
            LinkPreviewModel model = new LinkPreviewModel(link);

            CollectionViewSource collectionViewSource = new CollectionViewSource
            {
                Source = Trends
            };

            link.CollectionView = collectionViewSource.View;

            link.DetailTemplate       = (DataTemplate)Resources["trendDataTemplate"];
            link.ReportHeaderTemplate = (DataTemplate)Resources["trendHeaderTemplate"];

            preview.Model = model;
            link.CreateDocument(false);
            preview.ShowDialog();
        }
Exemplo n.º 2
0
        protected override void ProcessLink(TemplatedLink link)
        {
            IsRepeatHeaderEveryPageEnabled = !(PageBreakAfter || KeepTogether);
            IsPageBreakAfterEnabled        = !RepeatHeaderEveryPage;
            IsKeepTogetherEnabled          = !RepeatHeaderEveryPage;
            CollectionViewLink collectionViewLink = (CollectionViewLink)link;

            collectionViewLink.GroupInfos[0].Union = KeepTogether ? GroupUnion.WholePage : GroupUnion.None;
            collectionViewLink.GroupInfos[0].RepeatHeaderEveryPage = RepeatHeaderEveryPage;
            collectionViewLink.GroupInfos[0].PageBreakAfter        = PageBreakAfter;
        }
Exemplo n.º 3
0
        protected override TemplatedLink CreateLink()
        {
            CollectionViewLink link = new CollectionViewLink();

            link.GroupInfos.Add(new GroupInfo(GroupHeaderTemplate));
            link.ReportHeaderTemplate = ReportHeaderTemplate;
            link.DetailTemplate       = DetailTemplate;
            link.PageFooterTemplate   = PageFooterTemplate;
            link.CollectionView       = CreateCollectionViewSource().View;
            link.DocumentName         = "Products by Categories";
            return(link);
        }
Exemplo n.º 4
0
        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            // Create a link and bind it to the PrintPreview instance.
            CollectionViewLink link = new CollectionViewLink();

            preview.Model = new LinkPreviewModel(link);

            // Create an ICollectionView object.
            link.CollectionView   = CreateMonthCollectionView();
            link.ExportServiceUri = "../ExportService1.svc";

            // Provide export templates.
            link.DetailTemplate = (DataTemplate)Resources["monthNameTemplate"];
            link.GroupInfos.Add(new GroupInfo((DataTemplate)Resources["monthQuarterTemplate"]));

            // Create a document.
            link.CreateDocument(true);
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            // Create a link and bind it to the PrintPreview instance.
            CollectionViewLink link = new CollectionViewLink();

            //preview.Model = new LinkPreviewModel(link);

            // Create an ICollectionView object.
            link.CollectionView = CreateMonthCollectionView();

            // Provide export templates.
            link.DetailTemplate = (DataTemplate)Resources["monthNameTemplate"];
            link.GroupInfos.Add(new GroupInfo((DataTemplate)Resources["monthQuarterTemplate"]));

            // Create a document.
            link.CreateDocument(true);

            // Show a Print Preview.
            PrintHelper.ShowPrintPreviewDialog(this, link);
        }