附加不同的Word文档并保留每个文档的属性
我有一个可以生成不同类型报告的应用程序。现在,客户希望添加一个选项,使所有报告在一个文档中一个接一个地同时生成。我一直在尝试这样做,特别是作为对象插入文件,但页脚和页眉丢失了。
我见过许多声称可以实现我的目标的应用程序,但我不被允许购买许可证,并且它们不能以编程方式使用。有什么办法可以实现这一点吗?
I have an application which generates different kinds of reports. Now the client wants to add an option where all the reports are generated simultaneously one after the other in a single document. I've been trying to do this, particularly inserting an file as an object but the footers and headers are lost.
I have seen many applications which claim to achieve my goal but I am not allowed to buy a license and they cannot be used programatically. Is there any way to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
困难的方法,这是我找到的唯一方法。
基本上,您必须:
1)打开要插入的文件
2)使用Doc.INSERTFILE将文件插入到主文档中所需的位置。
记下插入的位置、活动部分等
。3) 现在循环遍历正在插入的文件的所有部分,然后复制
关于这些部分的所有内容
到主文档中的新部分,
包括页眉页脚信息,
格式、页面布局等。
这很痛苦,但据我所知,没有其他更简单的方法可以实现这一点。
The hard way, that's the only method I've found.
Basically, you have to:
1) Open the file to be inserted
2) use Doc.INSERTFILE to insert the file at the required spot in the main doc.
Make note of the location of the insertion, the active section etc.
3) now loop through all the sections of the file being inserted, and copy
over everything about those sections
to the new sections in the main doc,
including header footer info,
formatting, page layout etc.
It's a pain, but as far as I can tell, there is no other easier way to get there.