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
65
Cell Borders and Row Margins
posted

Hi, i want to draw a right border in cell of a row with top margin = 7; if i do:

row = grid.AddRow();

row.Margins.Top = 7;

 ...

 cell = row.AddCell();

 cell.Borders.Right = new Border(new Pen(Colors.Black, DashStyle.Solid));

 .... the border isn't drawn in the "margins zone". How can I do?

Parents
No Data
Reply
  • 37774
    posted

    Are you saying that the borders are drawn too far vertically so that they don't respect the top margins?  It's possible that the cell is taking up too much height, but I can't really say without seeing more code as to how you're building your grid.  Can you post a small sample so that I can look further into it?  One debugging tip for seeing how much width or height an element is taking up is to set the Background to something obvious (i.e. cell.Background = new Background(Infragistics.Documents.Graphics.Brushes.Green)).

    The sample that I used to test this was correctly honoring the margins of the top of the row:

    private void button1_Click(object sender, EventArgs e)
    {
        Report report = new Report();
        ISection section = report.AddSection();

        IText text = section.AddText();
        text.Borders = new Borders(Infragistics.Documents.Graphics.Pens.Blue);
        text.AddContent("Header");

        IGrid grid = section.AddGrid();
        IGridColumn col = grid.AddColumn();
        col.Width = new FixedWidth(30);
        IGridRow row = grid.AddRow();
        row.Margins.Top = 7;

        IGridCell cell = row.AddCell();
        cell.Background = new Background(Infragistics.Documents.Graphics.Brushes.Green);
        cell.Borders.Right = new Border(Infragistics.Documents.Graphics.Pens.Red);
        cell.AddText().AddContent("First Row");

        row = grid.AddRow();
        row.Margins.Top = 7;

        cell = row.AddCell();
        cell.Background = new Background(Infragistics.Documents.Graphics.Brushes.Gray);
        cell.Borders.Right = new Border(Infragistics.Documents.Graphics.Pens.Red);
        cell.AddText().AddContent("Second row");

        report.Publish("Test.pdf", FileFormat.PDF);
        Process.Start("Test.pdf");
    }

    -Matt

Children