zoukankan      html  css  js  c++  java
  • 宏代码批量处理表格数据

    Sub 在所有表格右侧添加一列()
    For Each aTable In ActiveDocument.Tables
    If aTable.Columns.Count = 5 Then
    aTable.Columns(aTable.Columns.Count).Select
    Selection.InsertColumnsRight
    End If
    Next aTable
    End Sub

    Sub 所有表格左对齐()
    For i = 1 To ActiveDocument.Tables.Count

    ActiveDocument.Tables(i).AutoFitBehavior (wdAutoFitContent) '根据内容自动调整表格

    ActiveDocument.Tables(i).AutoFitBehavior (wdAutoFitWindow) '根据窗口自动调整表格

    ActiveDocument.Tables(i).Range.ParagraphFormat.Alignment = wdAlignParagraphLeft

    ActiveDocument.Tables(i).Range.ParagraphFormat.Alignment = wdCellAlignVerticalLeft

    Next i
    End Sub

    Sub 设置表格宽度()
    For Each aTable In ActiveDocument.Tables
    If aTable.Columns.Count = 6 Then
    aTable.Columns(1).Width = 30
    aTable.Columns(6).Width = 50
    End If
    Next aTable
    End Sub

    Sub 第一行第六列属性列赋值()
    For Each aTable In ActiveDocument.Tables
    If aTable.Columns.Count = 6 Then
    aTable.Cell(1, 6).Range.InsertAfter "类型"
    End If
    Next aTable
    End Sub


    Sub 每行第六列赋值String()
    For Each aTable In ActiveDocument.Tables
    If aTable.Columns.Count = 6 Then

    For i = 2 To aTable.Rows.Count

    aTable.Cell(i, 6).Range.InsertAfter "String"

    Next i

    End If
    Next aTable
    End Sub

  • 相关阅读:
    babel的使用及安装配置
    npm install卡顿问题
    盒模型
    安全性
    字符串方法
    vue
    CSS3
    重载运算符
    装箱拆箱
    模板库
  • 原文地址:https://www.cnblogs.com/pjh7/p/14334783.html
Copyright © 2011-2022 走看看