如何使用Open XML替换Word文档中的文本和插入表 [英] How to Replace Text and Insert Table in Word document Using Open XML

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

问题描述

如何在指定位置插入表格,例如:我想替换word文档中的一个文本并在该位置插入表格。

How to Insert table in the specified place, eg: i want to replace one text in word document and insert table on that place.

推荐答案

既然你是使用asp.net,interop不是一个选项。 Microsoft有一个OpenXML SDK,这里有大量示例: http://msdn.microsoft.com/en- us / library / cc850833.aspx [ ^ ],但我认为它不适用于c#2.0。

由于OpenXML是一种开放格式,您可以直接在XML上创建自己的代码。你也许可以找到一些第三方库,它们可能适用于c#2.0。但是:为什么c#2.0?如果你必须处理Word 2007或更高版本,你需要安装至少.net 3.5 ...所以我建议你尽快忘记c#2.0。
Since you are using asp.net, interop is not an option. Microsoft has an OpenXML SDK, with plenty of samples here: http://msdn.microsoft.com/en-us/library/cc850833.aspx[^], but as I see it won't work with c# 2.0.
As OpenXML is an open format, you could make your own code to to the manipulation directly on the XML. You could probably find some third party libraries also, that might work with c# 2.0. But: why c# 2.0? If you have to deal with Word 2007 or above, you need to have at least .net 3.5 installed... so I suggest you forget c# 2.0 as soon as possible.


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

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