I realise this means that this method is unsupported on the target machine, so that's fine, but how else can I get the same functionality?
If I use Range.Borders.LineStyle
and Range.Borders.Weight
then it doesn't put a border around the range, it will put borders around every individual cell inside the range (like a grid), which is not what I need.
The target machines use Office 2007. All other Office Interop code in my project works fine, just this.
You can try this code:
sheet.Range["A1:D6"].BorderAround();
Try this it should work.
sheet.Range["A1:D6", Type.Missing].BorderAround();
you can try this :
Excel.Application nouveau_excel = new Excel.Application();
nouveau_excel.get_Range("A1:K3").BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlThick, Excel.XlColorIndex.xlColorIndexAutomatic, Color.Red);
User contributions licensed under CC BY-SA 3.0