Hello
I'm trying to create an Excel xlsx spreadsheet from data in a data table. I'm having trouble setting / defining cell borders. I would like to define a bottom black thin border for a range of cells.
I'm using this as a reference https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/working-with-cells/get-set-clear-properties#borders-property
I've started with this...
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.Add();
ThemableColor black = new ThemableColor(Color.FromArgb(0, 0, 0, 0));
CellBorders blackBorders = new CellBorders(new CellBorder(CellBorderStyle.Thin, black));
worksheet.Cells[4, 0, 4, 9].SetBorders(blackBorders);
In Visual Studio, ThemableColor and Color are underlined in red. When I mouse over it says 'The name 'Color' does not exist in the current context'.
Am I missing a reference or using statement to be able to use ThemableColor?
I had to add using System.Windows.Media;
and now this work for a bottom black border..
ThemableColor black = new ThemableColor(Color.FromArgb(0, 0, 0, 0));
CellBorders BlackBorders = new CellBorders(
new CellBorder(CellBorderStyle.None, black), // Left border
new CellBorder(CellBorderStyle.None, black), // Top border
new CellBorder(CellBorderStyle.None, black), // Right border
new CellBorder(CellBorderStyle.Medium, black), // Bottom border
new CellBorder(CellBorderStyle.None, black), // Inside horizontal border
new CellBorder(CellBorderStyle.None, black), // Inside vertical border
new CellBorder(CellBorderStyle.None, black), // Diagonal up border
new CellBorder(CellBorderStyle.None, black)); // Diagonal down border
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.Add();
worksheet.Cells[4, 0, 4, 9].SetBorders(BlackBorders);
Hello Andrew,
Thanks for the feedback. From what I understand no assistance is required as you were able to resolve this on your own, which I am glad to hear.
Regards,
Yoan