예제 #1
0
파일: Report.cs 프로젝트: Argalep/ServUO
 public Report(string name, string width)
 {
     m_Name    = name;
     m_Width   = width;
     m_Columns = new ReportColumnCollection();
     m_Items   = new ReportItemCollection();
 }
예제 #2
0
		public Report( string name, string width )
		{
			m_Name = name;
			m_Width = width;
			m_Columns = new ReportColumnCollection();
			m_Items = new ReportItemCollection();
		}
예제 #3
0
        /// <summary>
        /// Build report for DataGridView content.
        /// Call this method if you have already set all required parameters.
        /// </summary>
        /// <returns>Report</returns>
        public ReportBase GenerateReport()
        {
            _report = new ReportBase();

            Columns     = reportDataAdapter.GetColumns();
            TableGroups = reportDataAdapter.GetTableGroups(Columns);

            CreateHeaders();
            CopyRowData();

            reportBuilder.AddDataSource(_report.ExportedTable);
            reportBuilder.AddReportTable(_report.ExportedTable, Columns, TableGroups, reportDataAdapter.GetRowHeight());
            reportBuilder.AddEmbeddedImages(_report.GlobalEmbeddedImages);

            string GeneratedRDLC = reportBuilder.BuildRDLC();

            _report.Rdlc = GeneratedRDLC;

#if DEBUG
            DateTime currentTime  = DateTime.Now;
            string   strTime      = string.Format("{0}-{1}_{2}-{3}-{4}", currentTime.Day, currentTime.Month, currentTime.Hour, currentTime.Minute, currentTime.Second);
            string   tempFileName = Path.Combine(
                Path.GetTempPath(),
                string.Format("testReportExport{0}.rdlc", strTime));
            File.WriteAllText(tempFileName, GeneratedRDLC, Encoding.Unicode);
#endif

            return(_report);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
0
 public virtual ReportTableGroupList GetTableGroups(ReportColumnCollection columns)
 {
     // No grouping by default
     return(null);
 }