本站首页    管理页面    写新日志    退出


«October 2025»
1234
567891011
12131415161718
19202122232425
262728293031


公告
================

注会练习软件
http://www.cpasoft.com.cn
我的注会软件官网

http://blog.163.com/abc7105@126/

 

 


哈哈,热爱快“过气”的DELPHI


我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:注册会计师(注会)练习软件
日志总数:398
评论数量:116
留言数量:27
访问次数:3277276
建立时间:2005年6月6日




[delpih编程]利用vba统一word文档中所有的表格风格
软件技术

吕向阳 发表于 2010/11/5 10:26:02

在审计实践中,财务报表附注这个文档往往含有数十个大小不一的表格。自己在做附注时有可能要改变一下风格,整个文件中全部表格重新调整过来,可能要几个小时或更多的时间,这时vba可方便助你改变表格风格,可能只是几十秒,所有表格调整一致,干净清爽。下面是代码,您可按需要设置每行高度,表格颜色,Sub change_table_style()Dim atableIf ActiveDocument.Tables.Count >= 1 ThenFor Each atable In ActiveDocument.Tables'对所有表格进行循环atable.Select'将所有的表格调整到左对齐,这样看起来整体协调Selection.Rows.HeightRule = wdRowHeightAtLeast'调整每行高度到0.65cm,这个您自个定 Selection.Rows.Alignment = wdAlignRowLeftatable.Rows.Height = CentimetersToPoints(0.65)'这个调整表格中每个单元格是垂直方向居中对齐Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter'调整表格中的字大小为9#Selection.Font.Size = 9'下面不解释了,是表格每条边线的线条与颜色Options.DefaultBorderLineWidth = wdLineWidth050ptOptions.DefaultBorderLineWidth = wdLineWidth075ptWith Options.DefaultBorderLineStyle = wdLineStyleSingle.DefaultBorderLineWidth = wdLineWidth075pt.DefaultBorderColor = wdColorAutomaticEnd WithWith Selection.Borders(wdBorderHorizontal).LineStyle = Options.DefaultBorderLineStyle.LineWidth = Options.DefaultBorderLineWidth.Color = Options.DefaultBorderColorEnd WithWith Selection.Borders(wdBorderVertical).LineStyle = Options.DefaultBorderLineStyle.LineWidth = Options.DefaultBorderLineWidth.Color = Options.DefaultBorderColorEnd WithWith Selection.Borders(wdBorderBottom).LineStyle = Options.DefaultBorderLineStyle.LineWidth = Options.DefaultBorderLineWidth.Color = Options.DefaultBorderColorEnd WithWith Selection.Borders(wdBorderTop).LineStyle = Options.DefaultBorderLineStyle.LineWidth = Options.DefaultBorderLineWidth.Color = Options.DefaultBorderColorEnd WithOptions.DefaultBorderLineWidth = wdLineWidth050ptWith Options.DefaultBorderLineStyle = wdLineStyleDot.DefaultBorderLineWidth = wdLineWidth050pt.DefaultBorderColor = wdColorAutomaticEnd WithWith Selection.Borders(wdBorderHorizontal).LineStyle = Options.DefaultBorderLineStyle.LineWidth = Options.DefaultBorderLineWidth.Color = Options.DefaultBorderColorEnd WithWith Selection.Borders(wdBorderVertical).LineStyle = Options.DefaultBorderLineStyle.LineWidth = Options.DefaultBorderLineWidth.Color = Options.DefaultBorderColorEnd With'表格往左调整多少距离,这样对宽表格有利一些,根据需要调整 atable.Rows.SetLeftIndent LeftIndent:=-0.2, RulerStyle:= _wdAdjustNoneNext atableEnd IfMsgBox "over"End Sub


阅读全文(1227) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.031 second(s), page refreshed 144819994 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号