Example #1
0
        private void rdlViewer1_Hyperlink(object source, fyiReporting.RdlViewer.HyperlinkEventArgs e)
        {
            // report LastName field as HyperLink action
            var url = new Uri(e.Hyperlink);
            if (url.Scheme == "lastname" )
            {
                e.Cancel = true;
                MessageBox.Show(url.ToString());
            }

        }
Example #2
0
        public ZoomTo(fyiReporting.RdlViewer.RdlViewer viewer)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            _Viewer = viewer;
            // set the intial value for magnification
            if (_Viewer.ZoomMode == ZoomEnum.FitPage)
                cbMagnify.Text = "Do tamanho da página";
            else if (_Viewer.ZoomMode == ZoomEnum.FitWidth)
                cbMagnify.Text = "Pela largura";
            else if (_Viewer.Zoom == 1)
                cbMagnify.Text = "Tamanho atual";
            else
            {
                string formatted = string.Format("{0:#0.##}", _Viewer.Zoom * 100);
                if (formatted[formatted.Length - 1] == '.')
                    formatted = formatted.Substring(0, formatted.Length - 2);
                formatted = formatted + "%";
                cbMagnify.Text = formatted;
            }
        }
Example #3
0
 public void Image(fyiReporting.RDL.Image i, Row r, string mimeType, Stream ior)
 {
 }
Example #4
0
 public void RectangleEnd(fyiReporting.RDL.Rectangle rect, Row r)
 {
 }
Example #5
0
 public bool RectangleStart(fyiReporting.RDL.Rectangle rect, Row r)
 {
     return true;
 }
        public bool Export(fyiReporting.RDL.OutputPresentationType type)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Title = "Export to " + type.ToString().ToUpper();
            switch (type)
            {
                case OutputPresentationType.CSV:
                    sfd.Filter = "CSV file (*.csv)|*.csv|All files (*.*)|*.*";
                    break;
                case OutputPresentationType.XML:
                    sfd.Filter = "XML file (*.xml)|*.xml|All files (*.*)|*.*";
                    break;
                case OutputPresentationType.PDF:
                case OutputPresentationType.PDFOldStyle:
                    sfd.Filter = "PDF file (*.pdf)|*.pdf|All files (*.*)|*.*";
                    break;
                case OutputPresentationType.TIF:
                    sfd.Filter = "TIF file (*.tif, *.tiff)|*.tiff;*.tif|All files (*.*)|*.*";
                    break;
                case OutputPresentationType.RTF:
                    sfd.Filter = "RTF file (*.rtf)|*.rtf|All files (*.*)|*.*";
                    break;
                case OutputPresentationType.Word:
                    sfd.Filter = "DOC file (*.doc)|*.doc|All files (*.*)|*.*";
                    break;
                case OutputPresentationType.Excel:
                    sfd.Filter = "Excel file (*.xlsx)|*.xlsx|All files (*.*)|*.*";
                    break;
                case OutputPresentationType.HTML:
                    sfd.Filter = "Web Page (*.html, *.htm)|*.html;*.htm|All files (*.*)|*.*";
                    break;
                case OutputPresentationType.MHTML:
                    sfd.Filter = "MHT (*.mht)|*.mhtml;*.mht|All files (*.*)|*.*";
                    break;
                default:
                    throw new Exception("Only HTML, MHT, XML, CSV, RTF, DOC, Excel, TIF and PDF are allowed as Export types.");
            }
            sfd.FilterIndex = 1;

            if (SourceFile != null)
            {
                sfd.FileName = Path.GetFileNameWithoutExtension(SourceFile.LocalPath) + "." + type;
            }
            else
            {
                sfd.FileName = "*." + type;
            }

            try
            {
                if (sfd.ShowDialog(this) != DialogResult.OK)
                    return false;

                // save the report in the requested rendered format
                bool rc = true;
                // tif can be either in color or black and white; ask user what they want
                if (type == OutputPresentationType.TIF)
                {
                    DialogResult dr = MessageBox.Show(this, "Do you want to display colors in TIF?", "Export", MessageBoxButtons.YesNoCancel);
                    if (dr == DialogResult.No)
                        type = OutputPresentationType.TIFBW;
                    else if (dr == DialogResult.Cancel)
                        return false;
                }
                try { SaveAs(sfd.FileName, type); }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                        ex.Message, "Export Error",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    rc = false;
                }
                return rc;
            }
            finally
            {
                sfd.Dispose();
            }
        }
        private string GenerateXaml(fyiReporting.RDL.Page page)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<Canvas xmlns=\"http://schemas.microsoft.com/client/2007\">");
            ProcessPage(sb, page, new Rectangle(0, 0, PixelsX(_Pages.PageWidth), PixelsY(_Pages.PageHeight)));
            sb.Append("</Canvas>");
            return sb.ToString() ;
        }
Example #8
0
        /// <summary>
        /// Save the file.  The extension determines the type of file to save.
        /// </summary>
        /// <param name="FileName">Name of the file to be saved to.</param>
        /// <param name="type">Type of file to save.  Should be "pdf", "xml", "html", "mhtml", "csv", "rtf", "excel", "tif".</param>
        public void SaveAs(string FileName, fyiReporting.RDL.OutputPresentationType type)
        {
            LoadPageIfNeeded();

            OneFileStreamGen sg = new OneFileStreamGen(FileName, true);	// overwrite with this name
            if (!(type == OutputPresentationType.PDF || type == OutputPresentationType.PDFOldStyle ||
                type == OutputPresentationType.TIF || type  == OutputPresentationType.TIFBW))
            {
                ListDictionary ld = GetParameters();		// split parms into dictionary
                _Report.RunGetData(ld);                     // obtain the data (again)
            }
            try
            {
                switch (type)
                {
                    case  OutputPresentationType.PDF:
                         _Report.ItextPDF = true;
                        _Report.RunRenderPdf(sg, _pgs);
                        break;
                    case OutputPresentationType.PDFOldStyle:
                        _Report.ItextPDF = false;
                        _Report.RunRenderPdf(sg, _pgs);
                        break;
                    case  OutputPresentationType.TIF:
                        _Report.RunRenderTif(sg, _pgs, true);
                        break;
                    case  OutputPresentationType.TIFBW:
                        _Report.RunRenderTif(sg, _pgs, false);
                        break;
                    case OutputPresentationType.CSV:
                        _Report.RunRender(sg, OutputPresentationType.CSV);
                        break;
                    case OutputPresentationType.Word:
                    case OutputPresentationType.RTF:
                        _Report.RunRender(sg, OutputPresentationType.RTF);
                        break;
                    case OutputPresentationType.Excel:
                        _Report.RunRender(sg, OutputPresentationType.Excel);
                        break;
                    case OutputPresentationType.XML:
                        _Report.RunRender(sg, OutputPresentationType.XML);
                        break;
                    case OutputPresentationType.HTML:
                        _Report.RunRender(sg, OutputPresentationType.HTML);
                        break;
                    case OutputPresentationType.MHTML:
                        _Report.RunRender(sg, OutputPresentationType.MHTML);
                        break;
                    default:
                        throw new Exception(Strings.RdlViewer_Error_UnsupportedExtension);
                }
            }
            finally
            {
                if (sg != null)
                {
                    sg.CloseMainStream();
                }

            }
            return;
        }
Example #9
0
        public bool Export(fyiReporting.RDL.OutputPresentationType type)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Title = string.Format(Strings.MDIChild_Export_ExportTitleFormat, type.ToString().ToUpper());
            switch (type)
            {
                case  OutputPresentationType.CSV:
                    sfd.Filter = Strings.MDIChild_Export_CSV;
                    break;
                case OutputPresentationType.XML:
                    sfd.Filter = Strings.MDIChild_Export_XML;
                    break;
                case OutputPresentationType.PDF:
                case OutputPresentationType.PDFOldStyle:
                    sfd.Filter = Strings.MDIChild_Export_PDF;
                    break;
                case OutputPresentationType.TIF:
                    sfd.Filter = Strings.MDIChild_Export_TIF;
                    break;
                case OutputPresentationType.RTF:
                    sfd.Filter = Strings.MDIChild_Export_RTF;
                    break;
                case OutputPresentationType.Word:
                    sfd.Filter = Strings.MDIChild_Export_DOC;
                    break;
                case OutputPresentationType.Excel:
                    sfd.Filter = Strings.MDIChild_Export_Excel;
                    break;
                case OutputPresentationType.HTML:
                    sfd.Filter = Strings.MDIChild_Export_Web_Page;
                    break;
                case OutputPresentationType.MHTML:
                    sfd.Filter = Strings.MDIChild_Export_MHT;
                    break;
                default:
                    throw new Exception(Strings.MDIChild_Error_AllowedExportTypes);
            }
            sfd.FilterIndex = 1;

            if (SourceFile != null)
            {
                sfd.FileName = Path.GetFileNameWithoutExtension(SourceFile.LocalPath) + "." + type;
            }
            else
            {
                sfd.FileName = "*." + type;
            }

            try
            {
                if (sfd.ShowDialog(this) != DialogResult.OK)
                    return false;

                // save the report in the requested rendered format
                bool rc = true;
                // tif can be either in color or black and white; ask user what they want
                if (type == OutputPresentationType.TIF)
                {
                    DialogResult dr = MessageBox.Show(this, Strings.MDIChild_ShowF_WantDisplayColorsInTIF, Strings.MDIChild_ShowF_Export, MessageBoxButtons.YesNoCancel);
                    if (dr == DialogResult.No)
                        type = OutputPresentationType.TIFBW;
                    else if (dr == DialogResult.Cancel)
                        return false;
                }
                try { SaveAs(sfd.FileName, type); }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                        ex.Message, Strings.MDIChild_ShowG_ExportError,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    rc = false;
                }
                return rc;
            }
            finally
            {
                sfd.Dispose();
            }
        }
Example #10
0
        public void SaveAs (string FileName, fyiReporting.RDL.OutputPresentationType type)
        {
            fyiReporting.RDL.OneFileStreamGen sg = null;

            try
            {
                // Must use the RunGetData before each export or there is no data.
                _report.RunGetData(this.Parameters);

                sg = new fyiReporting.RDL.OneFileStreamGen(FileName, true);
                _report.RunRender(sg, type);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowError(ex.Message);
            }
            finally
            {
                if (sg != null)
                {
                    sg.CloseMainStream();
                }
            }
            return;
        }
 public void SaveAs(string FileName, fyiReporting.RDL.OutputPresentationType type)
 {
     this.reportViewer.SaveAs(FileName, type);
 }