如何获取用作C#4dynamic互操作方法调用参数的Excel对象?

我和excel互动很愉快。 这是一个微风,直到我撞到一堵砖墙。

这就像一个魅力。

dynamic excel = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application"); 

它允许像这样的东西

 var headercell = excel.Cells(RowNumber,ColumnNumber); headercell.Value = moddef.Name; headercell.Orientation = -60; headercell.Font.Color = 0x00AA00; headercell.Interior.Color =0xCCCCCC; headercell.Font.Size = 20; headercell.ClearComments(); headercell.Data = "Here we are LIVE with excel"; 

这一切都很好,因为我到目前为止只使用简单的types与Excel交互。 不过,我想围绕桌子画一个边框。

 var bottomright = headercell.Offset(height,width); var wholeSection = excel.Range(headercell,bottomright); wholeSection.BorderAround(/*what goes in here??*/); 

在msdn文章Range对象成员中 , BorderAround方法显示了一些要传入的参数。到目前为止,我还没有引用Excel互操作程序集。 我必须引用它来创buildBorderAround参数还是有另一个一般的技巧,我应该如何处理调用需要Exceltypes参数的方法?