简体   繁体   English

是Visual C ++ Win32还是MFC C ++?

[英]Visual C++ Win32 or MFC C++?

I want to create a project: an application to automate Microsoft Office Word Documents, that has to modify ready-made templates. 我想创建一个项目:一个用于自动化Microsoft Office Word文档的应用程序,该应用程序必须修改现成的模板。

I want you to help with this project, to provide me a starting point. 我希望您能为这个项目提供帮助,为我提供一个起点。

Which one should I pick among WIN32 C++ or MFC C++? 我应该在WIN32 C ++或MFC C ++中选择哪一个? What library should I use? 我应该使用哪个库? and the last thing, will that library need Microsoft Office to be installed on the machine my applications runs on? 最后一件事,该库是否需要在运行我的应用程序的计算机上安装Microsoft Office? I know that my question has more answers, but please help me with this, I want to practice and I need a good start. 我知道我的问题还有更多答案,但是请帮助我,我想练习,并且需要一个良好的开端。

Thanks in advance! 提前致谢! PS I want my application to run on Windows 7 and to generate DOCX files. PS我希望我的应用程序在Windows 7上运行并生成DOCX文件。

Which one should I pick among WIN32 C++ or MFC C++? 我应该在WIN32 C ++或MFC C ++中选择哪一个?

Either one is fine. 两者都可以。 However, MFC will make your job a lot easier and you can finish faster. 但是,MFC将使您的工作容易得多,并且可以更快地完成。 You will have to write more code yourself if you use raw win32 api. 如果您使用原始的win32 api,则必须自己编写更多代码。

What library should I use? 我应该使用哪个库?

Google Word Automation C++ or Word Automation MFC . Google Word Automation C++Word Automation MFC With MFC use the ClassWizard generator, see instructions here or for raw winapi see this CodeProject article for starters. 使用MFC时,请使用ClassWizard生成器,请参见此处的说明;有关原始winapi的信息,请参见此CodeProject入门文章。

will that library need Microsoft Office to be installed on the machine my applications runs on? 该库是否需要在运行我的应用程序的计算机上安装Microsoft Office?

For Word Automation, yes. 对于Word Automation,是的。 Otherwise, you would need a C++ library that understands docx files. 否则,您将需要一个能够理解docx文件的C ++库。 I don't know of a solution, but I do know docx document is a Zip archive in OpenXML format ( reference ). 我不知道解决方案,但是我确实知道docx document is a Zip archive in OpenXML format参考 )。 You could try uncompressing it and working from there or see libOPC which seems to provide that (but I do not know the specifics and how difficult it would be). 您可以尝试将其解压缩并从那里开始工作,或者查看libOPC似乎可以提供这一功能(但我不知道具体细节以及它的难度)。 I did find Where is the documentation for Office's docx/xlsx/pptx formats if you want to look more into the file format. 如果您想进一步了解文件格式,我确实找到了Office docx / xlsx / pptx格式的文档在哪里

(Also, as noted in the comments C# would make your life easier (unless you really want to stick with C++)). (此外,正如注释中所指出的那样, C#将使您的生活更轻松(除非您真的想坚持使用C ++))。

If your app will have a substantial GUI then MFC is a good choice. 如果您的应用程序具有强大的GUI,则MFC是一个不错的选择。 But the ATL library is much better suited to working with COM interfaces (and all of the interface to Office apps uses COM) and has much less overhead than MFC. 但是ATL库更适合使用COM接口(并且Office应用程序的所有接口都使用COM),并且其开销比MFC小得多。 Search MSDN for "ATL samples". 在MSDN中搜索“ ATL示例”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM