Exemple #1
0
        static string GetTableColumns(ReportBuilder reportBuilder, ReportTable table)
        {
            ReportColumns[]      columns    = table.ReportDataColumns;
            ReportTextBoxControl ColumnCell = new ReportTextBoxControl();

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

            string strColumnHeirarchy = "";

            strColumnHeirarchy = @" 
        <TablixColumns>";
            for (int i = 0; i < columns.Length; i++)
            {
                ColumnCell = columns[i].ColumnCell;

                strColumnHeirarchy += @" <TablixColumn> 
                                        <Width>" + ColumnCell.Size.Width.ToString() + @"cm</Width>  
                                    </TablixColumn>";
            }
            strColumnHeirarchy += @"</TablixColumns>";
            return(strColumnHeirarchy);
        }
Exemple #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);
        }
Exemple #3
0
        static string GetSortingDetails(ReportBuilder reportBuilder)
        {
            return("");

            ReportTable[]        tables     = reportBuilder.Body.ReportControlItems.ReportTable;
            ReportColumns[]      columns    = reportBuilder.Body.ReportControlItems.ReportTable[0].ReportDataColumns;
            ReportTextBoxControl sortColumn = new ReportTextBoxControl();

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

            string strSorting = "";

            strSorting = @" <SortExpressions>";
            for (int i = 0; i < columns.Length; i++)
            {
                sortColumn  = columns[i].ColumnCell;
                strSorting += "<SortExpression><Value>=Fields!" + sortColumn.Name + @".Value</Value>";
                if (columns[i].SortDirection == ReportSort.Descending)
                {
                    strSorting += "<Direction>Descending</Direction>";
                }
                strSorting += @"</SortExpression>";
            }
            strSorting += "</SortExpressions>";
            return(strSorting);
        }
Exemple #4
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);
        }
Exemple #5
0
        public void DataBind(DataSet ds)
        {
            int count = 0;

            foreach (DataTable dt in ds.Tables)
            {
                count++;
                var       report_name = "Report" + count;
                DataTable dt1         = new DataTable(report_name.ToString());
                dt1           = ds.Tables[count - 1];
                dt1.TableName = report_name.ToString();
            }


            ReportViewerMaster.Reset();
            for (int i = 0; i < ds.Tables.Count; i++)
            {
                ReportViewerMaster.LocalReport.DataSources.Add(new ReportDataSource(ds.Tables[i].TableName, ds.Tables[i]));
            }
            ReportViewerMaster.LocalReport.EnableHyperlinks = true;

            ReportBuilder reportBuilder = new ReportBuilder();

            reportBuilder.DataSource = ds;

            reportBuilder.Page = new ReportPage();
            ReportSections reportFooter      = new ReportSections();
            ReportItems    reportFooterItems = new ReportItems();

            ReportTextBoxControl[] footerTxt = new ReportTextBoxControl[3];
            //string footer = string.Format("Copyright {0}         Report Generated On {1}          Page {2}", DateTime.Now.Year, DateTime.Now, ReportGlobalParameters.CurrentPageNumber);
            string footer = string.Format("Copyright  {0}         Report Generated On  {1}          Page  {2}  of {3} ", DateTime.Now.Year, DateTime.Now, ReportGlobalParameters.CurrentPageNumber, ReportGlobalParameters.TotalPages);

            footerTxt[0] = new ReportTextBoxControl()
            {
                Name = "txtCopyright", ValueOrExpression = new string[] { footer }
            };

            reportFooterItems.TextBoxControls = footerTxt;
            reportFooter.ReportControlItems   = reportFooterItems;
            reportBuilder.Page.ReportFooter   = reportFooter;

            ReportSections reportHeader = new ReportSections();

            reportHeader.Size = new ReportScale();
            // reportHeader.Size.Height = 0.56849;
            reportHeader.Size.Height = 0.7;

            ReportItems reportHeaderItems = new ReportItems();

            ReportTextBoxControl[] headerTxt = new ReportTextBoxControl[1];
            headerTxt[0] = new ReportTextBoxControl()
            {
                Name = "txtReportTitle", ValueOrExpression = new string[] { ReportTitle }
            };

            reportHeaderItems.TextBoxControls = headerTxt;
            reportHeader.ReportControlItems   = reportHeaderItems;
            reportBuilder.Page.ReportHeader   = reportHeader;

            ReportViewerMaster.LocalReport.LoadReportDefinition(ReportEngine.GenerateReport(reportBuilder));
            ReportViewerMaster.LocalReport.DisplayName      = ReportName;
            ReportViewerMaster.LocalReport.EnableHyperlinks = true;
        }