Re: Dolphin and Excel
Posted by Don Rylander-3 on Mar 22, 2005; 5:41pm
URL: https://forum.world.st/Dolphin-and-Excel-tp3373510p3373512.html
Peter,
The lcid argument that shows up everywhere strikes me as just the most
obvious aspect of Office's hideously malfactored object model; I feel your
pain.
On a more helpful note, one thing I've done is to use tab- and
crlf-delimited strings through the clipboard. Obviously, it isn't ideal,
but it's a pretty common way that 3rd-party apps can interact with Excel.
I've found it handy for prototyping output, and especially so if you can
provide an Excel template to avoid having to do too much ugly interaction.
I have one template with a bunch of pivot tables fed by a named range, which
I resize (from within Smalltalk) after I stuff in the data. If you haven't
already, it's also probably worthwhile to create a lightweight class for an
application-specific Excel implementation; I almost always need just a tiny
subset of what's available in its object model.
If you want to assign values directly to ranges, you have to build a
SAFEARRAY of VARIANTS, making sure that the dimensions of the SAFEARRAY
match the dimensions of the Excel Range. IIRC, it always seemed that the
SAFEARRAY was rotated 90 degrees from what I would expect (i.e., you have an
array of columns, not an array of rows), but that may just be a personal
problem ;^). It's a bit clunky and results in ugly Smalltalk code, but it's
pretty fast and the ugliness can usually be isolated to a method or two.
HTH,
Don