• 宏代码批量处理表格数据


    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

  • 相关阅读:
    关于ThreadLocal的理解
    常用Linux软件安装
    Spring事务注解@Transactional失效的问题
    使用jackson转换xml格式数据进行响应
    创建简单web程序了解servlet
    JDBC
    StringBuild类
    Canlendar 日期类
    Java Date 时间类的使用
    QWeb
  • 原文地址:https://www.cnblogs.com/pjh7/p/14334783.html
Copyright © 2020-2023  润新知