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. Importing enhanced metafile from ms word to MFC problem

Importing enhanced metafile from ms word to MFC problem

Scheduled Pinned Locked Moved C / C++ / MFC
c++visual-studiographicshelptutorial
1 Posts 1 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.
  • Z Offline
    Z Offline
    zakomed
    wrote on last edited by
    #1

    I am implementing a MS Word report program (in MFC c++) which uses MS Word to produce some kind of report from my program.
    A document that is produced is based on a template "mytemplate.dot" or "mytemplate.dotm" .
    When creating "mytemplate" in MS Word, I insert an enhanced metafile picture (via clippboard) from my program. This enhanced metafile has a unique signature text "XYZ" (example).
    "mytemplate' is stored in both "dot" and "dotm" formats. Any new file created in Word (2007,20016) based on these tempaltes opens correctly and I can see my enhanced metafile picture correctly displayed in Word and my unique "XYZ" is there.
    Now I create a "mytemplated" based document in my c++ program (using msword.olb type library).
    m_doc = documents.Add(& mytemplate,....)

    Then I enumarete through inlineshapes to find the wdInlineShapePicture type (which for the test purpose is the only inlineshape in document). I find the inlineshape object without any problem ("myinlineshape"). I do myinlineshape.Copy() and then use the clipboard to copy the enhanced metafile picture to my c++ program:

    OpenClipboard(AfxGetMainWnd()->m_hWnd);
    HANDLE hclip = GetClipboardData (CF_ENHMETAFILE ); //first I check if CF_ENMETAFILE is available in the clippboard

    everything is OK till now

    Now when I use the "mytemplate.dot" format the enhanced metafile in my program is exactly the same as it in Word - (the size and number of segments is exactly the same).
    When I use the "mytemplate.dotm" format, the metafile is changed - the size is different, number of segments is suddently quite small (like 19 vs 5000 in original). The picture shows the same contents but it is more like bitmap not a metafile.

    Can anybody explain what can be wrong?

    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