在代码中设置Word 2007表格样式设计 [英] Setting Word 2007 table style designs in code

查看:97
本文介绍了在代码中设置Word 2007表格样式设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Microsoft.Office.Interop.Word生成Word文档. 在该Word文档中,我正在生成一个表. 我想将表格样式设置为Word 2007+中不错的表格设计预设之一,并使用交替的行颜色等.

I am generating a Word document using Microsoft.Office.Interop.Word. In that word document I am generating a table. I would like to set the table style to one of the nice table design presets in Word 2007+ with alternating row colors, etc.

除了自己设置所有样式属性外,还有其他更简单的方法(预设名称或某些样式代码段存储库)吗?

Rather than setting all the style properties myself, is there an easier way to do this (preset name or some style snippet repository)?

推荐答案

没关系,我在手册中找到了它.

Nevermind, I found it in the manual.

解决方案:

            object tableStyle = WdBuiltinStyle.wdStyleTableLightShadingAccent1;
            table.set_Style(ref tableStyle);

或在C#4中:

            table.set_Style(WdBuiltinStyle.wdStyleTableLightShadingAccent1);

这篇关于在代码中设置Word 2007表格样式设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆