Exemple #1
0
        private void exportButton_Click(object sender, EventArgs e)
        {
            var reportName = (string)reportsNames.SelectedItem;
            var exportType = (string)exportTypes.SelectedItem;
            IDocumentExportEx documentExportEx = null;

            var report = new SectionReport();

            System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(@"..\..\..\..\Reports\" + reportName);
            report.LoadLayout(xtr);
            report.Run();

            var exporTypeLower = exportType.ToLower();

            switch (exporTypeLower)
            {
            case _pdf:
                documentExportEx = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
                break;

            case _xlsx:
                documentExportEx = new GrapeCity.ActiveReports.Export.Excel.Section.XlsExport()
                {
                    FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx
                };
                break;

            case _rtf:
                documentExportEx = new GrapeCity.ActiveReports.Export.Word.Section.RtfExport();
                break;

            case _mht:
                documentExportEx = new GrapeCity.ActiveReports.Export.Html.Section.HtmlExport();
                break;

            case _csv:
                documentExportEx = new GrapeCity.ActiveReports.Export.Xml.Section.TextExport();
                break;
            }

            var fileName       = Path.GetFileNameWithoutExtension(reportName);
            var saveFileDialog = new SaveFileDialog()
            {
                FileName = fileName + GetSaveDialogExtension(exporTypeLower),
                Filter   = GetSaveDialogFilter(exporTypeLower)
            };


            if (saveFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            exportButton.Enabled = false;
            using (var stream = new FileStream(Path.Combine(saveFileDialog.FileName), FileMode.Create))
                documentExportEx.Export(report.Document, stream);
            exportButton.Enabled = true;
        }
Exemple #2
0
        private void LoadReportsForPDF(string pdfLoc)
        {
            string proj;

            this.Cursor = Cursors.WaitCursor;

            GrapeCity.ActiveReports.SectionReport rprtMain = new GrapeCity.ActiveReports.SectionReport();
            GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport pdfOut;



            lblStatus.Text = "Saving - ";
            Application.DoEvents();

            GrapeCity.ActiveReports.Document.Section.PagesCollection pagesForecast;


            SqlDataReader dr;


            dr = GetListbyBillType(BillID);

            while (dr.Read())
            {
                proj = dr["number"].ToString();


                lblStatus.Text = "Saving - " + proj;
                Application.DoEvents();



                pagesForecast = CreatePagesForecast(proj, FCRMain.GetRprtCase(proj));

                for (int k = 0; k < pagesForecast.Count; k++)
                {
                    rprtMain.Document.Pages.Add(pagesForecast[k]);
                }
            }


            pdfOut = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();

            pdfOut.Export(rprtMain.Document, pdfLoc);

            this.Cursor = Cursors.Default;

            MessageBox.Show("Reports created");
            this.Close();
        }
Exemple #3
0
        private void c1Button1_Click(object sender, EventArgs e) //******************Added 11/18
        {
            GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PDFEx = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
            //  MessageBox.Show(reportType);
            Report_Name = CreateFileNAme();
            SaveFileDialog sv1 = new SaveFileDialog();

            sv1.InitialDirectory = "v:\\HGA\\";
            sv1.FileName         = Report_Name;
            sv1.Filter           = "PDF Files | *.pdf";
            sv1.DefaultExt       = "pdf";

            if (sv1.ShowDialog() == DialogResult.OK)
            {
                viewer1.Export(PDFEx, new System.IO.FileInfo(sv1.FileName));
            }
        }
Exemple #4
0
        private void PDFExport_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (rpt != null)
                {
                    string fName = ConfigEntry <string> .GetConfigEntry("BelegePFDExport", @"F:\ALLGEMEIN\EDV\Datenbank_Neu\Export\Belege\");

                    fName += String.Format("{0}.pdf", BelegvModel.Belegnummer.Trim());
                    GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport1 = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
                    PdfExport1.Export(rpt.Document, fName);
                }
            }
            catch (Exception ex)
            {
                CommonTools.Tools.ErrorMethods.HandleStandardError(ex, "Fehler bei PDF Erzeugung.");
            }
        }
Exemple #5
0
        void ShowReport()
        {
            try
            {
                int BelegID = BelID;

                pageDocument = ActiveReportsTools <int> .GetDocument(StaticMethods.GetPath(Belegname));

                pageDocument.LocateDataSource += new LocateDataSourceEventHandler(pageDocument_LocateDataSource);

                int res = CommonTools.Tools.ConfigEntry <int> .GetConfigEntry("DoPdfExportBelege", "0");

                if (res == 1)
                {
                    string fName = ConfigEntry <string> .GetConfigEntry("BelegePFDExport", @"F:\ALLGEMEIN\EDV\Datenbank_Neu\Export\Belege\");

                    fName += String.Format("{0}.pdf", BelegvModel.Belegnummer.Trim());
                    GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport1 = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
                    PdfExport1.Export(pageDocument, fName);
                }
                viewer1.LoadDocument(pageDocument);


                //LoggingTool.LogMessage("Calling Getdocument", "BelegViewer", "ShowReport", LoggingTool.LogState.low);
                //pageDocument = ActiveReportsTools<int>.GetDocument(StaticMethods.GetPath(Belegname));
                //LoggingTool.LogMessage("Calling LocateDataSource", "BelegViewer", "ShowReport", LoggingTool.LogState.low);
                //pageDocument.LocateDataSource += new LocateDataSourceEventHandler(pageDocument_LocateDataSource);
                //LoggingTool.LogMessage("Calling LoadDocument", "BelegViewer", "ShowReport", LoggingTool.LogState.low);
                //viewer1.LoadDocument(pageDocument);
                ////LoggingTool.LogMessage("Calling LoadCompleted", "BelegViewer", "ShowReport", LoggingTool.LogState.low);
                ////viewer1.LoadCompleted += new GrapeCity.ActiveReports.Document.LoadCompletedEventHandler(viewer1_LoadCompleted);
                //LoggingTool.LogMessage("Done ShowReport", "BelegViewer", "ShowReport", LoggingTool.LogState.low);
            }
            catch (System.IO.IOException ex)
            {
                ErrorMethods.HandleStandardError(ex);
            }
            catch (Exception ex)
            {
                ErrorMethods.HandleStandardError(ex);
            }
        }
 private void PdfSimpleButton_Click(object sender, EventArgs e)
 {
     try
     {
         var _file = string.Format(@"{0}.pdf", DateTime.Now.Ticks);
         GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport1 = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
         PdfExport1.Export(this._doc, "ExportFile\\" + _file);
         if (MessageBox.Show("File Exported Successfully, Do You want to open File ?", "Export",
                             MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             string  windir = Environment.GetEnvironmentVariable("WINDIR");
             Process prc    = new Process();
             prc.StartInfo.FileName  = windir + @"\explorer.exe";
             prc.StartInfo.Arguments = "ExportFile\\" + _file;
             prc.Start();
         }
     }
     catch (Exception ex)
     {
         Serilog.Log.Error(ex, "pdf Export");
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #7
0
        private void SendEmailView_Load(object sender, EventArgs e)
        {
            this.toMailTextEdit.Text = this.ToEmailId;
            using (var db = new KontoContext())
            {
                Comp = db.Companies.Find(KontoGlobals.CompanyId);
                var _id = (int)this.VoucherType;
                var vch = db.VoucherTypes.Find(_id);

                if (vch == null)
                {
                    return;
                }
                termsRichEditControl.HtmlText = vch.EmailBody;
                subjectTextEdit.Text          = vch.EmailSub;
                ccMailTextEdit.Text           = vch.OtherEmail;
            }

            if (this.ReportDoc != null)
            {
                this.FileName = string.Format(@"{0}.pdf", DateTime.Now.Ticks);
                GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport1 = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
                PdfExport1.Export(this.ReportDoc, "Mailfile\\" + this.FileName);
                atch1ButtonEdit.Text = "Mailfile\\" + this.FileName;
                //System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo("ExportPDF");
                //outputDirectory.Create();

                //// Provide settings for your rendering output.
                //GrapeCity.ActiveReports.Export.Pdf.Page.Settings pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();
                //GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = pdfSetting;

                ////Set the rendering extension and render the report.
                //GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
                //GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
                //ReportDoc.Render(pdfRenderingExtension, outputProvider, pdfSetting);
            }
        }
        public void ExportReport(String filename)
        {
            try
            {
                System.IO.FileInfo rptPath    = new System.IO.FileInfo(System.IO.Directory.GetCurrentDirectory() + "\\report\\" + reportfilename + ".rdlx");
                PageReport         definition = new PageReport(rptPath);
                GrapeCity.ActiveReports.Document.PageDocument runtime = new GrapeCity.ActiveReports.Document.PageDocument(definition);

                //runtime.LocateDataSource += Runtime_LocateDataSource;
                runtime.LocateDataSource += Runtime_LocateDataSource1;
                //arvMain.LoadDocument(rptPath.FullName);

                GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport1 = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
                PdfExport1.Export(runtime, filename);

                //arvMain.LoadDocument(runtime);
                Application.DoEvents();

                //List<SectionExport> sectionExports = new List<SectionExport>();
                //sectionExports.Add(new SectionExport
                ////{
                ////    DisplayName = Properties.Resources.SectionHTMLString,
                ////    Filter = Properties.Resources.HTMLFilter,
                ////    DefaultFileName = Properties.Resources.HTMLFileName,
                ////    Settings = new Export.Html.Section.HtmlExport()
                ////});
                ////sectionExports.Add(new SectionExport
                //{
                //    DisplayName = Properties.Resources.SectionPDFString,
                //    Filter = Properties.Resources.PDFFilter,
                //    DefaultFileName = Properties.Resources.PDFFileName,
                //    Settings = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport()
                //});

                //this.Show();
                //Application.DoEvents();
                //((SectionExport)sectionExports[0]).Export(arvMain.Document, filename);
            }
            catch (ReportException ex)
            {
                MessageBox.Show(ex.Message, Text);
            }

            //sectionExports.Add(new SectionExport
            //{
            //    DisplayName = Properties.Resources.SectionRTFString,
            //    Filter = Properties.Resources.RtfFilter,
            //    DefaultFileName = Properties.Resources.RtfFileName,
            //    Settings = new Export.Word.Section.RtfExport()
            //});
            //sectionExports.Add(new SectionExport
            //{
            //    DisplayName = Properties.Resources.SectionTIFFString,
            //    Filter = Properties.Resources.TiffFilter,
            //    DefaultFileName = Properties.Resources.TiffFileName,
            //    Settings = new Export.Image.Tiff.Section.TiffExport()
            //});
            //sectionExports.Add(new SectionExport
            //{
            //    DisplayName = Properties.Resources.SectionPlainTextString,
            //    Filter = Properties.Resources.TextFilter,
            //    DefaultFileName = Properties.Resources.TextFileName,
            //    Settings = new Export.Xml.Section.TextExport()
            //});
            //sectionExports.Add(new SectionExport
            //{
            //    DisplayName = Properties.Resources.SectionExcelString,
            //    Filter = Properties.Resources.ExcelFilter,
            //    DefaultFileName = Properties.Resources.ExcelFileName,
            //    Settings = new XlsExport()
            //});
            //cmbExportFormat.DataSource = sectionExports;
            //cmbExportFormat.DisplayMember = "DisplayName";
            //cmbExportFormat.SelectedIndex = 0;
        }
Exemple #9
0
        public void Show_BudgetDetails(int budID, string wbs)    //**************************Added 6/22/15
        {
            FPreviewAR       pv   = new FPreviewAR();
            rprtBudgetDetail rprt = new rprtBudgetDetail();
            DataSet          ds;
            CBBudget         bud   = new CBBudget();
            CBProject        proj  = new CBProject();
            CBCustomer       cust  = new CBCustomer();
            CBLocation       loc   = new CBLocation();
            CBState          state = new CBState();

            bud.Load(budID);
            proj.Load(bud.ProjectID);
            cust.Load(proj.CustomerID);
            loc.Load(proj.LocationID);
            state.Load(loc.StateID);

            ds = CBBudget.GetBudgetDetailsForReport(budID, wbs);


            if (proj.BusinessUnit() == 1)
            {
                rprt.MainReportTitle = "Staffing Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 2)
            {
                rprt.MainReportTitle = "Engineering Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 3)
            {
                rprt.MainReportTitle = "Pipeline Services Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 4)
            {
                rprt.MainReportTitle = "Program Management Estimate Loaded Details";
            }
            if (proj.BusinessUnit() == 5)
            {
                rprt.MainReportTitle = "EPC Estimate Loaded Details";
            }

            rprt.SetTitles(cust.Name + " / " + loc.City + "," + state.Abbrev, proj.Description, proj.Number, bud.GetNumber(), wbs);
            rprt.DataSource = ds;
            rprt.DataMember = "Table";

            //pv.ViewReport(rprt);
            //pv.ShowDialog();



            GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PDFEx = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();

            pv.Title = rprt.MainReportTitle;  //************************Added 10/1/2015
            rprt.Run();

            SaveFileDialog sv1 = new SaveFileDialog();

            sv1.Filter     = "PDF Files | *.pdf";
            sv1.DefaultExt = "pdf";

            //PDFEx.FileFormat = GrapeCity.ActiveReports.Export.Pdf.Section.FileFormat.Xlsx;


            if (sv1.ShowDialog() == DialogResult.OK)
            {
                //    ee.ExportBudgetForPrimavera(saveFileDialog1.FileName, moPCN.ID);
                PDFEx.Export(rprt.Document, sv1.FileName);
            }
        }
Exemple #10
0
        private void LoadReportsForPDF(string pdfLoc)
        {
            string proj;
            int    prntCnt;
            int    indx = 0;
            int    copy = 1;
            object o;

            this.Cursor = Cursors.WaitCursor;

            GrapeCity.ActiveReports.SectionReport rprtMain = new GrapeCity.ActiveReports.SectionReport();
            GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport pdfOut;

            prntCnt = clstProjects.CheckedItems.Count;

            lblStatus.Visible = true;
            //    lblStatus.Text = "Printing";
            lblStatus.Text = "Saving"; //*******************Edited 12/10

            copy = Convert.ToInt32(numPrint.Value);

            Application.DoEvents();

            GrapeCity.ActiveReports.Document.Section.PagesCollection pagesForecast;

            for (int j = clstProjects.CheckedItems.Count; j > 0; j--)
            {
                o    = clstProjects.CheckedItems[j - 1];
                proj = o.ToString();
                indx++;
                // lblStatus.Text = "Printing - " + proj;
                lblStatus.Text = "Saving - " + proj; //*******************Edited 12/10
                Application.DoEvents();

                pagesForecast = CreatePagesForecast(proj, FCRMain.GetRprtCase(proj));

                for (int k = 0; k < pagesForecast.Count; k++)
                {
                    rprtMain.Document.Pages.Add(pagesForecast[k]);
                }
            }

            for (int j = chkRollups.CheckedItems.Count; j > 0; j--)
            {
                o    = chkRollups.CheckedItems[j - 1];
                proj = o.ToString();
                indx++;
                //  lblStatus.Text = "Printing - " + proj;
                lblStatus.Text = "Saving - " + proj; //*******************Edited 12/10
                Application.DoEvents();

                pagesForecast = CreatePagesForecastForRollup(proj);

                for (int k = 0; k < pagesForecast.Count; k++)
                {
                    rprtMain.Document.Pages.Add(pagesForecast[k]);
                }
            }

            pdfOut = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();

            pdfOut.Export(rprtMain.Document, pdfLoc);

            this.Cursor = Cursors.Default;

            MessageBox.Show("Reports created");
        }