I´m trying to save the border information of a cell to a string variable and use the string to create borders for another cell, but I simply can't figure out how to do that. I have seen that you can get some border information using
.Cells[2, 0].Borders[SpreadsheetGear.BordersIndex.EdgeTop].ToString();
But I can´t figure out how to use the string to give border information to another cell.
Borders for a cell would need to be specified using the IRange.Borders property. Note this property can also be indexed into so that you can apply a specific border style/color/weight/etc. on a specific "edge". Example:
// Set border options for all "edges" of B2.
worksheet.Cells["B2"].Borders.Weight = BorderWeight.Thick;
// Set border option for the "right edge" only.
worksheet.Cells["B2"].Borders[BordersIndex.EdgeRight].Color = SpreadsheetGear.Colors.Red;
You can find a sample in the SpreadsheetGear Explorer Solutions for C#/VB (found in the "SpreadsheetGear" folder under the Start Menu, if you have SpreadsheetGear installed on your machine) under Range > Border which demonstrates this API further. There's also an online version of this sample that utilizes the SpreadsheetGear for Silverlight product here.