Beispiel #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);
        }
Beispiel #2
0
            private void SetUpColumnsGroupings()
            {
                this.ColumnGroupings.Clear();


                RColumnGrouping columnGrouping0 = new RColumnGrouping();

                {
                    columnGrouping0.Height = new Unit(0.3, UnitType.Inch);

                    RDynamicColumns dynamicColumns = new RDynamicColumns();
                    {
                        dynamicColumns.Grouping = new RGrouping(this, this.ColumnGroupings);
                        dynamicColumns.Grouping.GroupExpressions.Add(
                            new RExpression(
                                GetReportColumnValue(ReportDataColumns[2])
                                ));

                        dynamicColumns.ReportItem = GetReportCellControlItem(ReportDataColumns[2] as ReportDataColumn);
                    }
                    columnGrouping0.DynamicColumns = dynamicColumns;
                }
                this.ColumnGroupings.Add(columnGrouping0);

                //Static headers
                RColumnGrouping columnGrouping1 = new RColumnGrouping();

                {
                    columnGrouping1.Height = new Unit(0.3, UnitType.Inch);

                    RStaticColumns staticColumns = new RStaticColumns();
                    {
                        foreach (ReportColumn reportColumn in ReportDataColumns)
                        {
                            RStaticColumn staticColumn = new RStaticColumn();
                            if (reportColumn is ReportDataColumn)
                            {
                                ReportDataColumn reportDataColumn = reportColumn as ReportDataColumn;
                                staticColumn.ReportItem = GetReportHeaderControlItem(reportDataColumn);
                                staticColumns.Add(staticColumn);
                            }
                            else if (reportColumn is ReportHyperlinkColumn)
                            {
                            }
                        }
                    }

                    columnGrouping1.StaticColumns = staticColumns;
                }
                this.ColumnGroupings.Add(columnGrouping1);
            }
Beispiel #3
0
        /// <summary>
        /// Create DataTable for visible columns of DataGridView
        /// </summary>
        /// <param name="dgv"></param>
        private void CreateHeaders()
        {
            //add columns to table
            for (int colIndex = 0; colIndex < Columns.Count; colIndex++)
            {
                ReportColumn rColumn    = Columns[colIndex];
                Type         columnType = rColumn.ValueType;

                if (rColumn is ReportDataColumn)
                {
                    ReportDataColumn rdColumn = rColumn as ReportDataColumn;

                    //Replace True/False to "+/-"
                    if (rdColumn.ValueType == typeof(bool) || rdColumn.ValueType == null)
                    {
                        columnType = typeof(string);
                    }
                    else if (rdColumn.ValueType == typeof(System.Drawing.Image) || rdColumn.ValueType == typeof(System.Drawing.Bitmap))
                    {
                        columnType = typeof(byte[]);
                    }

                    else if (!String.IsNullOrEmpty(rdColumn.DefaultCellStyle.Format))
                    {
                        columnType = typeof(string);
                    }
                }
                else if (rColumn is ReportHyperlinkColumn)
                {
                    if (rColumn.ValueType == typeof(Uri))
                    {
                        columnType = typeof(string);
                    }
                    else if (rColumn.ValueType != typeof(string))
                    {
                        throw new ApplicationException("HyperLinkColumn should have content type System.String or System.Uri.");
                    }
                }
                else
                {
                    throw new ApplicationException("Unknown ReportColumn type.");
                }

                _report.ExportedTable.Columns.Add(rColumn.Name, columnType);
            }
        }
Beispiel #4
0
            private void SetUpColumnsHeaders()
            {
                Header.TableRows.Clear();
                RTableCell tCell;
                RTableRow  headerRow = new RTableRow();

                double sumColWidthInMillimeters = 0;

                foreach (ReportColumn reportColumn in ReportDataColumns)
                {
                    if (reportColumn is ReportDataColumn)
                    {
                        ReportDataColumn reportDataColumn = reportColumn as ReportDataColumn;

                        Unit _widthOfColumn = reportDataColumn.HeaderStyle.Width;
                        if (_widthOfColumn.Value == 0)
                        {
                            _widthOfColumn = reportDataColumn.DefaultCellStyle.Width;
                        }

                        RTableColumn newColumn = new RTableColumn();
                        newColumn.Width = _widthOfColumn;
                        this.TableColumns.Add(newColumn);
                        sumColWidthInMillimeters += MeasureTools.UnitToMillimeters(_widthOfColumn);

                        tCell = new RTableCell();

                        ReportControlItem rHeaderItem;
                        int columnIndex      = ReportDataColumns.IndexOf(reportDataColumn);
                        int reportItemZIndex = columnIndex + 1;

                        rHeaderItem = GetReportHeaderControlItem(reportDataColumn);

                        //////////////////////
                        tCell.ReportItems.Add(rHeaderItem);
                        headerRow.TableCells.Add(tCell);
                    }
                    else if (reportColumn is ReportHyperlinkColumn)
                    {
                    }
                }

                Item.Width = new Unit(sumColWidthInMillimeters, UnitType.Mm);
                Header.TableRows.Add(headerRow);
            }
Beispiel #5
0
        public ReportData GetWeightTicketsReport(WeightTicketReportFilterModel filters)
        {
            ReportData reportData = new ReportData();
            DataTable  data       = weightTicketsDL.GetWeightTicketsReport(filters);

            foreach (DataColumn column in data.Columns)
            {
                ReportDataColumn reportColumn = new ReportDataColumn();
                reportColumn.Type = column.DataType;
                reportColumn.Name = column.ColumnName;
                reportData.Columns.Add(reportColumn);
            }
            foreach (DataRow row in data.Rows)
            {
                ReportDataRow reportRow = new ReportDataRow();
                reportRow.Items = new List <object>(row.ItemArray);
                reportData.Rows.Add(reportRow);
            }
            return(reportData);
        }
Beispiel #6
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);
        }
Beispiel #7
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);
        }
Beispiel #8
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);
        }
Beispiel #9
0
            private void SetUpCells()
            {
                Details.TableRows.Clear();

                if ((reportTableGroups != null) && (reportTableGroups.Count > 0))
                {
                    #region apply grouping

                    TableGroups = new RTableGroups();
                    for (int rtgIndex = 0; rtgIndex < reportTableGroups.Count; rtgIndex++)
                    {
                        ReportTableGroup reportTableGroup = reportTableGroups[rtgIndex];
                        //ReportColumn firstColumn = reportTableGroup.ColumnGrouping[0];

                        RTableGroup newGroup = new RTableGroup();
                        newGroup.Grouping.Name = string.Format("{0}_Group{1}", Name, rtgIndex + 1);

                        //Grouping
                        foreach (ReportColumn groupingColumn in reportTableGroup.ColumnGrouping)
                        {
                            RExpression groupingExpression = new RExpression(GetReportColumnValue(groupingColumn));
                            newGroup.Grouping.GroupExpressions.Add(groupingExpression);
                        }

                        //Sorting
                        if (reportTableGroup.ColumnSorting.Count > 0)
                        {
                            RSorting groupSorting = new RSorting();
                            foreach (ReportColumn sortingColumn in reportTableGroup.ColumnSorting.Keys)
                            {
                                RSortBy sortByColumn = new RSortBy();
                                sortByColumn.SortExpression = GetReportColumnValue(sortingColumn);
                                sortByColumn.Direction      = reportTableGroup.ColumnSorting[sortingColumn];
                                groupSorting.SortBy.Add(sortByColumn);
                            }
                            newGroup.Sorting = groupSorting;
                        }

                        //Header
                        {
                            RHeader groupHeader = new RHeader();
                            {
                                RTableRow headerRow = new RTableRow();
                                {
                                    BaseStyle hightlightStyleForRow = null;

                                    foreach (ReportColumn reportColumn in ReportDataColumns)
                                    {
                                        if (reportColumn is ReportDataColumn)
                                        {
                                            ReportControlItem tbxHeader;

                                            if (reportTableGroup.ColumnGrouping.Contains(reportColumn))
                                            {
                                                tbxHeader = GetReportCellControlItem(reportColumn as ReportDataColumn);
                                                if (hightlightStyleForRow == null)
                                                {
                                                    hightlightStyleForRow = tbxHeader.Item.Style;
                                                }
                                            }
                                            else
                                            {
                                                tbxHeader = new RTextBox(String.Empty);
                                            }

                                            RTableCell rTableCell = new RTableCell();
                                            rTableCell.ReportItems.Add(tbxHeader);
                                            headerRow.TableCells.Add(rTableCell);
                                        }
                                    }

                                    if (hightlightStyleForRow != null)
                                    {
                                        hightlightStyleForRow.Border.Style = BorderStyle.None;
                                        headerRow.Style = hightlightStyleForRow;
                                    }
                                }

                                groupHeader.TableRows.Add(headerRow);
                            }
                            newGroup.Header = groupHeader;
                        }

                        //Footer
                        {
                            //RFooter groupFooter = new RFooter();
                            //newGroup.Footer = groupFooter;
                        }

                        TableGroups.Add(newGroup);
                    }

                    #endregion
                }

                RTableCell tCell;
                RTableRow  tRow = new RTableRow();
                tRow.Height = this.rowHeight;

                foreach (DataColumn dataColumn in SourceDataTable.Columns)
                {
                    tCell = new RTableCell();

                    ReportControlItem rDataTableItem;
                    int columnIndex      = SourceDataTable.Columns.IndexOf(dataColumn);
                    int reportItemZIndex = columnIndex + 1;

                    ReportColumn reportColumn = reportDataColumns[columnIndex];

                    if (reportColumn is ReportDataColumn)
                    {
                        ReportDataColumn reportDataColumn = reportColumn as ReportDataColumn;

                        if ((this.reportTableGroups != null) && (this.reportTableGroups.ContainsColumn(reportColumn)))
                        {
                            rDataTableItem = new RTextBox(string.Empty);
                        }
                        else
                        {
                            rDataTableItem = GetReportCellControlItem(reportDataColumn);
                        }

                        tCell.ReportItems.Add(rDataTableItem);
                        tRow.TableCells.Add(tCell);
                    }
                    else if (reportColumn is ReportHyperlinkColumn)
                    {
                    }
                }

                Details.TableRows.Add(tRow);
            }
Beispiel #10
0
 public void MakeDocument(ReportDocument reportDocument)
 {
     if (this.mObj != null)
     {
         TextStyle.ResetStyles();
         DateTime serverDtm = GlobalWebServiceDAL.GetServerDtm();
         float    num       = 1f;
         float    num2      = 10f;
         float    num3      = 10f;
         float    num4      = 420f;
         float    num5      = 480f;
         float    num6      = 150f;
         float    num7      = 100f;
         try
         {
             num = Convert.ToSingle(ConfigurationSettings.AppSettings["eiroutprint.pen.width"]);
         }
         catch (Exception)
         {
         }
         try
         {
             num2 = Convert.ToSingle(ConfigurationSettings.AppSettings["eiroutprint.box.margin"]);
         }
         catch (Exception)
         {
         }
         try
         {
             num3 = Convert.ToSingle(ConfigurationSettings.AppSettings["eiroutprint.box.padding"]);
         }
         catch (Exception)
         {
         }
         try
         {
             num4 = Convert.ToSingle(ConfigurationSettings.AppSettings["eiroutprint.box.width"]);
         }
         catch (Exception)
         {
         }
         try
         {
             num5 = Convert.ToSingle(ConfigurationSettings.AppSettings["eiroutprint.box.height"]);
         }
         catch (Exception)
         {
         }
         try
         {
             num6 = Convert.ToSingle(ConfigurationSettings.AppSettings["eiroutprint.col1.width"]);
         }
         catch (Exception)
         {
         }
         try
         {
             num7 = Convert.ToSingle(ConfigurationSettings.AppSettings["eiroutprint.col2.width"]);
         }
         catch (Exception)
         {
         }
         Pen           borders = new Pen(Color.White, num / 100f);
         Pen           pen     = new Pen(Color.Black, num / 100f);
         ReportBuilder builder = new ReportBuilder(reportDocument);
         builder.StartBox(num2 / 100f, borders, num3 / 100f, Brushes.White, num4 / 100f, num5 / 100f);
         builder.StartLinearLayout(Direction.Vertical);
         builder.DefaultTablePen = borders;
         string name       = "Times New Roman";
         int    num8       = 12;
         string text       = "PT. MULTICON INDRAJAYA TERMINAL";
         string str3       = "EQUIPMENT INTERCHANGE RECEIPT (OUT)";
         string str4       = "Lucida Console";
         int    num9       = 10;
         string headerText = "D/O No.";
         string str6       = "Shipper";
         string str7       = "VESSEL/VOY No.";
         string str8       = "Destination";
         string str9       = "Quantity";
         string str10      = "Principal";
         string str11      = "Delivered";
         string str12      = "Vehicle No.";
         string str13      = "Lucida Console";
         int    num10      = 10;
         string str14      = "CONTAINER PREFIX + NUMBER";
         string str15      = "SIZE";
         string str16      = "TYPE";
         string str17      = "CONDITION";
         string str18      = "SEAL NUMBER";
         string format     = "REMARKS : {0} {1} {2}";
         string str20      = "Arial";
         int    num11      = 10;
         string str21      = "Printed and Authorized, {0} {1}";
         string str22      = "PT. MULTICON INDRAJAYA TERMINAL";
         try
         {
             num8 = Convert.ToInt32(ConfigurationSettings.AppSettings["eiroutprint.header.font.size"]);
         }
         catch (Exception)
         {
         }
         try
         {
             num9 = Convert.ToInt32(ConfigurationSettings.AppSettings["eiroutprint.main.font.size"]);
         }
         catch (Exception)
         {
         }
         try
         {
             num10 = Convert.ToInt32(ConfigurationSettings.AppSettings["eiroutprint.line.font.size"]);
         }
         catch (Exception)
         {
         }
         try
         {
             num11 = Convert.ToInt32(ConfigurationSettings.AppSettings["eiroutprint.footer.font.size"]);
         }
         catch (Exception)
         {
         }
         try
         {
             name = ConfigurationSettings.AppSettings["eiroutprint.header.font.name"];
         }
         catch (Exception)
         {
         }
         try
         {
             text = ConfigurationSettings.AppSettings["eiroutprint.header.1"];
         }
         catch (Exception)
         {
         }
         try
         {
             str3 = ConfigurationSettings.AppSettings["eiroutprint.header.2"];
         }
         catch (Exception)
         {
         }
         try
         {
             str4 = ConfigurationSettings.AppSettings["eiroutprint.main.font.name"];
         }
         catch (Exception)
         {
         }
         try
         {
             headerText = ConfigurationSettings.AppSettings["eiroutprint.main.1"];
         }
         catch (Exception)
         {
         }
         try
         {
             str6 = ConfigurationSettings.AppSettings["eiroutprint.main.2"];
         }
         catch (Exception)
         {
         }
         try
         {
             str7 = ConfigurationSettings.AppSettings["eiroutprint.main.3"];
         }
         catch (Exception)
         {
         }
         try
         {
             str8 = ConfigurationSettings.AppSettings["eiroutprint.main.4"];
         }
         catch (Exception)
         {
         }
         try
         {
             str9 = ConfigurationSettings.AppSettings["eiroutprint.main.5"];
         }
         catch (Exception)
         {
         }
         try
         {
             str10 = ConfigurationSettings.AppSettings["eiroutprint.main.6"];
         }
         catch (Exception)
         {
         }
         try
         {
             str11 = ConfigurationSettings.AppSettings["eiroutprint.main.7"];
         }
         catch (Exception)
         {
         }
         try
         {
             str12 = ConfigurationSettings.AppSettings["eiroutprint.main.8"];
         }
         catch (Exception)
         {
         }
         try
         {
             str13 = ConfigurationSettings.AppSettings["eiroutprint.line.font.name"];
         }
         catch (Exception)
         {
         }
         try
         {
             str14 = ConfigurationSettings.AppSettings["eiroutprint.line.1"];
         }
         catch (Exception)
         {
         }
         try
         {
             str15 = ConfigurationSettings.AppSettings["eiroutprint.line.2"];
         }
         catch (Exception)
         {
         }
         try
         {
             str16 = ConfigurationSettings.AppSettings["eiroutprint.line.3"];
         }
         catch (Exception)
         {
         }
         try
         {
             str17 = ConfigurationSettings.AppSettings["eiroutprint.line.4"];
         }
         catch (Exception)
         {
         }
         try
         {
             str18 = ConfigurationSettings.AppSettings["eiroutprint.line.5"];
         }
         catch (Exception)
         {
         }
         try
         {
             format = ConfigurationSettings.AppSettings["eiroutprint.line.6"];
         }
         catch (Exception)
         {
         }
         try
         {
             str20 = ConfigurationSettings.AppSettings["eiroutprint.footer.font.name"];
         }
         catch (Exception)
         {
         }
         try
         {
             str21 = ConfigurationSettings.AppSettings["eiroutprint.footer.1"];
         }
         catch (Exception)
         {
         }
         try
         {
             str22 = ConfigurationSettings.AppSettings["eiroutprint.footer.2"];
         }
         catch (Exception)
         {
         }
         TextStyle textStyle = new TextStyle(TextStyle.BoldStyle);
         textStyle.FontFamily      = new FontFamily(name);
         textStyle.Size            = num8;
         textStyle.StringAlignment = StringAlignment.Center;
         TextStyle style2 = new TextStyle(TextStyle.Normal);
         style2.FontFamily = new FontFamily(str4);
         style2.Size       = num9;
         TextStyle style3 = new TextStyle(TextStyle.Normal);
         style3.FontFamily = new FontFamily(str13);
         style3.Size       = num10;
         TextStyle style4 = new TextStyle(TextStyle.Normal);
         style4.FontFamily = new FontFamily(str20);
         style4.Size       = num11;
         builder.AddText(text, textStyle);
         builder.AddText(str3, textStyle);
         builder.AddHorizontalLine(pen);
         DataTable table = new DataTable("main");
         table.Columns.Add("column1", typeof(string));
         table.Columns.Add("column2", typeof(string));
         table.Rows.Add(new object[] { str6, this.mObj.Shipper });
         table.Rows.Add(new object[] { str7, this.mObj.VesselVoyageName });
         table.Rows.Add(new object[] { str8, this.mObj.DestinationName });
         table.Rows.Add(new object[] { str9, "?" });
         table.Rows.Add(new object[] { str10, this.mCust.Name });
         table.Rows.Add(new object[] { str11, this.mObj.AngkutanOut });
         table.Rows.Add(new object[] { str12, this.mObj.NoMobilOut });
         SectionTable table2 = builder.AddTable(table.DefaultView, true);
         table2.InnerPenHeaderBottom.Color = Color.White;
         table2.InnerPenRow.Color          = Color.White;
         table2.HeaderTextStyle.SetFromFont(style2.GetFont());
         table2.HorizontalAlignment = HorizontalAlignment.Center;
         ReportDataColumn column = builder.AddColumn("column1", headerText, num6 / 100f, false, false);
         column.HeaderTextStyle         = style2;
         column.DetailRowTextStyle      = style2;
         column.AlternatingRowTextStyle = style2;
         ReportDataColumn column2 = builder.AddColumn("column2", this.mObj.DoNumber, num7 / 100f, false, false);
         column2.HeaderTextStyle         = style2;
         column2.DetailRowTextStyle      = style2;
         column2.AlternatingRowTextStyle = style2;
         builder.AddHorizontalLine(pen);
         DataTable table3 = new DataTable("line");
         table3.Columns.Add("column1", typeof(string));
         table3.Columns.Add("column2", typeof(string));
         table3.Rows.Add(new object[] { str15, this.mObj.Size });
         table3.Rows.Add(new object[] { str16, this.mObj.Type });
         table3.Rows.Add(new object[] { str17, this.mObj.Condition });
         table3.Rows.Add(new object[] { str18, this.mObj.Seal });
         SectionTable table4 = builder.AddTable(table3.DefaultView, true);
         table4.InnerPenHeaderBottom = borders;
         table4.InnerPenRow          = borders;
         table4.OuterPens            = borders;
         table4.HeaderTextStyle.SetFromFont(style3.GetFont());
         table4.HorizontalAlignment = HorizontalAlignment.Center;
         ReportDataColumn column3 = builder.AddColumn("column1", str14.Replace('+', '&'), num6 / 100f, false, false);
         column3.HeaderTextStyle         = style3;
         column3.DetailRowTextStyle      = style3;
         column3.AlternatingRowTextStyle = style3;
         ReportDataColumn column4 = builder.AddColumn("column2", this.mObj.Cont, num7 / 100f, false, false);
         column4.HeaderTextStyle         = style3;
         column4.DetailRowTextStyle      = style3;
         column4.AlternatingRowTextStyle = style3;
         builder.AddText(" ", style3);
         builder.AddText(string.Format(format, this.mObj.Remarks), style3);
         builder.AddHorizontalLine(pen);
         builder.AddText(" ", style4);
         string introduced93 = serverDtm.ToLongDateString();
         builder.AddText(string.Format(str21, introduced93, serverDtm.ToLongTimeString()), style4);
         builder.AddText(str22, style4);
         builder.AddText(" \r\n ", style4);
         builder.FinishLinearLayout();
         builder.FinishBox();
     }
 }
Beispiel #11
0
        /// <summary>
        /// Copy cell items from visible columns retrived by IReportDataAdapter
        /// </summary>
        /// <param name="dgv"></param>
        private void CopyRowData()
        {
            DataRow dtRow;

            _report.ExportedTable.Rows.Clear();

            int RowCount = reportDataAdapter.GetRowCount();

            //create rows
            for (int rowIndex = 0; rowIndex < RowCount; rowIndex++)
            {
                dtRow = _report.ExportedTable.NewRow();
                _report.ExportedTable.Rows.Add(dtRow);
            }

            //add columns to table
            for (int colIndex = 0; colIndex < Columns.Count; colIndex++)
            {
                ReportColumn rColumn = Columns[colIndex];

                //proccess rows
                for (int rowIndex = 0; rowIndex < RowCount; rowIndex++)
                {
                    object cellValue = reportDataAdapter.GetCellItemValue(rColumn, rowIndex);
                    //Exported value
                    object expValue = null;

                    if (cellValue != null)
                    {
                        if (rColumn is ReportDataColumn)
                        {
                            ReportDataColumn rdColumn    = rColumn as ReportDataColumn;
                            string           valueFormat = rdColumn.DefaultCellStyle.Format;
                            if (!String.IsNullOrEmpty(valueFormat) || !String.IsNullOrEmpty(rdColumn.TemplateFormat))
                            {
                                //like {0:[valueFormat]} or {0}
                                string fullValueFormat =
                                    "{0" + (String.IsNullOrEmpty(valueFormat) ? "" : ":" + valueFormat)
                                    + "}";

                                //like  "Name is {0:[valueFormat]}."
                                string fullTemplateFormat = String.IsNullOrEmpty(rdColumn.TemplateFormat)
                                                                                 ? fullValueFormat
                                                                                 : string.Format(rdColumn.TemplateFormat, fullValueFormat);
                                expValue = string.Format(fullTemplateFormat, cellValue);
                            }
                            else if (rdColumn.ValueConverter != null)
                            {
                                expValue = rdColumn.ValueConverter.ConvertToString(cellValue);
                            }
                            else if (rdColumn.ValueType == typeof(System.Drawing.Image) ||
                                     rdColumn.ValueType == typeof(System.Drawing.Bitmap))
                            {
                                System.Drawing.Image imgValue  = cellValue as System.Drawing.Image;
                                MemoryStream         memStream = new MemoryStream();
                                imgValue.Save(memStream, imgValue.RawFormat);
                                expValue = memStream.ToArray();
                            }
                            else
                            {
                                expValue = cellValue;
                            }

                            ProccessStyle(rdColumn.DefaultCellStyle);
                            ProccessStyle(rdColumn.HeaderStyle);
                        }
                        else if (rColumn is ReportHyperlinkColumn)
                        {
                            expValue = cellValue.ToString();
                        }
                    }
                    else
                    {
                        // No value available
                    }

                    if ((expValue != null) && (expValue.GetType() != typeof(System.Object)))
                    {
                        _report.ExportedTable.Rows[rowIndex][rColumn.Name] = expValue;
                    }
                }
            }
        }
Beispiel #12
0
            private void SetUpCells()
            {
                #region MatrixColumns
                {
                    MatrixColumns.Clear();
                    double sumColWidthInMillimeters = 0;

                    foreach (ReportColumn reportColumn in ReportDataColumns)
                    {
                        if (reportColumn is ReportDataColumn)
                        {
                            ReportDataColumn reportDataColumn = reportColumn as ReportDataColumn;
                            Unit             _widthOfColumn   = reportDataColumn.HeaderStyle.Width;
                            RMatrixColumn    matrixColumn     = new RMatrixColumn();
                            matrixColumn.Width = _widthOfColumn;
                            MatrixColumns.Add(matrixColumn);
                            sumColWidthInMillimeters += MeasureTools.UnitToMillimeters(_widthOfColumn);
                        }
                        else if (reportColumn is ReportHyperlinkColumn)
                        {
                        }
                    }

                    Item.Width = new Unit(sumColWidthInMillimeters, UnitType.Mm);
                }

                #endregion

                #region MatrixRows

                this.MatrixRows.Clear();

                RMatrixRow matrixRow1 = new RMatrixRow();
                {
                    matrixRow1.Height = new Unit(0.25, UnitType.Inch);

                    RMatrixCell mCell;
                    foreach (DataColumn dataColumn in SourceDataTable.Columns)
                    {
                        mCell = new RMatrixCell();

                        ReportControlItem rDataTableItem;
                        int columnIndex      = SourceDataTable.Columns.IndexOf(dataColumn);
                        int reportItemZIndex = columnIndex + 1;

                        ReportColumn reportColumn = reportDataColumns[columnIndex];

                        if (reportColumn is ReportDataColumn)
                        {
                            ReportDataColumn reportDataColumn = reportColumn as ReportDataColumn;

                            if (this.reportTableGroups.ContainsColumn(reportColumn))
                            {
                                rDataTableItem = new RTextBox(string.Empty);
                            }
                            else
                            {
                                rDataTableItem = GetReportCellControlItem(reportDataColumn);

                                //if (rDataTableItem is RTextBox)
                                //{
                                //  (rDataTableItem as RTextBox).Value =
                                //    string.Format("=CDbl(Fields!{0}.Value)", reportDataColumn.Name);
                                //}

                                //=Sum(CDbl(Fields!Sales.Value))
                            }

                            mCell.ReportItem = rDataTableItem;
                            matrixRow1.MatrixCells.Add(mCell);
                        }
                        else if (reportColumn is ReportHyperlinkColumn)
                        {
                        }
                    }
                }
                this.MatrixRows.Add(matrixRow1);

                #endregion
            }