Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
390
Header is over lapping with data in 2nd page.
posted

Hi,

Here is my code.  This works great if there is only one page. However, if there are more data, then data is over lapping over the header which is not good. How can I avoid this?

Thanks up front..

I also attaching the output

 

protected void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                Report rpt = CreateReport();

                MemoryStream stream = new MemoryStream();

                rpt.Publish(stream, Infragistics.Documents.Reports.Report.FileFormat.PDF);

                HttpResponse response = HttpContext.Current.Response;

                response.Clear();

                response.AddHeader("content-disposition", "attachment; filename=report.pdf");

                response.ContentType = "application/pdf";

                response.Buffer = true;

                //SavePDF(stream);

                response.BinaryWrite(stream.ToArray());

                response.Flush();

                response.End();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private Report CreateReport()
        {
            string colHeaderName = string.Empty;
            int offsetColumn = 15;  // 6
            string medTime = string.Empty;
           
            Report rpt = new Report();

            try
            {
                DataSet ds = (DataSet)Session["PrintData" + hdnPatientID.Value + hdnEncounterID.Value];

                if (ds.Tables[0].Rows.Count > 0)
                {


                    /* **********************************************************
                    *
                    * Define Borders and Background colors
                    *
                    * **********************************************************/
                    Borders bodrs = new Borders(new Infragistics.Documents.Reports.Graphics.Pen(new Infragistics.Documents.Reports.Graphics.Color(System.Drawing.ColorTranslator.FromHtml("#5e1388"))));
                    Background bckgrnd = new Background(new Infragistics.Documents.Reports.Graphics.Color(System.Drawing.ColorTranslator.FromHtml("#d8e7e2")));
                    Background insulinbckgrnd = new Background(new Infragistics.Documents.Reports.Graphics.Color(System.Drawing.ColorTranslator.FromHtml("#D7D1FA")));
                    Background habitbckgrnd = new Background(new Infragistics.Documents.Reports.Graphics.Color(System.Drawing.ColorTranslator.FromHtml("#ddd9f9")));
                    Background AsDirectedOrNeededBckgrnd = new Background(new Infragistics.Documents.Reports.Graphics.Color(System.Drawing.ColorTranslator.FromHtml("#FFFFFF")));

                    /* ****************************************************************
                     *
                     * Define the text style
                     *
                     * *****************************************************************/
                    Infragistics.Documents.Reports.Report.Text.Style red = new Infragistics.Documents.Reports.Report.Text.Style(new Infragistics.Documents.Reports.Graphics.Font("Arial", 8), Infragistics.Documents.Reports.Graphics.Brushes.Red);
                    Infragistics.Documents.Reports.Report.Text.Style black = new Infragistics.Documents.Reports.Report.Text.Style(new Infragistics.Documents.Reports.Graphics.Font("Arial", 8), Infragistics.Documents.Reports.Graphics.Brushes.Black);
                    Infragistics.Documents.Reports.Report.Text.Style teal = new Infragistics.Documents.Reports.Report.Text.Style(new Infragistics.Documents.Reports.Graphics.Font("Arial", 10), Infragistics.Documents.Reports.Graphics.Brushes.Teal);

                    ISection sect = rpt.AddSection();
                    sect.PageOrientation = PageOrientation.Landscape;

                    /* ******************************************/
                    /*  Add Header                              */
                    /*                                          */
                    /* ******************************************/
                    ISectionHeader header = sect.AddHeader();
                    header.Repeat = true;
                    header.Height = 20;

                    IGroup headerGrp = header.AddGroup(0, 0);

                    IGrid headerGrpGrid = headerGrp.AddGrid();
                    GridPattern gridPtrn = new GridPattern();
                    gridPtrn.Margins = new Margins(5);
                    gridPtrn.Paddings = new Paddings(5);

                    headerGrpGrid.ApplyPattern(gridPtrn);

                    headerGrpGrid.AddColumn();
                    headerGrpGrid.AddColumn();
                    headerGrpGrid.AddColumn();

                    IGridRow headerRow1 = headerGrpGrid.AddRow();

                    IGridCell r1c1 = headerRow1.AddCell();
                    r1c1.ColSpan = 2;
                    //r1c1.Height = new FixedHeight(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(85f));
                    //r1c1.Borders = bodrs;


                    string url = Server.MapPath(WebConfigurationManager.AppSettings["Company_logo"].ToString());

                    //System.Drawing.Image logoImg = System.Drawing.Image.FromFile(url);


                    Infragistics.Documents.Reports.Graphics.Image img2 = new Infragistics.Documents.Reports.Graphics.Image(url);

                    r1c1.AddImage(img2);

                    IGridRow headerRow2 = headerGrpGrid.AddRow();
                    IGridCell r2c1 = headerRow2.AddCell();

                    IGridCell r2c2 = headerRow2.AddCell();
                    IText r2c2Text = r2c2.AddText();
                    r2c2Text.AddContent(txtSurveyID.Text);
                    r2c2Text.Alignment = TextAlignment.Center;

                    IGridCell r2c3 = headerRow2.AddCell();
                    IText r2c3Text = r2c3.AddText();
                    r2c3Text.AddDateTime("MM/dd/yyyy");
                    r2c3Text.Alignment = TextAlignment.Right;

                    sect.PageOrientation = PageOrientation.Landscape;

                    /* ******************************************************************
                     *                                                                  *
                     * Populate Meds grid                                               *
                     *                                                                  *
                     * ******************************************************************/
                    IFlow flow = sect.AddFlow();
                    IGrid dataGrd = flow.AddGrid();

                    dataGrd.Margins.Top = 90;
                    dataGrd.Margins.Left = 15;
                    dataGrd.Margins.Right = 15;
                    dataGrd.Borders = bodrs;

                    dataGrd.AddColumn();
                    dataGrd.AddColumn();

                    IGridRow headerRow = dataGrd.AddRow();
                    IGridCell cell = headerRow.AddCell();
                    cell.Borders = bodrs;
                    cell.Background = bckgrnd;

                    IText text = cell.AddText();
                    text.Alignment = TextAlignment.Center;
                    text.AddContent("Medicines", teal);

                    cell = headerRow.AddCell();
                    cell.Borders = bodrs;
                    cell.Background = bckgrnd;
                    text = cell.AddText();
                    text.Alignment = TextAlignment.Center;
                    text.AddContent("Comments", teal);

                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        IGridRow dataRow = dataGrd.AddRow();

                        IGridCell r1c1Cell = dataRow.AddCell();
                        r1c1Cell.Borders = bodrs;
                        IText r1c1Text = r1c1Cell.AddText();
                        r1c1Text.AddContent(dr["Medicine"] + "\r\n" + dr["SIG"] + "\r\n" + dr["Treats"], black);

                        IGridCell r1c2Cell = dataRow.AddCell();
                        r1c2Cell.Borders = bodrs;
                        IText r1c2Text = r1c2Cell.AddText();
                        r1c2Text.AddContent(dr["Instruction"].ToString(), black);
                    }

                    /*  ****************************
                     *
                     * AsDirected Data Grid
                     *
                     *******************************/
                    IGap gap = sect.AddGap();
                    gap.Height = new FixedHeight(5);

                    if (ds.Tables[1].Rows.Count > 0)
                    {
                        IGrid asDirected = sect.AddGrid();

                        asDirected.Margins.Left = 15;
                        asDirected.Margins.Right = 15;

                        asDirected.AddColumn();
                        asDirected.AddColumn();

                        headerRow = asDirected.AddRow();
                        cell = headerRow.AddCell();
                        cell.Borders = bodrs;
                        cell.Background = bckgrnd;

                        text = cell.AddText();
                        text.Alignment = TextAlignment.Center;
                        text.AddContent("As Needed or As Directed Medicines", teal);

                        cell = headerRow.AddCell();
                        cell.Borders = bodrs;
                        cell.Background = bckgrnd;
                        text = cell.AddText();
                        text.Alignment = TextAlignment.Center;
                        text.AddContent("Comments", teal);

                        foreach (DataRow dr in ds.Tables[1].Rows)
                        {
                            IGridRow dataRow = asDirected.AddRow();

                            IGridCell r1c1Cell = dataRow.AddCell();
                            r1c1Cell.Borders = bodrs;
                            IText r1c1Text = r1c1Cell.AddText();
                            r1c1Text.AddContent(dr["Medicine"] + "\r\n" + dr["SIG"] + "\r\n" + dr["Treats"], black);

                            IGridCell r1c2Cell = dataRow.AddCell();
                            r1c2Cell.Borders = bodrs;
                            IText r1c2Text = r1c2Cell.AddText();
                            r1c2Text.AddContent(dr["Instruction"].ToString(), black);
                        }
                    }
                    /*  ****************************
                     *
                     * Add New Page
                     *
                     *******************************/

                    sect.AddPageBreak();

                    //ISectionPage schPage = sect.AddPage();

                    /*  ****************************
                     *
                     * Schedule Data Grid
                     *
                     *******************************/


                    IGrid schGrd = sect.AddGrid(); //schPage.AddGrid(5, 90);

                    schGrd.Margins.Top = 90;
                    schGrd.Margins.Left = 10;
                    schGrd.Margins.Right = 10;
                    schGrd.Borders = bodrs;

                    int wakeID = Convert.ToInt32(ds.Tables[0].Rows[0]["Wake"].ToString());
                    int breakfastID = Convert.ToInt32(ds.Tables[0].Rows[0]["Breakfast"].ToString());
                    int lunchID = Convert.ToInt32(ds.Tables[0].Rows[0]["Lunch"].ToString());
                    int dinnerID = Convert.ToInt32(ds.Tables[0].Rows[0]["Dinner"].ToString());
                    int sleepID = Convert.ToInt32(ds.Tables[0].Rows[0]["Sleep"].ToString());

                    IGridRow schheaderRow = schGrd.AddRow();
                    schheaderRow.Height = new FixedHeight(75);

                    for (int k = wakeID - 1; k <= sleepID; k++)
                    {
                        IGridColumn schCol = schGrd.AddColumn();

                        IGridCell schHeaderCell = schheaderRow.AddCell();
                        schHeaderCell.Borders = bodrs;
                        schHeaderCell.Background = bckgrnd;

                        if (k == (wakeID - 1))
                        {
                            schCol.Width = new FixedWidth(130);

                            IText schHeaderText = schHeaderCell.AddText();
                            schHeaderText.Alignment = TextAlignment.Center;
                            //schHeaderText.Width = MaxWidth.Instance;
                            //schHeaderText.Width = new Infragistics.Documents.Report.FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(340f));
                            schHeaderText.KeepSolid = true;
                            schHeaderText.AddContent("Medicines", teal);
                        }
                        else
                        {
                            //schCol.Width = new FixedWidth(20);

                            IGrid schHeaderCellGrid = schHeaderCell.AddGrid();

                            //schHeaderCellGrid.Borders = new Borders(new Infragistics.Documents.Reports.Graphics.Pen(new Infragistics.Documents.Reports.Graphics.Color(System.Drawing.ColorTranslator.FromHtml("#FF0000"))));

                            IGridColumn schHeaderCellCol = schHeaderCellGrid.AddColumn();

                            //schHeaderCellCol.Width = new FixedWidth(17);

                            IGridRow schHeaderCellRow1 = schHeaderCellGrid.AddRow();
                            IGridCell schHeaderCellRow1Cell1 = schHeaderCellRow1.AddCell();

                            //schHeaderCellRow1Cell1.Borders = new Borders(new Infragistics.Documents.Reports.Graphics.Pen(new Infragistics.Documents.Reports.Graphics.Color(System.Drawing.ColorTranslator.FromHtml("#FF0000"))));

                            IGridRow schHeaderCellRow2 = schHeaderCellGrid.AddRow();
                            IGridCell schHeaderCellRow2Cell2 = schHeaderCellRow2.AddCell();
                            schHeaderCellRow2Cell2.Height = new FixedHeight(58);

                            if (k == wakeID)
                            {
                                IImage imgHeader = schHeaderCellRow1Cell1.AddImage(new Infragistics.Documents.Reports.Graphics.Image(Server.MapPath("~/Images/wake.png")));      //schHeaderCell
                                //imgHeader.KeepRatio = true;
                                //imgHeader.Width = MaxWidth.Instance;
                                imgHeader.Height = new FixedHeight(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(12f));
                                imgHeader.Width = new FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(18f));
                            }
                            else if (k == breakfastID)
                            {
                                IImage imgHeader = schHeaderCellRow1Cell1.AddImage(new Infragistics.Documents.Reports.Graphics.Image(Server.MapPath("~/Images/breakfast.png")));
                                //imgHeader.KeepRatio = true;
                                //imgHeader.Width = MaxWidth.Instance;
                                imgHeader.Height = new FixedHeight(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(12f));
                                imgHeader.Width = new FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(18f));
                            }
                            else if (k == lunchID)
                            {
                                IImage imgHeader = schHeaderCellRow1Cell1.AddImage(new Infragistics.Documents.Reports.Graphics.Image(Server.MapPath("~/Images/lunch.png")));
                                //imgHeader.KeepRatio = true;
                                //imgHeader.Width = MaxWidth.Instance;
                                imgHeader.Height = new FixedHeight(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(12f));
                                imgHeader.Width = new FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(18f));
                            }
                            else if (k == dinnerID)
                            {
                                IImage imgHeader = schHeaderCellRow1Cell1.AddImage(new Infragistics.Documents.Reports.Graphics.Image(Server.MapPath("~/Images/dinner.png")));
                                //imgHeader.KeepRatio = true;
                                //imgHeader.Width = MaxWidth.Instance;
                                imgHeader.Height = new FixedHeight(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(12f));
                                imgHeader.Width = new FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(18f));
                            }
                            else if (k == sleepID)
                            {
                                IImage imgHeader = schHeaderCellRow1Cell1.AddImage(new Infragistics.Documents.Reports.Graphics.Image(Server.MapPath("~/Images/sleep.png")));
                                //imgHeader.KeepRatio = true;
                                //imgHeader.Width = MaxWidth.Instance;
                                imgHeader.Height = new FixedHeight(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(12f));
                                imgHeader.Width = new FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(18f));
                            }

                            IRotator rotate = schHeaderCellRow2Cell2.AddRotator();
                            rotate.Height = schHeaderCellRow2Cell2.Height;
                            //rotate.Width = schCol.Width;

                            IText schHeaderText = rotate.AddText();
                            schHeaderText.Alignment = TextAlignment.Right;
                            //schHeaderText.Width = MaxWidth.Instance;
                            schHeaderText.KeepSolid = true;

                            colHeaderName = ds.Tables[0].Columns[k + offsetColumn].ColumnName.Trim();      //6

                            DateTime convertedDate;
                            if (DateTime.TryParseExact(colHeaderName, "hh:mm tt", new CultureInfo("en-US"), DateTimeStyles.None, out convertedDate))
                                colHeaderName = convertedDate.ToString("h:mm tt");
                            else if (DateTime.TryParseExact(colHeaderName, "hh:mm", new CultureInfo("en-US"), DateTimeStyles.None, out convertedDate))
                                colHeaderName = convertedDate.ToString("h:mm tt");

                            switch (colHeaderName)
                            {
                                case "24:30":
                                    colHeaderName = "12:30 AM";
                                    break;
                                case "25:00":
                                    colHeaderName = "1:30 AM";
                                    break;
                                case "25:30":
                                    colHeaderName = "1:30 AM";
                                    break;
                                case "26:00":
                                    colHeaderName = "2:00 AM";
                                    break;
                                case "26:30":
                                    colHeaderName = "2:30 AM";
                                    break;
                                case "27:00":
                                    colHeaderName = "3:00 AM";
                                    break;
                                case "27:30":
                                    colHeaderName = "3:30 AM";
                                    break;
                                case "28:00":
                                    colHeaderName = "4:00 AM";
                                    break;
                                case "28:30":
                                    colHeaderName = "4:30 AM";
                                    break;
                                case "29:00":
                                    colHeaderName = "5:00 AM";
                                    break;
                                case "29:30":
                                    colHeaderName = "5:30 AM";
                                    break;
                                case "30:00":
                                    colHeaderName = "6:00 AM";
                                    break;
                            }

                            schHeaderText.AddContent(colHeaderName, teal);
                            schHeaderText.Height = schHeaderCellRow2Cell2.Height;
                            schHeaderText.Paddings.Right = 5;
                            //schHeaderText.Width = schCol.Width;
                            //schHeaderText.Borders = new Borders(new Infragistics.Documents.Reports.Graphics.Pen(new Infragistics.Documents.Reports.Graphics.Color(System.Drawing.ColorTranslator.FromHtml("#FFFFFF"))));

                            //schHeaderCellRow2Cell2.Borders = new Borders(new Infragistics.Documents.Reports.Graphics.Pen(new Infragistics.Documents.Reports.Graphics.Color(System.Drawing.ColorTranslator.FromHtml("#FF00FF"))));
                            //rotate.Borders = new Borders(new Infragistics.Documents.Reports.Graphics.Pen(new Infragistics.Documents.Reports.Graphics.Color(System.Drawing.ColorTranslator.FromHtml("#FF0000"))));
                        }
                    }

                    Boolean IsInsulin = false;
                    Boolean IsTakenWithFood = false;
                    Boolean IsNew = false;
                    Boolean IsDirectedOrNeeded = false;

                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        IsInsulin = ((dr["IsInsulin"].ToString().Trim() == "1" || dr["IsInsulin"].ToString().Trim().ToUpper() == "TRUE") ? true : false);
                        IsTakenWithFood = ((dr["TakenWFood"].ToString().Trim() == "1" || dr["TakenWFood"].ToString().Trim().ToUpper() == "TRUE") ? true : false);
                        IsNew = ((dr["IsNew"].ToString().Trim() == "1" || dr["IsNew"].ToString().Trim().ToUpper() == "TRUE") ? true : false);
                        IsDirectedOrNeeded = ((dr["AsDirected"].ToString().Trim() == "1" || dr["AsDirected"].ToString().Trim().ToUpper() == "TRUE" ||
                                                dr["AsNeeded"].ToString().Trim() == "1" || dr["AsNeeded"].ToString().Trim().ToUpper() == "TRUE") ? true : false);

                        IGridRow dataSchRow = schGrd.AddRow();

                        for (int k = wakeID - 1; k <= sleepID; k++)
                        {
                            IGridCell schDataCell = dataSchRow.AddCell();
                            schDataCell.Borders = bodrs;
                            if (IsInsulin)
                                schDataCell.Background = insulinbckgrnd;

                            if (IsDirectedOrNeeded)
                                schDataCell.Background = AsDirectedOrNeededBckgrnd;

                            if (k == (wakeID - 1))
                            {

                                IGrid schDataCellGrid = schDataCell.AddGrid();

                                IGridColumn schDataCellGridCol1 = schDataCellGrid.AddColumn();
                                schDataCellGridCol1.Width = new FixedWidth(110);
                                IGridColumn schDataCellGridCol2 = schDataCellGrid.AddColumn();
                                schDataCellGridCol2.Width = new FixedWidth(20);

                                IGridRow schDataCellGridRow = schDataCellGrid.AddRow();

                                IGridCell schDataCellGridRowCell1 = schDataCellGridRow.AddCell();
                                IGridCell schDataCellGridRowCell2 = schDataCellGridRow.AddCell();

                                IText schDataText = schDataCellGridRowCell1.AddText();
                                schDataText.Alignment = TextAlignment.Left;
                                schDataText.Width = MaxWidth.Instance;
                                schDataText.KeepSolid = true;
                                schDataText.AddContent(dr["Medicine"].ToString().ToUpper() + "\r\n" + dr["Treats"], black);
                                //schDataText.Width = new Infragistics.Documents.Report.FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(340f));

                                if (IsTakenWithFood)
                                {
                                    IImage imgHeader = schDataCellGridRowCell2.AddImage(new Infragistics.Documents.Reports.Graphics.Image(Server.MapPath("~/Images/food-small.jpg")));
                                    //imgHeader.KeepRatio = true;
                                    //imgHeader.Width = MaxWidth.Instance;
                                    imgHeader.Height = new FixedHeight(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(12f));
                                    imgHeader.Width = new FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(18f));
                                }
                                if (IsNew)
                                {
                                    IImage imgHeader = schDataCellGridRowCell2.AddImage(new Infragistics.Documents.Reports.Graphics.Image(Server.MapPath("~/Images/new-small.jpg")));       //schDataCell
                                    //imgHeader.KeepRatio = true;
                                    //imgHeader.Width = MaxWidth.Instance;
                                    imgHeader.Height = new FixedHeight(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(12f));
                                    imgHeader.Width = new FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(18f));
                                }

                            }
                            else
                            {
                                IText schDataText = schDataCell.AddText();
                                schDataText.Alignment = TextAlignment.Center;
                                //schDataText.Width = MaxWidth.Instance; habitbckgrnd
                                schDataText.KeepSolid = true;

                                medTime = dr[k + offsetColumn].ToString().ToUpper();

                                if (k == wakeID || k == breakfastID || k == lunchID || k == dinnerID || k == sleepID)
                                {
                                    schDataCell.Background = habitbckgrnd;
                                    schDataText.AddContent((medTime == "TRUE" ? dr["TakeMed"].ToString() : ""), red);
                                }
                                else
                                {
                                    schDataText.AddContent((medTime == "TRUE" ? dr["TakeMed"].ToString() : ""), black);
                                }

                            }
                        }
                    }

                    /* **********************************************
                     *
                     * AsDirected Schedule Meds
                     *
                     * **********************************************/
                    IGap gapd = sect.AddGap();
                    gapd.Height = new FixedHeight(5);

                    if (ds.Tables[1].Rows.Count > 0)
                    {

                        IGrid grd = sect.AddGrid(); //schPage.AddGrid(5, 5);

                        grd.Margins.Left = 15;
                        grd.Margins.Right = 15;
                        grd.Borders = bodrs;
                        grd.Width = new FixedWidth(250);

                        grd.AddColumn();

                        headerRow = grd.AddRow();
                        cell = headerRow.AddCell();
                        cell.Borders = bodrs;
                        cell.Background = bckgrnd;

                        text = cell.AddText();
                        text.Alignment = TextAlignment.Center;
                        text.AddContent("As Needed or As Directed Medicines", teal);

                        foreach (DataRow dr in ds.Tables[1].Rows)
                        {
                            IGridRow dataRow = grd.AddRow();

                            IGridCell celld = dataRow.AddCell();
                            celld.Borders = bodrs;

                            IGrid schDataCellGrid = celld.AddGrid();

                            IGridColumn schDataCellGridCol1 = schDataCellGrid.AddColumn();
                            schDataCellGridCol1.Width = new FixedWidth(210);
                            IGridColumn schDataCellGridCol2 = schDataCellGrid.AddColumn();
                            schDataCellGridCol2.Width = new FixedWidth(20);

                            IGridRow schDataCellGridRow = schDataCellGrid.AddRow();

                            IGridCell schDataCellGridRowCell1 = schDataCellGridRow.AddCell();
                            IGridCell schDataCellGridRowCell2 = schDataCellGridRow.AddCell();

                            IText schDataText = schDataCellGridRowCell1.AddText();
                            schDataText.Alignment = TextAlignment.Left;
                            schDataText.Width = MaxWidth.Instance;
                            schDataText.KeepSolid = true;
                            schDataText.AddContent(dr["Medicine"].ToString().ToUpper() + "\r\n" + dr["Treats"], black);
                            //schDataText.Width = new Infragistics.Documents.Report.FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(340f));

                            IsTakenWithFood = ((dr["TakenWFood"].ToString().Trim() == "1" || dr["TakenWFood"].ToString().Trim().ToUpper() == "TRUE") ? true : false);
                            IsNew = ((dr["IsNew"].ToString().Trim() == "1" || dr["IsNew"].ToString().Trim().ToUpper() == "TRUE") ? true : false);

                            if (IsTakenWithFood)
                            {
                                IImage imgHeader = schDataCellGridRowCell2.AddImage(new Infragistics.Documents.Reports.Graphics.Image(Server.MapPath("~/Images/food-small.jpg")));
                                //imgHeader.KeepRatio = true;
                                //imgHeader.Width = MaxWidth.Instance;
                                imgHeader.Height = new FixedHeight(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(12f));
                                imgHeader.Width = new FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(18f));
                            }
                            if (IsNew)
                            {
                                IImage imgHeader = schDataCellGridRowCell2.AddImage(new Infragistics.Documents.Reports.Graphics.Image(Server.MapPath("~/Images/new-small.jpg")));       //schDataCell
                                //imgHeader.KeepRatio = true;
                                //imgHeader.Width = MaxWidth.Instance;
                                imgHeader.Height = new FixedHeight(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(12f));
                                imgHeader.Width = new FixedWidth(Infragistics.Documents.Reports.Utils.Converter.PixelsToPoints(18f));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return rpt;

        }

 

Parents
No Data
Reply
  • 22852
    Offline posted

    Sameen,

    To prevent the grid from overlapping the header on the second page you will need to set a top margin for the asDirected grid in your code.  This can be done with the following:

    asDirected.Margins.Top = 45;

    Note that setting the Margin to a smaller value for the first grid will also reduce the spacing between the header and the content.

    Let me know if you have any questions with this matter.

Children
No Data