I'm looking to perform Microsoft Word automation -- straightforward stuff such as instructing Word to open a document and save it as an RTF file. But what happens if the user already has the document open in a running instance of Word? Can I still safely perform automation actions (that don't modify the document itself), or am I asking for trouble? Will this interfere with the user working on the open document? Are there any alternative ways to accomplish the same thing?
I'm only interested in Word 2003 and later (but also about the Word for the Mac, as this will eventually be a cross-platform application).
There are lot of problems in doing this.
First of all Microsoft doesnt recommend to use Word for automation. use OpenXML instead. In my experience every day I ended up investigation Com exceptions by automating Word in Server.
http://support.microsoft.com/kb/257757
Even if you attempt to take the risk by automating, It is bad idea to use the machine where there is users interaction. If there is some dialog box opened like find or save as it will not allow another instance of Word to do any other functionality.
If you dont find any other solution like me then create a new user profile called OfficeAutomationUser and follow the steps in http://theether.net/download/Microsoft/kb/288367.html
Thanks for reading my Words of caution about automating. Note: I am not C++ programmer I use VSTO with C#
Related
This is a very general question - i'll give you the shortest story that still makes sense -
I'm aware in Microsoft office, you can drive word with excel, or both word and excel with access. What I'm looking for is any guidance you can offer me.
I want to drive an application to automate the tasks that it performs-
I need the developer of that software's permission,
I need any libraries, objects, etc so I can control that program. Can you think of anything else?
What is the best plan of attack? develop something in C++ or continue down the path of writting macros?
I need to manipulate .docx documents using C/Visual C++. Any samples i found is c# samples.
How to do so?
What I've found is that Microsoft wants you to either use .NET or use their Office Automation API to invoke Word to perform the manipulations for you. Depending on how low you want to go with these manipulations, you might be able to get by with the Office Automation API. If not, you may have to get your hands dirty with the Open Office XML format that's behind the .docx file format.
Here's Microsoft's skimpy documentation on Office Automation
And here's an article that goes into it a bit more, although it may be out of date.
I just thought that one big issue with Office Automation is that you need to have Word to do anything with it. Of course, this all depends on what exactly you need to to.
Try http://libopc.codeplex.com/
Hei there, I'm not experienced at all in C++ as I need to start learning year the next year at my university, though, I've been creating a browser based game and I'm looking for someone to transform it into pc app.
Though, I'm wondering how to make that application send a http request via POST to a file on my webserver with the username / pw.
After all the tutotials I've been reading, I concluded that none worth spending my time with, because they all based on own database, and I'm looking for one that connects to a maestro server and requests the data from there.
This may not be the answer you are looking for, but you may consider two alternatives to a more pure C++ application.
If you already have a working browser game, try to take that same code and put the html/javascript/whatever in a file and give the file a ".hta" extention. It basically opens inside a browser to run your files, but it acts more like an application from the user's viewpoint. (And, as much as I hate Windows, they're pretty fun to create if I may say so). However, your source code with this option is easily read because it can be renamed to a text file (or html file).
You could use Visual C++ (or VB.net, which you have tagged to the question, as well as "Visual" C#) to create an application which mostly consists of a browser view. It could be a "standalone" application (however would rely completely on the .Net framework - may or may not be what you want) that basically accomplishes the same as the option above, but adds that you can "hide" your files inside your application.
Using the two above alternatives, you could make an application relatively quickly that would load your files, which I assume you have already created. Note that neither of the above alternatives will work on anything other than Windows OS's.
If the two above alternatives are not what you want, or if you have questions about either one, I'd be glad to attempt to help.
I've been able to find a friend that would do it in Delphi because I wouldn't want users to download net framework just for this ap.
So the program that would fit most for any apps is Delphi Prism XE (even if it's an addon of Visual Studio)
This is my first substantial MFC application.
My out-of-the-wizard MFC app wants to open a blank, new file of the type I specified for my app, when it starts, but that's not meaningful for my application. I want my app to open some connections to some remote sites and get data from them.
Where should I consider interrupting or overriding MFC's default behavior? I could subclass CWinApp::ProcessShellCommand(). I could modify the CCommandLineInfo object it works on. I could excise the whole command line processing and just call my go-get-the-data functions. I probably should just altogether excise the whole document-as-a-file related processing. I'm not opening or saving any files, except debug files or logs that are outside of the UI's concern. The only saving or collecting of local information is via a database, to which and from which I handle the serialization myself, so no CArchive, either.
I've got all this code but it's hanging in front of me disjointed and disintegrated. I'm too new to this and there's too many alternatives. Some simple guidance for a simple beginner is what I'm asking for.
So, if you'll say, sure, lop off the document-as-file handling, tell me, please, where I need to go to do that bit of surgery, I can see it's not just one object that'd be affected. And so forth. Thanks.
You might consider generating a new application, but when you do, tell it that you want a database application without file handling. Even if you don't use its database capability, it'll produce an application whose basic layout is set up roughly for what you're trying to do, so you'll basically just substitute your database interface for what it provides, but won't get involved with trying to rip out file handling and such that's apparently irrelevant for your program.
I found an answer with respect to modifying default file opening. While I made the database app Coffin suggested, I saw the phrase "storing database objects in views" and I rather aimlessly searched MSDN with that. If I was going to try the database app approach and do my own serialization, I had to learn about this.
I thus found an MSDN page concerning handling the file menu in database apps, which discusses how to alter and even disable the OnFileOpen command. It's applicable to OnFile New and it is the approach I was hoping for.
I found some documentation about interop with OpenOffice using technologies like COM, but before delving in more deeply I wondered if anyone's worked on this kind of thing?
We have a need for the following, all wrapped up in a method call from a client PC (client talks to server using COM):
Client sends a map of name/value pairs to a server app
Server opens a Word template (.dot currently) file and looking up bookmarks using names from 1, replaces the text with values
Server saves file as a Word .doc file
We were doing this using Word but some changes in Windows 2008 mean if you run without a desktop/interactive-user, Word won't start. It's obviously a big hack but we're looking for a quick solution rather than re-engineering due to time constraints... so I wondered if we can simply run up OO Writer on the server to do the same job? I know how ugly it all is so don't really need suggestions to create a brand new C# open XML SDK application.
Multiple simultaneous requests can be ruled out as a potential problem (or at least it's never been a problem using Word so unless OO is different it'll be ignored).
If you are thinking OpenOffice might help, you could use JODReports or Docmosis to help, though you'd need a small Java program to bridge from your C++ app (cmd line or whatever). These tools will let you control OpenOffice a little easier for doing your merge task than working with the OO API directly (hopefully a lower learning curve).