Exemple #1
0
        static string GenerateTableFooterRow(ReportBuilder reportBuilder, ReportTable table)
        {
            ReportColumns[]  columns = table.ReportDataColumns;
            ReportDimensions padding = new ReportDimensions();

            if (columns == null)
            {
                return("");
            }

            string strTableRow = "";

            strTableRow = @"<TablixRow>
                <Height>0.6cm</Height> 
                <TablixCells>";

            strTableRow += @"<TablixCell> 
                  <CellContents> 

                   " + GenerateFooterTableTextBox(reportBuilder, "txtFooter_" + table.ReportName + "_", "TableFooter158", $"count - {reportBuilder.TableRows}", padding) + $@" 
                  <ColSpan>{columns.Length}</ColSpan>
                  </CellContents> 
                </TablixCell>{string.Join(" ", Enumerable.Repeat("<TablixCell />", (columns.Length - 1)))}";

            strTableRow += @"</TablixCells></TablixRow>";
            return(strTableRow);
        }
Exemple #2
0
        static string GenerateTableHeaderRow(ReportBuilder reportBuilder, ReportTable table)
        {
            ReportColumns[]  columns = table.ReportDataColumns;
            ReportDimensions padding = new ReportDimensions();

            if (columns == null)
            {
                return("");
            }
            string strTableRow = @"<TablixRow>
                <Height>0.6cm</Height> 
                <TablixCells>";

            for (int i = 0; i < columns.Length; i++)
            {
                padding      = columns[i].HeaderColumnPadding;
                strTableRow += @"<TablixCell> 
                  <CellContents> 
                  
                   " + GenerateHeaderTableTextBox(reportBuilder, "txtHeader_" + table.ReportName + "_", columns[i].ColumnCell.Name, columns[i].HeaderText == null || columns[i].HeaderText.Trim() == "" ? columns[i].ColumnCell.Name : columns[i].HeaderText, padding) + @" 

                  </CellContents> 
                </TablixCell>";
            }
            strTableRow += @"</TablixCells></TablixRow>";
            return(strTableRow);
        }
Exemple #3
0
        static string GenerateTableRow(ReportBuilder reportBuilder, ReportTable table)
        {
            ReportColumns[]      columns    = table.ReportDataColumns;
            ReportTextBoxControl ColumnCell = new ReportTextBoxControl();
            ReportScale          colHeight  = ColumnCell.Size;
            ReportDimensions     padding    = new ReportDimensions();

            if (columns == null)
            {
                return("");
            }

            string strTableRow = "";

            strTableRow = @"<TablixRow> 
                <Height>0.6cm</Height> 
                <TablixCells>";
            for (int i = 0; i < columns.Length; i++)
            {
                ColumnCell   = columns[i].ColumnCell;
                padding      = ColumnCell.Padding;
                strTableRow += @"<TablixCell> 
                  <CellContents> 
                   " + GenerateTableRowTextBox(reportBuilder, "txtCell_" + table.ReportName + "_", ColumnCell.Name, "", true, padding) + @" 
                  </CellContents> 
                </TablixCell>";
            }
            strTableRow += @"</TablixCells></TablixRow>";
            return(strTableRow);
        }
Exemple #4
0
        static ReportBuilder InitAutoGenerateReport(ReportBuilder reportBuilder)
        {
            if (reportBuilder != null && reportBuilder.DataSource != null && reportBuilder.DataSource.Tables.Count > 0)
            {
                DataSet ds = reportBuilder.DataSource;

                int           _TablesCount = ds.Tables.Count;
                ReportTable[] reportTables = new ReportTable[_TablesCount];

                if (reportBuilder.AutoGenerateReport)
                {
                    for (int j = 0; j < _TablesCount; j++)
                    {
                        DataTable       dt          = ds.Tables[j];
                        ReportColumns[] columns     = new ReportColumns[dt.Columns.Count];
                        ReportScale     ColumnScale = new ReportScale();
                        ColumnScale.Width  = ((reportBuilder.Page.PageSize.Width - 2) / dt.Columns.Count);
                        ColumnScale.Height = 1;
                        ReportDimensions ColumnPadding = new ReportDimensions();
                        ColumnPadding.Default = 2;
                        for (int i = 0; i < dt.Columns.Count; i++)
                        {
                            columns[i] = new ReportColumns()
                            {
                                ColumnCell = new ReportTextBoxControl()
                                {
                                    Name = dt.Columns[i].ColumnName.Replace(" ", "_"), Size = ColumnScale, Padding = ColumnPadding
                                }, HeaderText = dt.Columns[i].ColumnName, HeaderColumnPadding = ColumnPadding
                            };
                        }

                        reportTables[j] = new ReportTable()
                        {
                            ReportName = dt.TableName, ReportDataColumns = columns
                        };
                    }
                }
                reportBuilder.Body = new ReportBody();
                reportBuilder.Body.ReportControlItems             = new ReportItems();
                reportBuilder.Body.ReportControlItems.ReportTable = reportTables;
            }
            return(reportBuilder);
        }
Exemple #5
0
        private static string GetDimensions(ReportDimensions padding = null)
        {
            string strDimensions = "";

            if (padding != null)
            {
                if (padding.Default == 0)
                {
                    strDimensions += string.Format("<PaddingLeft>{0}pt</PaddingLeft>", padding.Left);
                    strDimensions += string.Format("<PaddingRight>{0}pt</PaddingRight>", padding.Right);
                    strDimensions += string.Format("<PaddingTop>{0}pt</PaddingTop>", padding.Top);
                    strDimensions += string.Format("<PaddingBottom>{0}pt</PaddingBottom>", padding.Bottom);
                }
                else
                {
                    strDimensions += string.Format("<PaddingLeft>{0}pt</PaddingLeft>", padding.Default);
                    strDimensions += string.Format("<PaddingRight>{0}pt</PaddingRight>", padding.Default);
                    strDimensions += string.Format("<PaddingTop>{0}pt</PaddingTop>", padding.Default);
                    strDimensions += string.Format("<PaddingBottom>{0}pt</PaddingBottom>", padding.Default);
                }
            }
            return(strDimensions);
        }
Exemple #6
0
        static string GetFooterTextBox(ReportBuilder reportBuilder, string textBoxName, ReportDimensions padding = null, params string[] strValues)
        {
            string strTextBox = "";

            strTextBox = @" <Textbox Name=""" + textBoxName + @"""> 
          <CanGrow>true</CanGrow> 
          <KeepTogether>true</KeepTogether> 
          <Paragraphs> 
            <Paragraph> 
              <TextRuns>";

            for (int i = 0; i < strValues.Length; i++)
            {
                strTextBox += GetTextRun_fot(strValues[i].ToString());
            }

            strTextBox += $@"</TextRuns> 
                <Style>
                <TextAlign>Center</TextAlign>
              </Style>
            </Paragraph> 
          </Paragraphs> 
          <rd:DefaultName>" + textBoxName + $@"</rd:DefaultName> 
          <Top>1.0884cm</Top> 
          <Left>1cm</Left> 
          <Height>0.6cm</Height> 
          <Width>{reportBuilder.Page.PageSize.Width}cm</Width> 
          <ZIndex>2</ZIndex> 
          <Style> 
            <Border> 
              <Style>None</Style> 
            </Border>";

            strTextBox += GetDimensions(padding) + @"</Style> 
        </Textbox>";
            return(strTextBox);
        }
Exemple #7
0
        static string GetHeaderTextBox(ReportBuilder reportBuilder, ReportTextBoxControl reportHeader, ReportDimensions padding = null)
        {
            string strTextBox = "";

            strTextBox = @" <Textbox Name=""" + reportHeader.Name + @"""> 
          <CanGrow>true</CanGrow> 
          <KeepTogether>true</KeepTogether> 
          <Paragraphs> 
            <Paragraph> 
              <TextRuns>";

            for (int i = 0; i < reportHeader.ValueOrExpression.Length; i++)
            {
                strTextBox += GetHeaderTextRun(reportBuilder, reportHeader.ValueOrExpression[i].ToString());
            }

            strTextBox += @"</TextRuns> 
              <Style>
                <TextAlign>Center</TextAlign>
              </Style> 
            </Paragraph> 
          </Paragraphs> 
          <rd:DefaultName>" + reportHeader.Name + $@"</rd:DefaultName> 
          <Top>{reportHeader.Size.Top}cm</Top> 
          <Left>{reportHeader.Size.Left}cm</Left> 
          <Height>{reportHeader.Size.Height}cm</Height> 
          <Width>{reportHeader.Size.Width}cm</Width> 
          <ZIndex>2</ZIndex> 
          <Style> 
            <Border> 
              <Style>None</Style> 
            </Border>";

            strTextBox += GetDimensions(padding) + @"</Style> 
        </Textbox>";
            return(strTextBox);
        }
Exemple #8
0
        static string GenerateFooterTableTextBox(ReportBuilder reportBuilder, string strControlIDPrefix, string name, string strValueOrExpression = "", ReportDimensions padding = null)
        {
            string strTextBox = "";

            strTextBox  = $@" <Textbox Name=""" + strControlIDPrefix + name + @"""> 
                      <CanGrow>true</CanGrow> 
                      <KeepTogether>true</KeepTogether> 
                      <Paragraphs> 
                        <Paragraph> 
                          <TextRuns> 
                            <TextRun>";
            strTextBox += @"<Value>" + strValueOrExpression + "</Value>";
            strTextBox += $@"<Style><FontFamily>{reportBuilder.FontFamily}</FontFamily></Style> 
                            </TextRun> 
                          </TextRuns>
                          <Style>
                            <TextAlign>Center</TextAlign>
                          </Style>
                        </Paragraph> 
                      </Paragraphs> 
                      <rd:DefaultName>" + strControlIDPrefix + name + $@"</rd:DefaultName> 
                      <Style> 
   <BackgroundColor>{reportBuilder.TableFooterColor}</BackgroundColor>
<FontFamily>{reportBuilder.FontFamily}</FontFamily>
<FontWeight>Bold</FontWeight>
                        <Border> 
                          <Color>LightGrey</Color> 
                          <Style>Solid</Style> 
                        </Border>" + GetDimensions(padding) + @"</Style> 
                    </Textbox>";
            return(strTextBox);
        }
Exemple #9
0
        /// <summary>
        /// Generate Table's Row Textbox.
        /// </summary>
        static string GenerateTableRowTextBox(ReportBuilder reportBuilder, string strControlIDPrefix, string strName, string strValueOrExpression = "", bool isFieldValue = true, ReportDimensions padding = null)
        {
            string strTextBox = "";

            strTextBox = @" <Textbox Name=""" + strControlIDPrefix + strName.Replace(" ", "_") + @"""> 
                      <CanGrow>true</CanGrow> 
                      <KeepTogether>true</KeepTogether> 
                      <Paragraphs> 
                        <Paragraph> 
                          <TextRuns> 
                            <TextRun>";
            if (isFieldValue)
            {
                strTextBox += @"<Value>=Fields!" + strName + @".Value</Value>";
            }
            else
            {
                strTextBox += @"<Value>" + strValueOrExpression + "</Value>";
            }
            strTextBox += $@"<Style><FontFamily>{reportBuilder.FontFamily}</FontFamily></Style> 
                            </TextRun> 
                          </TextRuns> 
                          <Style>
                            <TextAlign>Center</TextAlign>
                          </Style>
                        </Paragraph> 
                      </Paragraphs> 
                      <rd:DefaultName>" + strControlIDPrefix + strName + $@"</rd:DefaultName> 
                      <Style> 
                       <BackgroundColor>=iif(RowNumber(Nothing) Mod 2 = 0,""{reportBuilder.TableRowEvenColor}"",""{reportBuilder.TableRowOddColor}"")</BackgroundColor>
                        <Border> 
                          <Color>LightGrey</Color> 
                          <Style>Solid</Style> 
                        </Border>" + GetDimensions(padding) + @"</Style> 
                    </Textbox>";
            return(strTextBox);
        }