Esempio n. 1
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> 
                   " + GenerateTextBox("txtCell_" + table.ReportName + "_", ColumnCell.Name, "", true, padding) + @" 
                  </CellContents> 
                </TablixCell>";
            }
            strTableRow += @"</TablixCells></TablixRow>";
            return(strTableRow);
        }
Esempio n. 2
0
        static string GetTextBox(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(strValues[i].ToString());
            }

            strTextBox += @"</TextRuns> 
              <Style /> 
            </Paragraph> 
          </Paragraphs> 
          <rd:DefaultName>" + textBoxName + @"</rd:DefaultName> 
          <Top>1.0884cm</Top> 
          <Left>0cm</Left> 
          <Height>0.6cm</Height> 
          <Width>7.93812cm</Width> 
          <ZIndex>2</ZIndex> 
          <Style> 
            <Border> 
              <Style>None</Style> 
            </Border>";

            strTextBox += GetDimensions(padding) + @"</Style> 
        </Textbox>";
            return(strTextBox);
        }
Esempio n. 3
0
        static string GenerateTableHeaderRow(ReportBuilder reportBuilder, ReportTable table)
        {
            ReportColumns[]      columns    = table.ReportDataColumns;
            ReportTextBoxControl ColumnCell = new ReportTextBoxControl();
            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      = columns[i].HeaderColumnPadding;
                strTableRow += @"<TablixCell> 
                  <CellContents> 
                   " + GenerateTextBox("txtHeader_" + table.ReportName + "_", ColumnCell.Name, columns[i].HeaderText == null || columns[i].HeaderText.Trim() == "" ? ColumnCell.Name : columns[i].HeaderText, false, padding) + @" 
                  </CellContents> 
                </TablixCell>";
            }
            strTableRow += @"</TablixCells></TablixRow>";
            return(strTableRow);
        }
    private static string GetFirstRowDimensions(ReportDimensions padding = null, string backgroundColor = null)
    {
        string strDimensions = "";

        if (padding != null || backgroundColor != null)
        {
            if (padding.Default == 0)
            {
                strDimensions += string.Format("<BackgroundColor>" + backgroundColor + @"</BackgroundColor>");
                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("<BackgroundColor>" + backgroundColor + @"</BackgroundColor>");
                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);
    }
    static string GetHeaderTextBox(string textBoxName, string left = "1cm", ReportDimensions padding = null, params string[] strValues)
    {
        string manao      = "17.5cm";
        string strTextBox = "";

        //   string left = "1cm";
        strTextBox = @" <Textbox Name=""" + textBoxName + @"""> 
          <CanGrow>true</CanGrow> 
          <KeepTogether>true</KeepTogether> 
          <Paragraphs> 
            <Paragraph> 
              <TextRuns>";
        string widthxml = "7.93812cm";

        for (int i = 0; i < strValues.Length; i++)
        {
            strTextBox += GetHeaderTextRun(strValues[i].ToString());
        }
        //if (poss == 2)
        //{
        //    widthxml = TamanoTitulo.ToString() + "cm";
        //    left = "3cm";
        //}
        //else
        //{
        //    left = "1cm";
        //    widthxml = "7.93812cm";
        //}

        strTextBox += @"</TextRuns> 
              <Style /> 
            </Paragraph> 
          </Paragraphs> 
          <rd:DefaultName>" + textBoxName + @"</rd:DefaultName> 
          <Top>0.5cm</Top> 
          <Left>" + left + @"</Left> 
          <Height>0.6cm</Height> 
          <Width>" + widthxml + @"</Width> 
          <ZIndex>2</ZIndex> 
          <Style> 
            <Border> 
              <Style>None</Style> 
            </Border>";

        strTextBox += GetDimensions(padding) + @"</Style> 
        </Textbox>";
        return(strTextBox);
    }
    static ReportBuilder InitAutoGenerateReport(ReportBuilder reportBuilder, int[] lista)
    {
        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];
                    ReportDimensions ColumnPadding = new ReportDimensions();
                    ColumnPadding.Default = 2;
                    for (int i = 0; i < dt.Columns.Count; i++)
                    {
                        ReportScale ColumnScale = new ReportScale();
                        // ColumnScale.Width = 4;
                        ColumnScale.Height = 1;
                        ColumnScale.Width  = 0.25 * lista[i];
                        TamanoTitulo      += (0.25 * lista[i]);
                        columns[i]         = new ReportColumns()
                        {
                            ColumnCell = new ReportTextBoxControl()
                            {
                                Name = dt.Columns[i].ColumnName, 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);
    }
    static string GenerateFirstWhiteSpacesRow(ReportBuilder reportBuilder, ReportTable table, string filter)
    {
        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++)
        {
            if (i == 0)
            {
                ColumnCell   = columns[i].ColumnCell;
                padding      = ColumnCell.Padding;
                strTableRow += @"<TablixCell> 
                              <CellContents> 
                               " + GenerateFirstRowWhiteTextBox(filter, filter, ColumnCell.Name, "", true, padding) + @" 
                              </CellContents> 
                            </TablixCell>";
            }
            else
            {
                count       += 3;
                ColumnCell   = columns[i].ColumnCell;
                padding      = ColumnCell.Padding;
                strTableRow += @"<TablixCell />";
            }
        }
        strTableRow += @"</TablixCells>
                    </TablixRow>";

        return(strTableRow);
    }
Esempio n. 8
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);
        }
Esempio n. 9
0
        static string GenerateTextBox(string strControlIDPrefix, string strName, string strValueOrExpression = "", bool isFieldValue = true, ReportDimensions padding = null)
        {
            string strTextBox = "";

            strTextBox = @" <Textbox Name=""" + strControlIDPrefix + strName + @"""> 
                      <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 /> 
                            </TextRun> 
                          </TextRuns> 
                          <Style /> 
                        </Paragraph> 
                      </Paragraphs> 
                      <rd:DefaultName>" + strControlIDPrefix + strName + @"</rd:DefaultName> 
                      <Style> 
                        <Border> 
                          <Color>LightGrey</Color> 
                          <Style>Solid</Style> 
                        </Border>" + GetDimensions(padding) + @"</Style> 
                    </Textbox>";
            return(strTextBox);
        }
    static string GenerateHeaderTableTextBox(string strControlIDPrefix, string strName, string strValueOrExpression = "", bool isFieldValue = true, ReportDimensions padding = null, string tipoleta = "Calibri", string tamanioletra = "8pt")
    {
        string strTextBox = "";

        strTextBox = @" <Textbox Name=""" + strControlIDPrefix + strName + @"""> 
                      <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>" + tipoleta + @"</FontFamily>
                           <FontSize>" + tamanioletra + @"</FontSize>
                         </Style>  
                            </TextRun> 
                          </TextRuns> 
                           <Style>
                            <TextAlign>Center</TextAlign>
                          </Style>
                        </Paragraph> 
                      </Paragraphs> 
                      <rd:DefaultName>" + strControlIDPrefix + strName + @"</rd:DefaultName> 
                      <Style> 
                       <BackgroundColor>#DDDDDD</BackgroundColor>
                    <FontWeight>Bold</FontWeight>
                                            <Border> 
                                              <Color>LightGrey</Color> 
                                              <Style>Solid</Style> 
                                            </Border>" + GetDimensions(padding) + @"</Style> 
                                        </Textbox>";
        return(strTextBox);
    }
    static string GenerateWhiteTextBox(string strControlIDPrefix, string strName, string strValueOrExpression = "", bool isFieldValue = true, ReportDimensions padding = null, string tipoleta = "Calibri", string tamanioletra = "8pt")
    {
        string strTextBox = "";

        strTextBox += @"<Textbox Name=""" + strControlIDPrefix + strName + @"""> 
                      <CanGrow>true</CanGrow> 
                      <KeepTogether>true</KeepTogether> 
                      <Paragraphs>  
                        <Paragraph> 
                          <TextRuns> 
                            <TextRun>
                             <Value/>";
        strTextBox += @"<Style>
                                   <FontFamily>" + tipoleta + @"</FontFamily>
                                   <FontSize>" + tamanioletra + @"</FontSize>
                                 </Style> 
                            </TextRun> 
                          </TextRuns> 
                          <Style /> 
                        </Paragraph> 
                      </Paragraphs> 
                      <rd:DefaultName>" + strControlIDPrefix + strName + @"</rd:DefaultName> 
                      <Style> 
                        <Border> 
                          <Color>LightGrey</Color> 
                          <Style>Solid</Style> 
                        </Border>" + GetDimensions(padding) + @"</Style> 
                    </Textbox>";
        return(strTextBox);
    }
    static string GenerateFirstRowWhiteTextBox(string filter, string strControlIDPrefix, string strName, string strValueOrExpression = "", bool isFieldValue = true, ReportDimensions padding = null, string tipoleta = "Calibri", string tamanioletra = "8pt")
    {
        string strTextBox = "";

        strTextBox += @"<Textbox Name=""" + filter + @"""> 
                      <CanGrow>true</CanGrow> 
                      <KeepTogether>true</KeepTogether> 
                      <Paragraphs>  
                        <Paragraph> 
                          <TextRuns> 
                            <TextRun>
                             <Value>=""Agrupado por " + filter + @": ""  +Fields!" + filter + @".Value</Value>";

        strTextBox += @"<Style>
                                   <FontFamily>" + tipoleta + @"</FontFamily>
                                   <FontSize>" + tamanioletra + @"</FontSize>
                                 </Style> 
                            </TextRun> 
                          </TextRuns> 
                          <Style /> 
                        </Paragraph> 
                      </Paragraphs> 
                      <rd:DefaultName>" + filter + @"</rd:DefaultName> 
                      <Style> 
                        <Border> 
                          <Color>LightGrey</Color> 
                          <Style>Solid</Style> 
                        </Border>" + GetFirstRowDimensions(padding, "LightBlue") + @"</Style> 
                    </Textbox>
                    <ColSpan>" + 5 + @"</ColSpan> 
                    <rd:Selected>true</rd:Selected>";
        return(strTextBox);
    }