0

I was facing issue to work on rowspan but with some code in C#, I was able to achieve that. Currently I have the data what I needed.

How can I draw left border line for the first column so that it looks correct.

here is what I have now.

enter image description here

I need to add left border line.

here is my code:

{
        ReportTableCell cell = null;

        // prevent null values from crashing the system (always a good idea)

        if (text == null)
        {
            text = string.Empty;
        }
        // else already valid

        ReportTable.CreateReportTableCell(text, out cell);
        cell.RowSpan = row_span;
        cell.ColumnSpan = column_span;
        cell.Style.WrapText = true;
        cell.Style.BorderWidth = border_width;

      //  cell.Style.BorderColor = CellBorderColor.Gray;
        if ( repeated)
        {
          // cell.Style.Border = BOTTOM_BORDER;               
            cell.Style.BorderWidth = border_width;                
        }
        else
        {
            cell.Style.BorderWidth = 0;
            repeated = true;

        }
        cell.Style.Font.FontStyle = font_style;
        cell.Style.Font.FontSize = font_size;
        cell.Style.BackgroundColor = background_color;
        cell.Style.IsColumnHeader = is_column_header;
        cell.Style.HorizontalAlignment = horizontal_alignment;
        if (is_column_header)
        {
            cell.Style.VerticalAlignment = VerticalCellAlignment.Middle;
        }
        else
        {
            cell.Style.VerticalAlignment = VerticalCellAlignment.Top;
        }
        repeated = true;
        return cell;
    }

based on the condition i.e.

if ( repeated){}

I am removing border, which I know it has removed border around 4 corners, how can i append an extra line only for the left side.

UPDATE : 1

enter image description here

after using the code as below :

 if ( repeated)
        {
            cell.Style.BorderWidth = border_width;                
        }
        else
        {
            cell.Style.BorderWidth = 0;
            cell.Style.Border = BOTTOM_BORDER | LEFT_BORDER;
            repeated = true;

        }

changed nothing!.

Here is the base class of the report.

public class ReportTableCell
{
    public static readonly int ALL_BORDER;
    public static readonly int BOTTOM_BORDER;
    public static readonly int LEFT_BORDER;
    public static readonly int NO_BORDER;
    public static readonly int RIGHT_BORDER;
    public static readonly int TOP_BORDER;

    public bool AllowBlanks { get; set; }
    public int ColumnSpan { get; set; }
    public ReportFont Font { get; set; }
    public int RowSpan { get; set; }
    public TableCellStyle Style { get; set; }
    public ReportTable Table { get; set; }
    public object Value { get; set; }

    public void AddImage(string FileName);
}

UPDATE : 2

I have changed the code as you suggested but , I just have to add single border line to the last. this is what i achieved till now :

enter image description here

Manjuboyz
  • 6,978
  • 3
  • 21
  • 43
  • Is this iText 7? I don't recognize the `Style` in `cell.Style`. What happens if you replace `BOTTOM_BORDER` with `BOTTOM_BORDER | LEFT_BORDER`? – Bruno Lowagie Jul 13 '16 at 13:45
  • Hi Bruno, I have updated the changes you asked for. thanks. – Manjuboyz Jul 13 '16 at 14:04
  • I don't understand your changes. I don't understand the `ReportTableCell`. That class isn't an iTextSharp class. You should ask the person who wrote it how it works. – Bruno Lowagie Jul 13 '16 at 14:21
  • Its a very old code and I agree about what you saying, will check about that and get back to the post. – Manjuboyz Jul 13 '16 at 14:23
  • Hi Bruno, I have updated my code (UPDATE :2). I could able to change the code, need to add one last bottom border at last line, is it possible ? – Manjuboyz Jul 13 '16 at 15:40

0 Answers0