We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Using "BuiltinTableStyle" does not allow custom style ?!

Code snippet:
 
 table.ApplyStyle(BuiltinTableStyle.TableList3);
 
 //Does not work
 table[y , x].CellFormat.Borders.Top.BorderType = BorderStyle.None;
 //Does work.
table[y, zellenCounter].CellFormat.Borders.Top.LineWidth = 1.5f;
 

3 Replies

SY Sethumanikkam Yogendran Syncfusion Team October 25, 2016 08:30 AM UTC

Hi Customer,

Thank you for contacting Syncfusion support.

On further analyzing with the given code snippet, you have used None border type which can used to avoid effect on border type. It gives No border to particular border type of Cell and value for it inherits from its parent.

If you want to clear any type of border for the particular cell, then you can use as “Cleared” from “BorderStyle” which used to set clear particular border.

Please find the below highlighted code snippet which illustrates the same. Please let us know if it helps you.
//Creates an instance of WordDocument Instance (Empty Word Document)
WordDocument wordDocument = new WordDocument();
//Adds a section into Word document
WSection wSection = wordDocument.AddSection() as WSection;
//Adds a new table into Word document
WTable wTable = wordDocument.LastSection.AddTable() as WTable;
//Specifies the total number of rows & columns
wTable.ResetCells(3, 3);
//Applies "TableList3" built-in style to table
wTable.ApplyStyle(BuiltinTableStyle.TableList3);

//Does not work case used with Cleared to work.
wTable[0, 0].CellFormat.Borders.Top.BorderType = BorderStyle.Cleared;

wTable[0, 1].CellFormat.Borders.Bottom.BorderType = BorderStyle.Cleared;
wTable[1, 1].CellFormat.Borders.Top.BorderType = BorderStyle.Cleared;

wTable[1, 2].CellFormat.Borders.Bottom.BorderType = BorderStyle.Cleared;
wTable[2, 2].CellFormat.Borders.Top.BorderType = BorderStyle.Cleared;


Please refer the following link to know more about formatting with table row and cell.
https://help.syncfusion.com/file-formats/docio/working-with-tables#apply-formatting-to-table-row-and-cell

If we misunderstood your requirement, kindly update us requirement with clear description. Thereby we will analyze further on the mentioned requirement and update you with appropriate solution.

Please let us know if you have any other questions.

Thanks,
Sethumanikkam.Y



TE Testname October 25, 2016 11:01 AM UTC

tanks you, this helped


SY Sethumanikkam Yogendran Syncfusion Team October 26, 2016 04:06 AM UTC

Hi Customer,

Thank you for your update.

we are glad that our solution has resolved your issue. Please get back to us if you need any other assistance.
We will be happy to assist you as always.

Thanks,
Sethumanikkam.Y
 


Loader.
Live Chat Icon For mobile
Up arrow icon