c++ MS Word
-
Hi folks, I am relatively new to c++. Currently I am trying my best to create a MS Word document out of my c++ program. I found a few tutorials on Word automation which gave me good initial results (like opening a document, writing plain text, saving documents etc). However, my goal is to insert more complex things like a table of content, headlines, footers and so on and I couldn't find any usable information about that. Therefor I have 2 questions: 1. Is office automation really the best way to achieve such a goal? (the official Microsoft support page seems a little outdated on that topic). 2. Most articles I found are about MS Excel. Unfortunately, I need to work with MS Word. Can somebody point me towards a comprehensive c++ -> MS Word article? Thanks for your time & help :)
-
Hi folks, I am relatively new to c++. Currently I am trying my best to create a MS Word document out of my c++ program. I found a few tutorials on Word automation which gave me good initial results (like opening a document, writing plain text, saving documents etc). However, my goal is to insert more complex things like a table of content, headlines, footers and so on and I couldn't find any usable information about that. Therefor I have 2 questions: 1. Is office automation really the best way to achieve such a goal? (the official Microsoft support page seems a little outdated on that topic). 2. Most articles I found are about MS Excel. Unfortunately, I need to work with MS Word. Can somebody point me towards a comprehensive c++ -> MS Word article? Thanks for your time & help :)
There's a few articles here on CP, here are links to a couple, maybe they will help. MS Office OLE Automation Using C++[^] Automating Word 2016 using Visual C++ MFC in Visual Studio 2015[^]
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
-
Hi folks, I am relatively new to c++. Currently I am trying my best to create a MS Word document out of my c++ program. I found a few tutorials on Word automation which gave me good initial results (like opening a document, writing plain text, saving documents etc). However, my goal is to insert more complex things like a table of content, headlines, footers and so on and I couldn't find any usable information about that. Therefor I have 2 questions: 1. Is office automation really the best way to achieve such a goal? (the official Microsoft support page seems a little outdated on that topic). 2. Most articles I found are about MS Excel. Unfortunately, I need to work with MS Word. Can somebody point me towards a comprehensive c++ -> MS Word article? Thanks for your time & help :)
I'm not sure I understand what you're aiming to accomplish. If you want to write a C++ program that constructs a Word program, the first response might besomewhat helpful. If you want to produce a Word dcument that contains your program code with some added formatting a table of contents, and maybe some useful internal links, you might want to take a look at Doxygen: Main Page[^]
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
-
There's a few articles here on CP, here are links to a couple, maybe they will help. MS Office OLE Automation Using C++[^] Automating Word 2016 using Visual C++ MFC in Visual Studio 2015[^]
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
Thank you! Those were the tutorials I used so far. They recommend to use the macro codes in MS Word to find the desired functions. However, I have trouble converting the macro code in c++. For example: To create a headline, the makro shows this code: Sub Makro() Selection.Style = ActiveDocument.Styles("Überschrift 1") End Sub ("Überschrift 1" means "Headline 1"). Any ideas?