Esempio n. 1
0
        private static void AddTableHeader(Modeling.Report repdef, Table table, IList<ColumnDef> coldefs)
        {
            var tablerow = new TableRow();
            for (int colindex = 0; colindex < repdef.DataTable.Columns.Count; colindex++)
            {
                var coldef = coldefs[colindex];
                var dt_col = repdef.DataTable.Columns[colindex];
                var tablecell = new TableCell();
                var celltb = new TextBox("HEADER_COL_" + colindex.ToString() + "_TEXTBOX", dt_col.Caption);
                celltb.CanGrow = true;
                celltb.Height = repdef.HeaderHeight;
                celltb.Width = coldef.Width;

                celltb.Style.FontFamily = repdef.DefaultFontFamily;
                celltb.Style.FontSize = repdef.DefaultHeaderRowFontSize;
                celltb.Style.FontWeight = repdef.DefaultHeaderRowFontWeight;


                tablecell.ReportItems.Add(celltb);
                tablerow.TableCells.Add(tablecell);
            }

            tablerow.Height = repdef.HeaderHeight;
            table.Header.TableRows.Add(tablerow);
        }
Esempio n. 2
0
        private static void AddTitle(Modeling.Report repdef, Body body)
        {
            var tbtitle = new TextBox("REPORT_TITLE", repdef.ReportTitle);
            tbtitle.CanGrow = true;
            tbtitle.Height = repdef.TitleHeight;
            tbtitle.Style.FontFamily = repdef.DefaultFontFamily;
            tbtitle.Style.FontSize = repdef.DefautlReportTitleFontSize;

            body.ReportItems.Add(tbtitle);
        }
Esempio n. 3
0
        private static void AddTableGrouping(Modeling.Report repdef, Table table)
        {
            for (int grouping_col_index = 0; grouping_col_index < repdef.GroupOnColumns.Count; grouping_col_index++)
            {
                var grouping_col = repdef.GroupOnColumns[grouping_col_index];
                var tablegroup = new TableGroup();

                tablegroup.Name = string.Format("TABLE_GROUP_ON_COL_{0}_{1}", grouping_col, grouping_col_index);

                var col = repdef.DataTable.Columns[grouping_col];
                tablegroup.GroupingExpressions.Add(Util.GetExprFieldValue(col.ColumnName));

                table.TableGroups.Add(tablegroup);

                var tableheight = new TableRow();
                tableheight.Height = repdef.DetailRowHeight;
                tablegroup.Header.TableRows.Add(tableheight);
                for (int colindex = 0; colindex < repdef.DataTable.Columns.Count; colindex++)
                {
                    var tablecell = new TableCell();
                    tableheight.TableCells.Add(tablecell);
                    var textbox = new TextBox(tablegroup.Name + "_" + colindex.ToString(), null);
                    tablecell.ReportItems.Add(textbox);

                    if (colindex == grouping_col_index)
                    {
                        textbox.Value = Util.GetExprFieldValue(col.ColumnName);
                    }
                    else
                    {
                        textbox.Value = "";
                    }
                    textbox.Height = repdef.DetailRowHeight;
                }

                // TODO hide the column that was grouped!
            }
        }
Esempio n. 4
0
        private static void AddTableDetailCells(List<ColumnDef> coldefs, Modeling.Report repdef, Table table)
        {
            var tablerow = new TableRow();

            for (int colindex = 0; colindex < repdef.DataTable.Columns.Count; colindex++)
            {
                var coldef = coldefs[colindex];
                var datatable_col = repdef.DataTable.Columns[colindex];

                var tablecell = new TableCell();
                tablerow.TableCells.Add(tablecell);


                var tbval = Util.GetExprFieldValue(datatable_col.ColumnName);
                var tbname = "DETAIL_COL_" + colindex.ToString() + "_TEXTBOX";
                var textbox = new TextBox(tbname, tbval);
                tablecell.ReportItems.Add(textbox);

                textbox.CanGrow = true;
                textbox.Height = repdef.HeaderHeight;
                textbox.Width = coldef.Width;

                textbox.Style.FontFamily = repdef.DefaultFontFamily;
                textbox.Style.FontSize = repdef.DefaultDetailRowFontSize;

                textbox.Style.BorderStyle.Default = repdef.TableCellBorderStyle;
                textbox.Style.BorderColor.Default.ColorName = repdef.TableCellBorderColor;
                textbox.Style.BorderWidth.Default = repdef.TableCellBorderWidth;

                if (repdef.DefaultDetailRowBackgroundColor != null)
                {
                    if (repdef.DefaultDetailRowBackgroundColorAlternate == null)
                    {
                        textbox.Style.BackgroundColor.ColorName = repdef.DefaultDetailRowBackgroundColor;
                    }
                    else
                    {
                        textbox.Style.BackgroundColor.Expression =
                            string.Format("=IIF(RowNumber(Nothing) Mod 2 = 0,\"{0}\",\"{1}\")",
                                          repdef.DefaultDetailRowBackgroundColor,
                                          repdef.DefaultDetailRowBackgroundColorAlternate);
                    }
                }
            }

            tablerow.Height = repdef.DetailRowHeight;
            table.Details.TableRows.Add(tablerow);
        }