我希望使用 Microsoft.Office.Interop.Excel 库将边框应用于一个单元格。
我正在运行一个 while 循环,用于在特定列中搜索空单元格,一旦找到该单元格,我想为其应用边框。
我知道有很多论坛都在使用范围,但我无法使用范围功能,因为我不知道它确切应用于哪个单元格。
我的想法是:
(Excel.Range)xlWS.Cells[row,1].Borders.LineStyle = (Whatever Value);
有什么建议吗? (除了其他论坛的链接,我已经浏览过大量表格)?
最佳答案
Excel.Range range = xlWS.UsedRange;
Excel.Range cell = range.Cells[row, column];
Excel.Borders border = cell.Borders;
border.LineStyle = Excel.XlLineStyle.xlContinuous;
border.Weight = 2d;
希望这对某人有帮助!在单元格[行,列]周围放置一个细线边框!
关于c# - Microsoft.Office.Interop.Excel : How to Apply a border to ONE CELL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17751192/