Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. c++ MS Word

c++ MS Word

Scheduled Pinned Locked Moved C / C++ / MFC
c++testingtoolshelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 12351440
    wrote on last edited by
    #1

    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 :)

    J S 2 Replies Last reply
    0
    • U User 12351440

      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 :)

      J Offline
      J Offline
      jeron1
      wrote on last edited by
      #2

      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

      U 1 Reply Last reply
      0
      • U User 12351440

        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 :)

        S Offline
        S Offline
        Stefan_Lang
        wrote on last edited by
        #3

        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)

        1 Reply Last reply
        0
        • J jeron1

          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

          U Offline
          U Offline
          User 12351440
          wrote on last edited by
          #4

          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?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups