Powershell之Excel操作-网格线操作


 1,定义网格线种类

$LineStyle = "microsoft.office.interop.excel.xlLineStyle" -as [type]

2,指定网格线种类

$sheet.cells.item(2,3).borders.LineStyle = $LineStyle::xlDashDotDot

        网线种类:

        xlContinuous     实线
   xlDashDot      一点划线
   xlDashDotDot    二点划线
   xlDouble       双线
   xlSlantDashDot    斜线
   xlDash        虚线
   xlLineStyleNone   没有线

3,定义网线的宽度

$Weight = "microsoft.office.interop.excel.xlBorderWeight" -as [type]

4,指定网格线的宽度

$sheet.cells.item(2,3).borders.Weight = $Weight::xlMedium

        网线宽度种类:

        xlHairline    及细
   xlThin        细
   xlMedium    中
   xlThick        粗

5,列宽自动调整
$range = $sheet.usedRange
$range.EntireColumn.AutoFit() | out-null

评论

此博客中的热门博文

[软件推荐]好的视频编辑软件可以帮助你全方位展示产品,排名前五的免费视频编辑软件,视频剪辑必备工具!(2021)

Honeygain利用网路流量赚钱,官方教程~How do I make money with honeygain?

Ventoy – 开源 U 盘启动盘制作工具,支持启动多个系统,还能当普通 U 盘保存文件[Win/Linux]