Ejemplo n.º 1
0
        public virtual ReportColumnCollection GetColumns()
        {
            ReportColumnCollection toRet = new ReportColumnCollection();

            foreach (DataColumn dataColumn in dataView.Table.Columns)
            {
                ReportDataColumn rdColumn = toRet.AddNewReportDataColumn(dataColumn.ColumnName);

                rdColumn.HeaderText = dataColumn.Caption;
                rdColumn.ValueType  = dataColumn.DataType;

                if (rdColumn.ValueType == typeof(System.Drawing.Image))
                {
                    rdColumn.DataCellViewType = CellViewImage.CreateDatabaseImage(ImageMIMEType.Jpeg);
                }
                else if (rdColumn.ValueType == typeof(System.Drawing.Bitmap))
                {
                    rdColumn.DataCellViewType = CellViewImage.CreateDatabaseImage(ImageMIMEType.Bmp);
                }

                rdColumn.HeaderStyle.Border          =
                    rdColumn.DefaultCellStyle.Border = DefaultBorder;

                rdColumn.DefaultCellStyle.Width = new Size(DefaultColumnWidth);
                rdColumn.DefaultCellStyle.Wrap  = true;
            }

            return(toRet);
        }
Ejemplo n.º 2
0
        private static ReportControlItem GetReportCellControlItem(ReportDataColumn reportDataColumn)
        {
            ReportControlItem toRet = null;

            if (reportDataColumn.DataCellViewType is CellViewImage)
            {
                CellViewImage imgCellView = reportDataColumn.DataCellViewType as CellViewImage;

                RImage rImage = new RImage(
                    reportDataColumn.Name,
                    true,
                    GetReportColumnValue(reportDataColumn),
                    imgCellView.Properties
                    );

                if (reportDataColumn.HyperlinkColumn != null)
                {
                    rImage.ImageBox.Action = new ReportExporters.Common.Model.Action(
                        GetReportColumnValue(reportDataColumn.HyperlinkColumn));
                }

                toRet = rImage;
            }
            else
            {
                RTextBox rTextbox = new RTextBox(reportDataColumn.Name, GetReportColumnValue(reportDataColumn));

                if (reportDataColumn.HyperlinkColumn != null)
                {
                    rTextbox.TextBox.Action = new ReportExporters.Common.Model.Action(
                        GetReportColumnValue(reportDataColumn.HyperlinkColumn));
                }

                toRet = rTextbox;
            }

            toRet.Item.Style = reportDataColumn.DefaultCellStyle;

            return(toRet);
        }
Ejemplo n.º 3
0
        private static ReportControlItem GetReportHeaderControlItem(ReportDataColumn reportDataColumn)
        {
            ReportControlItem rHeaderItem = null;

            if (reportDataColumn.HeaderCellViewType is CellViewImage)
            {
                CellViewImage imgCellView = reportDataColumn.HeaderCellViewType as CellViewImage;

                RImage rImage = new RImage(
                    "header" + reportDataColumn.Name,
                    true,
                    reportDataColumn.HeaderText,
                    imgCellView.Properties
                    );

                if ((reportDataColumn.HyperlinkColumn != null) && (reportDataColumn.HeaderCellHyperlink != null))
                {
                    rImage.ImageBox.Action = new ReportExporters.Common.Model.Action(reportDataColumn.HeaderCellHyperlink);
                }

                rHeaderItem = rImage;
            }
            else
            {
                RTextBox rHeaderTextbox = new RTextBox(
                    "header" + reportDataColumn.Name, reportDataColumn.HeaderText);

                if ((reportDataColumn.HyperlinkColumn != null) && (reportDataColumn.HeaderCellHyperlink != null))
                {
                    rHeaderTextbox.TextBox.Action = new ReportExporters.Common.Model.Action(reportDataColumn.HeaderCellHyperlink);
                }

                rHeaderItem = rHeaderTextbox;
            }

            rHeaderItem.Item.Style = reportDataColumn.HeaderStyle;

            return(rHeaderItem);
        }
Ejemplo n.º 4
0
        public virtual ReportColumnCollection GetColumns()
        {
            ReportColumnCollection toRet = new ReportColumnCollection();

            foreach (DataGridViewColumn dgvColumn in dataGridView.Columns)
            {
                ReportDataColumn rdColumn = toRet.AddNewReportDataColumn(dgvColumn.Name);

                rdColumn.HeaderText = dgvColumn.HeaderText;
                rdColumn.ValueType  = dgvColumn.ValueType;

                if (dgvColumn is DataGridViewImageColumn)
                {
                    CellViewImage databaseCellViewImage = CellViewImage.CreateDatabaseImage(ImageMIMEType.Jpeg);
                    //databaseCellViewImage.Sizing = ImageSizing.FitProportional;
                    rdColumn.DataCellViewType = databaseCellViewImage;
                }

                {                 //initialize style for column header cell
                    InitReportStyleFrom(
                        rdColumn.HeaderStyle,
                        dgvColumn.HeaderCell.HasStyle ? dgvColumn.HeaderCell.Style : dgvColumn.HeaderCell.InheritedStyle);
                }

                {                 //initialize style for column content cell
                    InitReportStyleFrom(rdColumn.DefaultCellStyle,
                                        dgvColumn.HasDefaultCellStyle ? dgvColumn.DefaultCellStyle : dgvColumn.InheritedStyle);
                }

                //set column width
                rdColumn.HeaderStyle.Width          =
                    rdColumn.DefaultCellStyle.Width =
                        new System.Web.UI.WebControls.Unit(dgvColumn.Width, System.Web.UI.WebControls.UnitType.Pixel);
            }

            return(toRet);
        }