DocIO : Not able to change the color of the borders for all the table(cells)

Hi,
I'm trying to change the color of all the borders of a table but it does not work , this is my sample code :

.....
            IWTable table = section.AddTable();
            table.ResetCells(3, 2);
            table[0, 0].AddParagraph().AppendText("Item");
            table[0, 1].AddParagraph().AppendText("Price($)");
            table[1, 0].AddParagraph().AppendText("Items with same price");
            table[1, 1].AddParagraph().AppendText("1000");
            table[2, 0].AddParagraph().AppendText("Pomegranate");
            table[2, 1].AddParagraph().AppendText("70");
            for (int rowIndex = 0; rowIndex < 3; rowIndex++)
            {
                for (int colIndex = 0; colIndex < 2; colIndex++)
                {
                    WTableCell cell = table.Rows[rowIndex].Cells[colIndex];
               
                    cell.CellFormat.Borders.Color = Color.Red; // does not work 
           }

is there a way to do that?
thank you


   

3 Replies

DB Dilli Babu Nandha Gopal Syncfusion Team September 10, 2018 12:57 PM UTC

Hi Davide, 

Thank you for contacting Syncfusion support. 

On analyzing the given code example, we found that BorderType property of the cell.CellFormat.Borders wasn’t set which means a default value of BorderType.None will be considered. So, we request you to set BorderType.Single (based on your requirement) to view the border for a table which illustrated in the following code example. 
cell.CellFormat.Borders.BorderType = Syncfusion.DocIO.DLS.BorderStyle.Single; 

To know more about table formatting, kindly refer the following UG documentation page. 

Please let us know if you have any questions. 

Regards, 
Dilli babu. 



DA Davide Azzaroni September 10, 2018 01:27 PM UTC

thank you,

it solved my problem

Davide



DB Dilli Babu Nandha Gopal Syncfusion Team September 11, 2018 04:17 AM UTC

Hi Davide, 

We are glad to know that reported issue has been resolved. Please let us know if you need any further assistance on this. 

Regards, 
Dilli babu. 


Loader.
Up arrow icon