private static TableRow CreateTableHeaderRow(ReportWizardState state) { List <FieldMetaData> columns = new List <FieldMetaData>(); columns.AddRange(state.GroupingFields); columns.AddRange(state.DisplayFields); TableRow tableHeader = new TableRow(); foreach (FieldMetaData field in columns) { TableCell tableHeaderCell = new TableCell(); TextBox tableHeaderTextBox = CreateTextBox(); tableHeaderTextBox.Name = GetNameForComponent(ComponentNames.TextBox); tableHeaderTextBox.Value = field.Title; //set table header values according to grouping expressions if (state.GroupingFields.Contains(field)) { if (field.IsNumeric) { tableHeaderTextBox.Style.TextAlign = NumericTextAlignment; } else { tableHeaderTextBox.Style.TextAlign = DefaultTextAlignment; tableHeaderTextBox.Style.PaddingLeft = DefaultPaddingLeft; } } tableHeaderCell.ReportItems.Add(tableHeaderTextBox); tableHeader.TableCells.Add(tableHeaderCell); } return(tableHeader); }
/// <summary> ///creates new TextBox with the default style /// </summary> /// <returns></returns> private static TextBox CreateTextBox() { TextBox textBox = new TextBox(); textBox.CanGrow = true; textBox.Style.FontSize = "8pt"; return(textBox); }
/// <summary> ///creates new TextBox with the default style /// </summary> /// <returns></returns> private static TextBox CreateTextBox() { TextBox textBox = new TextBox(); textBox.CanGrow = true; textBox.Style.PaddingBottom = textBox.Style.PaddingLeft = textBox.Style.PaddingRight = textBox.Style.PaddingTop = "2pt"; return(textBox); }
private static TableRow CreateTableDetails(ReportWizardState state) { List <FieldMetaData> columns = new List <FieldMetaData>(); columns.AddRange(state.GroupingFields); columns.AddRange(state.DisplayFields); TableRow tableDetails = new TableRow(); foreach (FieldMetaData field in columns) { TableCell tableDetailsCell = new TableCell(); TextBox tableDetailsTextBox = CreateTextBox(); tableDetailsTextBox.Name = GetNameForComponent(ComponentNames.TextBox); if (state.DisplayFields.Contains(field)) { //if detail grouping set, summarize summarizeable if ((state.DetailGroupingField != null) && (field.AllowTotaling) && (field != state.DetailGroupingField)) { tableDetailsTextBox.Value = GetFieldSummaryExpression(field); } else { tableDetailsTextBox.Value = GetFieldValueExpression(field); } if (field.IsNumeric) { tableDetailsTextBox.Style.TextAlign = NumericTextAlignment; } else { tableDetailsTextBox.Style.TextAlign = DefaultTextAlignment; tableDetailsTextBox.Style.PaddingLeft = DefaultPaddingLeft; } if (!string.IsNullOrEmpty(field.FormatString)) { tableDetailsTextBox.Style.Format = field.FormatString; } } tableDetailsCell.ReportItems.Add(tableDetailsTextBox); tableDetails.TableCells.Add(tableDetailsCell); } return(tableDetails); }
private static TableRow CreateTableFooter(ReportWizardState state) { List <FieldMetaData> columns = new List <FieldMetaData>(); columns.AddRange(state.GroupingFields); columns.AddRange(state.DisplayFields); TableRow tableFooter = new TableRow(); foreach (FieldMetaData field in columns) { TableCell tableFooterCell = new TableCell(); TextBox tableFooterTextBox = CreateTextBox(); tableFooterTextBox.Name = GetNameForComponent(ComponentNames.TextBox); if (field.IsNumeric) { if (state.DisplayGrandTotals && field.AllowTotaling) { tableFooterTextBox.Value = GetFieldSummaryExpression(field); if (field.IsNumeric) { tableFooterTextBox.Style.TextAlign = NumericTextAlignment; tableFooterTextBox.Style.ShrinkToFit = "True"; } if (!string.IsNullOrEmpty(field.FormatString)) { tableFooterTextBox.Style.Format = field.FormatString; } tableFooterTextBox.Style.BorderColor.Top = "LightGray"; tableFooterTextBox.Style.BorderStyle.Top = "Double"; tableFooterTextBox.Style.BorderWidth.Top = "3pt"; } } tableFooterCell.ReportItems.Add(tableFooterTextBox); tableFooter.TableCells.Add(tableFooterCell); } return(tableFooter); }
private static TableGroup CreateTableGroup(ReportWizardState state, FieldMetaData groupField, Length rowHeight) { List <FieldMetaData> columns = new List <FieldMetaData>(); columns.AddRange(state.GroupingFields); columns.AddRange(state.DisplayFields); TableGroup tableGroup = new TableGroup(); TableRow groupHeaderRow = new TableRow(); TableRow groupFooterRow = new TableRow(); tableGroup.Grouping.Name = GetNameForComponent(ComponentNames.TableGroup); tableGroup.Grouping.GroupExpressions.Add(GetFieldValueExpression(groupField)); groupFooterRow.Height = groupHeaderRow.Height = rowHeight; foreach (FieldMetaData columnField in columns) { TableCell groupHeaderCell = new TableCell(); TableCell groupFooterCell = new TableCell(); //set TextBoxes names avoiding duplicate names TextBox groupHeaderTextBox = CreateTextBox(); groupHeaderTextBox.Name = GetNameForComponent(ComponentNames.TextBox); TextBox groupFooterTextBox = CreateTextBox(); groupFooterTextBox.Name = GetNameForComponent(ComponentNames.TextBox); // show grouping expression value in the appropriate table cell if (groupField == columnField) { groupHeaderTextBox.Value = GetFieldValueExpression(groupField); if (!string.IsNullOrEmpty(groupField.FormatString)) { groupHeaderTextBox.Style.Format = groupField.FormatString; } if (groupField.IsNumeric) { groupHeaderTextBox.Style.TextAlign = NumericTextAlignment; } else { groupHeaderTextBox.Style.TextAlign = DefaultTextAlignment; groupHeaderTextBox.Style.PaddingLeft = DefaultPaddingLeft; } } //add group subtotals to the table cells if needed if (state.DisplayGroupSubtotals) { //We only do subtotals on the fields selected for output, not the groups if (state.DisplayFields.Contains(columnField)) { if (columnField.AllowTotaling) { groupFooterTextBox.Value = GetFieldSummaryExpression(columnField); groupFooterTextBox.Style.TextAlign = NumericTextAlignment; if (!string.IsNullOrEmpty(columnField.FormatString)) { groupFooterTextBox.Style.Format = columnField.FormatString; } groupFooterTextBox.Style.BorderColor.Top = "LightGray"; groupFooterTextBox.Style.BorderStyle.Top = "Solid"; groupFooterTextBox.Style.BorderWidth.Top = "1pt"; groupFooterTextBox.Style.ShrinkToFit = "True"; } } } groupHeaderCell.ReportItems.Add(groupHeaderTextBox); groupFooterCell.ReportItems.Add(groupFooterTextBox); groupHeaderRow.TableCells.Add(groupHeaderCell); groupFooterRow.TableCells.Add(groupFooterCell); } tableGroup.Header.TableRows.Add(groupHeaderRow); tableGroup.Footer.TableRows.Add(groupFooterRow); return(tableGroup); }