Re: Dragging data to Excel using DoDragDrop
- From: "Adrian Gallero" <adrian@[nospam]tmssoftware.com>
- Date: Tue, 02 Oct 2007 11:38:00 -0700
Hi Peter,
Yes, I'd agree. It does seem possible. IMHO, it's unfortunate that
Adrian didn't see fit to provide any suggestion as to how you might
do it yourself, instead choosing simply to market his own product.
I feel I need to clarify my position here. I am not trying to hide
anything. Even when I know I might not convince you, let me say I am
not even trying to market anything, I don't think newsgroups are a good
place to do marketing, and in fact, the effect is normally the opposite.
The situation is simpler, I just saw the post, and said, well, he could
do this with our product, and it might help him to know it. I can let
him know this is possible.
I doubted a lot before posting, because I know mentioning your own
product has an adverse effect on many people, (and I am not going to
post under a fake account) but I thought this could honestly help.
After all, if this was not the correct solution for him, he could just
dismiss the message. Now really after reading both Bruce's and your
answer, I think I maybe should have keep myself shut.
The reason I did not post a "suggestion on how to do it yourself" is
just because I don't know one. But I do know how to do it using our
library, and that is what I said.
The solution I mentioned is simple on the conceptual part, and I am
glad to answer any question I can answer about it.
It just puts a "biff8" object into the clipboard, or drags a biff8
object into Excel. Just in case, Biff8 is the native file format in
Excel. And the code to do that is on the demo I mentioned, all source
for the demo is included in the file you can freely download from the
page. So I don't know what else I could have said.
What Bruce whas doing was trying to put a text, link whatever object on
the clipboard, but Excel was not getting this as a link. If you put a
biff8 object into the clipboard (or drag one), Excel will understand
links (and formulas, cell colors, merged cells, etc).
I do not know any other way to put links inside Excel, even when it
might exist.
Now, to create this biff8 object to put into the clipboard, I use our
library. You could do it yourself, but programming a complete biff8
generator and this is a *lot* of work.
So if you ask me "is it possible", of course it is. Excel does it. (you
can drag and drop a cell with a link from a work*** to another). And
you can do it the same, if you do the same Excel does. Now, doing
"what Excel does" means creating a biff8 object and putting it into the
clipboard, and for that the only solution I know is our library.
However, simply knowing that it can be done is at least part of the
battle. Also, he does provide important clues. In particular, from
his description is sounds as though his code uses the native Excel
data formats. So, if you can use a native Excel data format from
your own code, you could probably package the link in a way that
would preserve the link formatting when dropped into Excel.
I am giving more than clues. As mentioned before, the full source for
the app is on the page, if you care about it.
Now, whether this is a justifiable effort on your part depends on how
closely tied to Excel you want to be. This would definitely be an
Excel-specific thing, and might not be worth doing if your
application is to support drag-and-drop to a wider variety of
programs. But if you're writing something that is specifically to be
used with Excel, it might be worth the effort.
You can copy more than one format to the clipboard. for example, text
for apps that do not understand biff8, and biff8 for Excel.
If you do find it worth the effort, the first thing I'd do is try to
find some sort of Office clipboard format documentation. Microsoft's
been told by the EU and other people to make their formats "more
open" so maybe there's some documentation on it. I'd start with the
Office web site, looking for some links to some kind of
file/clipboard format SDK or documentation. If that didn't pan out,
I'd try to reverse-engineer the format.
The clipboard format is basically the same as the file format. But you
need tho create an xls object for this to work.
To do broad support for Excel data formats might be impractical, but
for the specific scenario it might not be too hard. Just do a
drag-and-drop from Excel into your own application, dragging a cell
that has a formatted link like what you want to create, and look at
the data format that comes in. Then it should be a matter of
replicating that format.
Not to be negative here, but I don't think that might work. The biff8
format is quite complex, and it has offsets everywhere that need to be
updated. (and the whole object is inside an OLE container, that has its
own fat table and offsets to the data).
I doubt that Office is encrypting the clipboard data. Best-case
scenario would be that it's formatted as some sort of XML or other
string data, but even if it's a binary format I would guess you could
figure out what the "magic" bytes are and what the variable portion
describing the actual link are. You may need to try a variety of
different links, to pick up on where the string is stored, whether
there's any sort of character index or count, etc. But it could
probably be done. :)
Good luck!
Pete
Or you could just use our library :) I just wanted to say it again, I
mentioned a valid option, that is valid for a lot of people (and we are
luckily selling very well). The fact that it is not a solution in your
case (or bruce) does not mean I am not trying to actually help, instead
of just trying to market my products.
Hope my position is clear now.
Best regards and best of luck with whatever solution you choose,
Adrian.
--
.
- Follow-Ups:
- Re: Dragging data to Excel using DoDragDrop
- From: Peter Duniho
- Re: Dragging data to Excel using DoDragDrop
- References:
- Dragging data to Excel using DoDragDrop
- From: Bruce_Stough
- Re: Dragging data to Excel using DoDragDrop
- From: Peter Duniho
- Re: Dragging data to Excel using DoDragDrop
- From: Peter Duniho
- Dragging data to Excel using DoDragDrop
- Prev by Date: Updating Dataset
- Next by Date: Re: how To Talk to a vb6 window from c#
- Previous by thread: Re: Dragging data to Excel using DoDragDrop
- Next by thread: Re: Dragging data to Excel using DoDragDrop
- Index(es):