Word .. using drag drop to INSERT a doc file (from a Delphi app)

Posted on 2004-11-22
Medium Priority
Last Modified: 2010-04-05
This is perhaps not quite as straightforward as it seems.

If I have a Word document (W1.doc) open, Insert|File  from the menu gives me the behaviour I want .. the contents of the specified file are inserted and all the styles (including the style "classes". those things in the drop down list under "Normal") are preserved. The inserted file becomes a seamless part of the current document (W1.doc).

So far so good. But if I drag fred.doc from say winzip (ie fred.doc is in mydox.zip) to W1.doc then Word treats this as an "embedded" and repositionable object, sort of  like being in a frame. You can still edit that object OK, and the styles are there but ONLY in that object.. so to change a style in the embedded object you have to double click on it which opens another instance of word. This means that you cannot do global style changes across embeds.

What I would like is to be able to drag fred.doc from my app (say a database of .doc files) and have the drop in Word interpreted as an insert.

Question by:Mutley2003
  • 3
LVL 12

Expert Comment

ID: 12652981
if using OLE d&d then specify a rich format excluding the file format from the supported formats
I have no clue what formats word docs support

Author Comment

ID: 12668863
sorry Lee, I don't follow. OK, I can set some format to "fool" Word (is that what you are saying?), but then presumably Word won't recognize the drop?
LVL 12

Accepted Solution

Lee_Nover earned 2000 total points
ID: 12669670
no, word supports several 'drag' formats
depending on the drag formats that are available from an IDataObject word desides which one to use and how
from a file manager the data is mostly CF_HDROP in a TYMED_HGLOBAL medium
what you can do from your app is to provide a different source format
eg: CF_TEXT in a TYMED_ISTREAM medium (check my dragdroghelper unit from the other topic)
this will probably result in word adding that text to the document
now to find out how to insert the formatted document .. another chapter :)
one way to find out what format suits word the most is to check the clipboard formats when you do a copy/paste
I'd love to play with this but really don't have the time

hope you'll manage :)
LVL 12

Expert Comment

ID: 12882213
tnx .. I'm really interested in what you've come up with

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question