使用VC ++报告在word文档中写入 [英] Report as writing in word document using VC++

查看:128
本文介绍了使用VC ++报告在word文档中写入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家



我有一个MFC应用程序,它使用最终用户的一些输入进行一些数学计算。解决问题后,我必须生成一个PDF或Word文档的报告来显示结果(它有表格,图像等..)



我没有线索如何处理这个问题,所以请让我知道编写报告的有效方法



非常感谢宝贵的建议



问候,

Nag

Hi Experts

I have one MFC application, which do some mathematical calculations taking some inputs from the end user. After solving the problem I have to generate a report either in PDF or Word document to show the results (it have tables, images etc..)

I have no clue how to approach this problem, so please let me know the effective method to writing the report

Valuable suggestions are greatly appreciated

Regards,
Nag

推荐答案

Mr.Nagendra Nallani,



我在一个项目上工作,我必须做类似的事情,所以我想给你一个关于使用MS Word和MS Excel来完成工作的建议。



我相信可以帮助你的是自动化,我使用过OLE自动化,我会指出你的这些文章/问题,希望它能解决你的问题。



从我的这个问题开始:

如何插入tex进入MS WORD的表格? [ ^ ]



下一个将帮助您传递给AutoWrap功能的值:



需要有关OLE的信息Word自动化 [ ^ ]



我的最后建议:



阅读所有问题非常小心!




我希望这会对你有所帮助,但如果没有,那就试试这些:



http://support.microsoft.com/kb/196776 [ ^ ]



http://msdn.microsoft.com/en-us/library/dt80be78%28v = vs.80%29.aspx [ ^ ]



http://www.codeguru.com/cpp/com-tech/atl/tutorials/article.php/c14519/Microsoft- Word-Automation-Class.htm [ ^ ]



http://support.microsoft.com/kb/238611 [ ^ ]



http: //support.microsoft.com/kb/278260 [ ^ ]



http://social.msdn.microsoft。 com /论坛/ zh-CN / 6bdfa63a-f3f7-4f7a-a109-7dc90464076e / mfc-ms-word-automation [ ^ ]



祝你好运!
Mr.Nagendra Nallani,

I work on a project where I have to do similar thing, so I thought to give you an advice about using MS Word and MS Excel to do your job.

What I believe can help you is called Automation, I have used OLE Automation, and I will point you to these articles/ questions of mine, in hope that it will solve your problem.

Start with this question of mine:
How to insert text into tables in MS WORD ?[^]

The next one will help you with the values you pass to AutoWrap function:

Need information about OLE Word automation[^]

My last advice:

READ ALL QUESTIONS VERY CAREFULLY!


I hope this will be of help to you, but if not, then try these:

http://support.microsoft.com/kb/196776[^]

http://msdn.microsoft.com/en-us/library/dt80be78%28v=vs.80%29.aspx[^]

http://www.codeguru.com/cpp/com-tech/atl/tutorials/article.php/c14519/Microsoft-Word-Automation-Class.htm[^]

http://support.microsoft.com/kb/238611[^]

http://support.microsoft.com/kb/278260[^]

http://social.msdn.microsoft.com/Forums/en-US/6bdfa63a-f3f7-4f7a-a109-7dc90464076e/mfc-ms-word-automation[^]

Good luck!


我的观点是,使用简单的愚蠢和开放格式是更好的选择。如果我有其他更好的选择,二进制封闭式办公室文档格式将是我的最后选择。二进制格式还有一个缺点,即使不同的办公室版本显示它的方式与PDF不同,后者在不同的观看者和观看者版本之间更加一致。在这种情况下,pdf也是更好的选择,更不用说有很多免费(和平台无关/开源)pdf生成器库。免费和简单的愚蠢解决方案通常更好,作为富文本文档格式我也喜欢使用html或rtf的一个子集,遗憾的是这次不是一个选项,但我会问客户关于HTML,因为这只会有优势:易于编辑/修改,每台机器/智能手机上都有一个观众...



pdf generator libs:

http://www.jagpdf.org/downloads.htm [ ^ ]

http: //sourceforge.net/projects/libharu/ [ ^ ]

谷歌你可以找到很多。



当我想利用办公产品提供的舒适性时的另一种选择:办公室2003套件介绍了一些非常容易标准的xml格式任何程序! http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats [ ^ ]

我们使用的是Excel 2003 XML格式。我们保存了几个表,分析了生成的xml,然后我们从程序中生成了这样的xmls,我们让用户编辑xmls,程序能够读回来。请注意,xml充满了格式和完全不需要的元素,当程序生成xml时,这些元素不一定必须存在。如果您感兴趣,可以尝试使用Word 2003 XML格式的相同技巧。
My opinion is that using simple stupid and open formats is the better choice. The binary closed office only document format would be my last choice if I have other better choices. The binary format also has the disadvantage that even different office versions display it differently in contrast to PDF that has more consistent across different viewers and viewer versions. The pdf can be a better choice in this case too, not to mention that there are a lot of free (and platform independent/opensource) pdf generator libraries. Free and simple stupid solutions are generally better, as a "richtext" document format I also like using a subset of html or rtf that is unfortunately not an option this time but I would ask the client about the html because that would have only advantage: easy editing/modification, there is a viewer basically on every machine/smartphone...

pdf generator libs:
http://www.jagpdf.org/downloads.htm[^]
http://sourceforge.net/projects/libharu/[^]
With google you can find plenty of them.

Another option when I want to exploit the comfort provided by office products: The Office 2003 suite introduced some xml formats that are very easy to parse by any program! http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats[^]
What we used is the Excel 2003 XML format. We saved out a few tables, analized the resulting xml and then we generated such xmls from our program and we allwed the user to edit the xmls and the program was able to read it back. Note that the xml is full of formatting and totally unneeded elements that don't necessarily have to be there when the xml is generated by your program. You can try and use the same trick with the Word 2003 XML format if you are interested.


这篇关于使用VC ++报告在word文档中写入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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