在Word文档中查找位置以插入表格 [英] Finding a position in a word document to insert a table
问题描述
我正在将数据库查询的一些结果写入Word中的表中.我已经完成了用于从查询结果访问/创建对象的代码,发现自己在将这些对象写入给我的单词模板时有些卡住.它本质上是一个摘要文档,在该文档中,我必须将从数据库中提取的数据表插入文档中的正确位置.因此,例如,该文档有4个节标题,每个标题下都有一些文本,之后我必须插入一个表.这样的标头可以像这样:
I am working on writing some results of a database query into tables in Word. I have already done the code for accessing/creating objects from the results of my query and find myself a little stuck on writing these to a word template given to me. Its essentially a summary document in which i have to insert tables of the data i pulled from the db in the correct position in the document. So for instance, the document has say 4 section headers and under each header, there is some text after which i have to insert a table. One such header can be like:
学校记录
在下面,您会找到一个表格,其中会列出所有学校记录:
Below you will find a table in which all school records will be listed:
因此,当我要打印我的学校成绩数据对象时,我需要一种方法以某种方式将数据以表格格式插入到word文档中上述行的正下方.谁能告诉我如何首先在doc中找到正确的位置,然后如何从c#中以单词形式创建表格?
So when i go to print my school record data object, i need a way to somehow insert my data in a table format right below the above line in the word document. Can anyone tell me how i can first find the correct position in the doc and then how you create a table in word from c#?
推荐答案
There is an article about how to insert images at specific position in Word document. Maybe it's useful for you to insert table either.
这篇关于在Word文档中查找位置以插入表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!