C#,Visual Studio Express 2008,OpenXML SDK和多页Word文档 [英] C#, Visual Studio Express 2008, OpenXML SDK, and multipage word document

查看:137
本文介绍了C#,Visual Studio Express 2008,OpenXML SDK和多页Word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我有一个数据库,该数据库存储与房间相关的信息(近50列),显示该特定房间的数据,即温度,压力,表面处理,居住者的姓名,房间号等.因此,每一行都有50列,代表着50个属性一个房间.
该数据库是为每个不同的建筑物动态创建的,所以没有.的房间因建筑物而异.
我想使用内容控件将此数据导入到具有预格式化表格的.docx文档中. .docx将在5个单独的页面上具有5个不同的表,其中包含一个特定于房间的数据.因此,对于第一个房间,我可以填充所有表格单元格.没问题.我可以将每个表放在内容控件中,以便可以使用标签信息获取正确的表.
我的问题是我该如何再次复制这5张桌子,以便以相同的方式枚举其他房间数据?我能想到的唯一方法是以编程方式创建表.但是我认为这会减慢整个应用程序的速度,不是吗?
从理论上讲,我认为它的工作方式是添加空白页,然后将表格复制到这些空白页上.但不幸的是,我不知道该怎么做.

我想做这样的事情.

http://msdn.microsoft.com/en-us/library/cc197932 (v = office.12).aspx [

Hello,
I have a database which stores Room related information (almost 50 columns), showing data for that particular Room, i.e. temperature, pressure, finish, name of the person living, room number etc. So each row has 50 columns which represents 50 properties of a room.
This database is created dynamically for each different building so no. of rooms are varying from building to building.
I want to import this data into .docx document with preformatted tables using content control. The .docx will have 5 different tables, on 5 seperate pages, in which one room specific data goes into. So for first room I can populate all table cells. No problem. I can place each table inside content control so I can get the correct table using tag information.
My question is how can I copy those 5 tables again so that I can eneter other room data in the same manner? The only way I can think of is to create tables programatically. But I think this will slow down the whole application, No?
Theoritically the way I see it working is add blank pages and then copy tables on to those blank pages. But unfortunately I dont know how to do this.

I want to do something like this.

http://msdn.microsoft.com/en-us/library/cc197932(v=office.12).aspx[^]

Basically, I want to generate a multi-page word document that shows all rooms information, lets say 100 rooms. So Each room information is divided in 5 pages (tables). So in total there will be 500 pages word document.

Thanks in anticipation of your help.
Regards

推荐答案

为什么不创建(empty?)表的主副本,在需要时对其进行克隆,然后将克隆的表添加至文档.不知道到底为什么会出现这个问题,我无法提出更好的建议.

您也可以只创建一个类,该类使用提供的数据为您构建表,并使用数据行实例化该表,并使其返回表.
Why don''t you create a master copy of the (empty?) table, clone it when you need to, and add the cloned table to the document. Not knowing exactly why this is a problem, I can''t suggest anything better.

You could also just create a class that builds the table for you with the data you provide, and instantiate it it with your datarow, and have it return a table.


这篇关于C#,Visual Studio Express 2008,OpenXML SDK和多页Word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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