2012-12-17 72 views
0

我意识到这意味着这种方法在目标机器上是不支持的,所以这很好,但我怎么才能获得相同的功能呢?Excel Interop Range.BorderAround2给出了0x80020003

如果我使用Range.Borders.LineStyleRange.Borders.Weight那么它不把边界周围的范围内,它会加边框,每一个个体细胞的范围内(如网格),这不是我所需要的。

目标机器使用Office 2007.我的项目中的所有其他Office Interop代码都正常工作,只是这一点。

回答

0

你可以试试这个代码:

sheet.Range["A1:D6"].BorderAround(); 
+0

我没有'Range.BorderAround()','只有Range.BorderAround2()' – Ozzah

0

试试这个它应该工作。

sheet.Range["A1:D6", Type.Missing].BorderAround(); 
0

你可以试试这个:

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);