Ax 导出EXCEL给范围内的每个单元格加边框

1. 首先在ClassSysExcelRange加画边框的方法

    思路用EXCEL录宏的功能得到给一批单元格画格子的VBA代码,在AX将对象转为COM对象,基本VBA代码也能装为AX内能用的内容。

public void BorderLine()
{
    Com        borders;
    ComVariant  LineStyle,Weight,ColorIndex;
    int        xlEdgeBottom = 9;
    int        xlContinuous = 1;
    int        xlThin =       2;
    int        xlAutomatic  = -4105;

   borders    = range.Borders() ;
   LineStyle  = borders.LineStyle(xlContinuous);
   Weight    = borders.Weight(xlThin);
   ColorIndex = borders.ColorIndex(xlAutomatic);
}

2. 在外调用

LineNum = 100;
sheet.range(Strfmt("A1:AU%1",LineNum)).BorderLine();
原文地址:https://www.cnblogs.com/sxypeace/p/6253257.html