Example #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);
        }
Example #2
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> 
                  
                " + GenerateHeaderTableTextBox("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);
        }
Example #3
0
        static string GetFooterTextBox(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 /> 
        </Paragraph> 
        </Paragraphs> 
        <rd:DefaultName>" + textBoxName + @"</rd:DefaultName> 
        <Top>1.0884cm</Top> 
        <Left>1cm</Left> 
        <Height>0.6cm</Height> 
        <Width>20.9cm</Width> 
        <ZIndex>2</ZIndex> 
        <Style> 
        <Border> 
            <Style>None</Style> 
        </Border>";

            strTextBox += GetDimensions(padding) + @"</Style> 
    </Textbox>";
            return(strTextBox);
        }
Example #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  = 4;
                        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, 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);
        }
Example #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);
        }
Example #6
0
        static string GenerateHeaderTableTextBox(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>
                            <FontSize>11pt</FontSize>
                            <FontWeight>Bold</FontWeight>
                            <Color>White</Color>
                        </Style> 
                        </TextRun> 
                        </TextRuns> 
                        <Style>
                            <TextAlign>Center</TextAlign>
                        </Style> 
                    </Paragraph> 
                    </Paragraphs> 
                    <rd:DefaultName>" + strControlIDPrefix + strName + @"</rd:DefaultName> 
                    <Style> 
                        <BackgroundColor>CornflowerBlue</BackgroundColor>
                        <FontWeight>Bold</FontWeight>
                        <Border> 
                            <Color>LightGrey</Color> 
                            <Style>Solid</Style> 
                        </Border>" + GetDimensions(padding) + @"</Style> 
                </Textbox>";
            return(strTextBox);
        }
Example #7
0
        //static string StripHTMLTags(string text)
        //{
        //    return System.Text.RegularExpressions.Regex.Replace(text, "<(.|\n)*?>", "");
        //}
        #endregion

        #region Report TextBox
        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>";
            strTextBox += @"<Value>=Fields!" + strName + @".Value</Value><MarkupType>HTML</MarkupType>";
            strTextBox += @"<Style /> 
                        </TextRun> 
                        </TextRuns> 
                        <Style /> 
                    </Paragraph> 
                    </Paragraphs> 
                    <rd:DefaultName>" + strControlIDPrefix + strName + @"</rd:DefaultName> 
                    <ActionInfo>
                        <Actions>
                            <Action>
                                <Hyperlink>=Fields!" + strName + @".Value</Hyperlink>
                            </Action>
                        </Actions>
                    </ActionInfo>
                    <Style> 
                    <Border> 
                        <Color>LightGrey</Color> 
                        <Style>Solid</Style> 
                    </Border>" + GetDimensions(padding) + @"</Style>
                </Textbox>";

            return(strTextBox);
        }