XML在Word文档中插入表

XML在Word文档中插入表

本文介绍了如何使用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在Word文档中插入表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 23:08