如何使用Open XML在Word文档中插入表 [英] How to Insert Table in Word document using Open XML

查看:133
本文介绍了如何使用Open XML在Word文档中插入表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Open XML Method将现有word文档中的表插入到指定位置。我从谷歌找到了一些代码,但是下表格单元格属性不起作用,表格插入到最后一页。我想在指定的位置插入此表格,例如:书签或替换文本并插入表格



I want to Insert table in the existing word document to the specified place using Open XML Method. I found some codes from google, but the following table cell properties not working, and the table is inserting in the last page. I want to insert this table in the specified place eg: Book Mark or replace text and insert table

TableProperties tblProp = new TableProperties(
           new TableBorders(
               new TopBorder() { Val =
                   new EnumValue<bordervalues>(BorderValues.Dashed), Size = 24 },
               new BottomBorder() { Val =
                   new EnumValue<bordervalues>(BorderValues.Dashed), Size = 24 },
               new LeftBorder() { Val =
                   new EnumValue<bordervalues>(BorderValues.Dashed), Size = 24 },
               new RightBorder() { Val =
                   new EnumValue<bordervalues>(BorderValues.Dashed), Size = 24 },
               new InsideHorizontalBorder() { Val =
                   new EnumValue<bordervalues>(BorderValues.Dashed), Size = 24 },
               new InsideVerticalBorder() { Val =
                   new EnumValue<bordervalues>(BorderValues.Dashed), Size = 24 }
           )
       );





如果我把这段代码然后显示错误为无效格式



IF i put this code then showing Error as Invalid format

推荐答案

参见..

使用Open XML Format SDK创建Word 2007文档 [ ^ ]

http://msdn.microsoft.com/en-us/library/gg490656%28v=office.14%29.aspx [ ^ ]

http://msdn.microsoft.com /en-us/library/office/cc850841.aspx [ ^ ]
See..
Creation of a Word 2007 document using the Open XML Format SDK[^]
http://msdn.microsoft.com/en-us/library/gg490656%28v=office.14%29.aspx[^]
http://msdn.microsoft.com/en-us/library/office/cc850841.aspx[^]


这篇关于如何使用Open XML在Word文档中插入表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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