Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical table in novacode docx without border

Heyy i am new to novacode docx webapi i want to print a vertical type table without borders, i am have these line of codes through which i be able to print a vertical table i have screen shots also which maybe helpful to u to save my problem

private void Document_3_SecondaryDetail(DocX document, string dist, System.Data.DataTable Doc3_SecondaryDetail)
{
    try
    {

        string headlineText = "";
        string paraOne = "";
        var headLineFormat = new Formatting();
        headLineFormat.FontFamily = new System.Drawing.FontFamily("Arial Black");
        headLineFormat.Size = 18D;
        headLineFormat.Position = 12;
        var paraFormat = new Formatting();
        paraFormat.FontFamily = new System.Drawing.FontFamily("Calibri");
        paraFormat.Size = 10D;
        Novacode.Table SecondaryDetailDoc3 = document.AddTable(Doc3_SecondaryDetail.Select("District = '" + dist + "'").Count() + 1, Doc3_SecondaryDetail.Columns.Count);
        SecondaryDetailDoc3.Alignment = Alignment.left;
        SecondaryDetailDoc3.Design = TableDesign.LightGridAccent1;

        int columnNumber = 0;
        foreach (DataColumn columns in Doc3_SecondaryDetail.Columns)
        {
            SecondaryDetailDoc3.Rows[0].Cells[columnNumber].Paragraphs.First().Append(char.ToUpper(columns.ColumnName[0]) + columns.ColumnName.Substring(1).Replace("_", " "));
            columnNumber++;
        }
        int rowIndex = 1;
        foreach (DataRow row in Doc3_SecondaryDetail.Select("District = '" + dist + "'"))
        {
            int colIndex = 0;
            foreach (var item in row.ItemArray)
            {
                SecondaryDetailDoc3.Rows[rowIndex].Cells[colIndex].Paragraphs.First().Append(item.ToString());
                colIndex++;
            }
            rowIndex++;
        }
        document.InsertParagraph(headlineText, false, headLineFormat);
        document.InsertParagraph(paraOne, false, paraFormat);
        document.InsertTable(SecondaryDetailDoc3);
        document.InsertParagraph("");
        document.Save();
    }
    catch (Exception ex)
    {
    }
}    enter code here

but i want this type of result enter image description here i want verticle style table with no borders This is cuurrent input enter image description here Thanks in advance

like image 776
Ali Raza Avatar asked Jun 23 '16 09:06

Ali Raza


1 Answers

Set the border color to white.

Example:

  table.Rows[i].Cells.Last().SetBorder(TableCellBorderType.Left, new Border(BorderStyle.Tcbs_double, BorderSize.one, 1, Color.Transparent));
like image 63
John Avatar answered Oct 14 '22 22:10

John