Exemplo n.º 1
0
        void preview_DocumentPreviewMouseClick(DependencyObject d, DocumentPreviewMouseEventArgs e)
        {
            DocumentPreviewControl  preview = e.OriginalSource as DocumentPreviewControl;
            ReportDocumentViewModel model   = preview.Document as ReportDocumentViewModel;
            PropertyInfo            pi      = model.GetType().GetProperty("Report", BindingFlags.NonPublic | BindingFlags.Public
                                                                          | BindingFlags.Instance | BindingFlags.Static);

            XtraReport currentReport = pi.GetValue(model, null) as XtraReport;

            if (currentReport == null)
            {
                return;
            }
            if (String.Equals(currentReport.Tag.ToString(), "Master"))
            {
                if (e.ElementTag != null && !String.IsNullOrEmpty(e.ElementTag.ToString()))
                {
                    string categoryName = (e.Brick as VisualBrick).Text;
                    int    categoryID   = Convert.ToInt32(e.ElementTag);
                    currentPageIndex = e.PageIndex + 1;
                    XtraReport detailReport = GetDetailReport(categoryName, categoryID);
                    preview.DocumentSource = detailReport;
                }
            }
            if (String.Equals(currentReport.Tag.ToString(), "Detail"))
            {
                preview.DocumentSource = null;
                preview.DocumentSource = masterReport;
                masterReport.CreateDocument();
                preview.CurrentPageNumber = currentPageIndex;
            }
        }
Exemplo n.º 2
0
 protected virtual DXTabItem CreateTabItem(DocumentPreviewControl preview, string documentName)
 {
     return(new DXTabItem()
     {
         AllowHide = DefaultBoolean.True, Content = preview, Header = documentName
     });
 }
Exemplo n.º 3
0
        public static void ShowDesignerPrintPreview(XtraReport report)
        {
            DocumentPreviewControl preview = new DocumentPreviewControl();

            preview.DocumentSource = report;
            Window w = new Window();

            w.Content = preview;
            report.CreateDocument(true);
            w.ShowDialog();
        }
            public bool EvaluateCondition()
            {
                if (fixture.DemoBaseTesting.CurrentDemoModule == null)
                {
                    return(true);
                }
                DocumentPreviewControl viewer = BaseTestingFixture.HelperActions.FindElementByType <DocumentPreviewControl>(fixture.DemoBaseTesting.CurrentDemoModule);
                IDocumentViewModel     model  = viewer.Document;
                bool documentBuilt            = model == null ? false : !model.IsCreating && model.Pages.Count > 0;

                return(documentBuilt);
            }
        protected internal void WordPrint(string text)
        {
            reds.RtfText = text;

            LegacyPrintableComponentLink link = new LegacyPrintableComponentLink(reds);

            dpc = new DocumentPreviewControl();
            dpc.DocumentSource = link;
            link.CreateDocument();

            dpc.PrintCommand.Execute(null);
        }
 protected override void CreateSetCurrentDemoActions(ModuleDescription module, bool checkMemoryLeaks)
 {
     base.CreateSetCurrentDemoActions(module, checkMemoryLeaks);
     AddConditionAction(DocumentBuildCompletedConditionFactory.Create(this), null);
     AddSimpleAction(delegate() {
         if (DemoBaseTesting.CurrentDemoModule != null)
         {
             DocumentPreviewControl activePreview = LayoutHelper.FindElement(DemoBaseTesting.CurrentDemoModule, IsDocumentViewer) as DocumentPreviewControl;
             Assert.IsNotNull(activePreview);
         }
     });
 }
Exemplo n.º 7
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Window w = new Window();
            DocumentPreviewControl preview = new DocumentPreviewControl();

            preview.DocumentPreviewMouseClick += preview_DocumentPreviewMouseClick;
            w.Content              = preview;
            masterReport           = GetMasterReport();
            preview.DocumentSource = masterReport;
            masterReport.CreateDocument();
            w.Show();
        }
Exemplo n.º 8
0
        protected virtual void OnShowPrintPreviewInNewTab(string documentName)
        {
            PrintableControlLink   link    = new PrintableControlLink((IPrintableControl)TreeListControl.View);
            DocumentPreviewControl preview = new DocumentPreviewControl()
            {
                DocumentSource = link
            };
            DXTabItem tabItem = CreateTabItem(preview, documentName);

            tabItem.Tag = link;
            DXTabControl.Items.Add(tabItem);
            DXTabControl.SelectedItem = tabItem;
            link.CreateDocument(true);
        }
Exemplo n.º 9
0
        public void ShowPrintPreviewInNewTab(GridControl grid, DXTabControl tabControl, string tabName)
        {
            PrintableControlLink   link    = new PrintableControlLink((IPrintableControl)grid.View);
            DocumentPreviewControl preview = new DocumentPreviewControl()
            {
                DocumentSource = link
            };

            DXTabItem tabItem = new DXTabItem()
            {
                AllowHide = DefaultBoolean.True, Content = preview, Header = tabName
            };

            tabItem.Tag = link;
            tabControl.Items.Add(tabItem);
            tabControl.SelectedItem = tabItem;

            link.CreateDocument(true);
        }
        protected internal void PicturePrint(MemoryStream image)
        {
            reds.Document.Sections[0].Page.PaperKind = System.Drawing.Printing.PaperKind.A4;
            reds.Document.Unit = DevExpress.Office.DocumentUnit.Centimeter;

            reds.Document.Sections[0].Paragraphs[0].Alignment = ParagraphAlignment.Center;
            reds.Document.Shapes.InsertPicture(reds.Document.Sections[0].Paragraphs[0].Range.Start, DocumentImageSource.FromStream(new MemoryStream(image.ToArray())));
            reds.Document.Shapes[0].LockAspectRatio     = true;
            reds.Document.Shapes[0].HorizontalAlignment = ShapeHorizontalAlignment.Center;
            reds.Document.Shapes[0].VerticalAlignment   = ShapeVerticalAlignment.Center;

            float X = (reds.Document.Sections[0].Page.Width - 2) / reds.Document.Shapes[0].Size.Width;
            float Y = (reds.Document.Sections[0].Page.Height - 2) / reds.Document.Shapes[0].Size.Height;

            reds.Document.Shapes[0].ScaleX = reds.Document.Shapes[0].ScaleY = X > Y ? Y : X;

            LegacyPrintableComponentLink link = new LegacyPrintableComponentLink(reds);

            dpc = new DocumentPreviewControl();
            dpc.DocumentSource = link;
            link.CreateDocument();

            dpc.PrintCommand.Execute(null);
        }