www.digitalmars.com         C & C++   DMDScript  

D - com, excel, guid...

reply "Carlos Santander B." <carlos8294 msn.com> writes:
Today I was playing a bit trying to create an excel file (workbook) by
writing code. First, I started with VB6, since I had done it before. Then,
after burning I don't how many zillions of neurons, I managed to do the same

to start in DMC or DMD. Can somebody please give me some pointers?

-----------------------
Carlos Santander Bernal
Feb 02 2004
next sibling parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
Carlos Santander B. wrote:
 Today I was playing a bit trying to create an excel file (workbook)
 by writing code. First, I started with VB6, since I had done it
 before. Then, after burning I don't how many zillions of neurons, I

 in VC++6, and I have no idea how to start in DMC or DMD. Can
 somebody please give me some pointers?
In case you need a bit more of info, all I first want to do is something like this: with (new Excel.Application()) { Excel.Workbook wb = Workbooks.Add(); Excel.Worksheet ws = wb.ActiveSheet; ws.Cells[1][1] = "hi"; wb.Close(); Quit(); } Or whatever the equivalent code might look like. Thanks. ----------------------- Carlos Santander Bernal
Feb 03 2004
parent reply Clint Olson <Clint_member pathlink.com> writes:
While only slightly DM/DMD related, you can always create an Excel workbook in
code, in any language, by producing code that produces XML that complies with
the Excel DTD.  (starting with Excel 2002 anyway).

Easiest approach is create what you want using Excel and then save it as an XML
document.  Then you have a pretty good example of the XML your code needs to
produce.  And then you can start building your D/Excel library :)

In article <bvpbmi$1ka4$1 digitaldaemon.com>, Carlos Santander B. says...
Carlos Santander B. wrote:
 Today I was playing a bit trying to create an excel file (workbook)
 by writing code. First, I started with VB6, since I had done it
 before. Then, after burning I don't how many zillions of neurons, I

 in VC++6, and I have no idea how to start in DMC or DMD. Can
 somebody please give me some pointers?
In case you need a bit more of info, all I first want to do is something like this: with (new Excel.Application()) { Excel.Workbook wb = Workbooks.Add(); Excel.Worksheet ws = wb.ActiveSheet; ws.Cells[1][1] = "hi"; wb.Close(); Quit(); } Or whatever the equivalent code might look like. Thanks. ----------------------- Carlos Santander Bernal
Feb 03 2004
parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
Clint Olson wrote:
 While only slightly DM/DMD related, you can always create an Excel
 workbook in code, in any language, by producing code that produces
 XML that complies with the Excel DTD.  (starting with Excel 2002
 anyway).

 Easiest approach is create what you want using Excel and then save
 it as an XML document.  Then you have a pretty good example of the
 XML your code needs to produce.  And then you can start building
 your D/Excel library :)
(I must admit that at first I had no idea what you were talking about.) I don't know if by doing XML files I can also create graphics, because in the end I'd like to, after some calculations, obtain graphics (histograms (sp?), bar charts, pie charts, etc.) from those values. Is that possible with your approach? ----------------------- Carlos Santander Bernal
Feb 04 2004
parent Clint Olson <Clint_member pathlink.com> writes:
In article <bvrinr$2asa$1 digitaldaemon.com>, Carlos Santander B. says...
Clint Olson wrote:
 While only slightly DM/DMD related, you can always create an Excel
 workbook in code, in any language, by producing code that produces
 XML that complies with the Excel DTD.  (starting with Excel 2002
 anyway).

 Easiest approach is create what you want using Excel and then save
 it as an XML document.  Then you have a pretty good example of the
 XML your code needs to produce.  And then you can start building
 your D/Excel library :)
(I must admit that at first I had no idea what you were talking about.) I don't know if by doing XML files I can also create graphics, because in the end I'd like to, after some calculations, obtain graphics (histograms (sp?), bar charts, pie charts, etc.) from those values. Is that possible with your approach?
Our experience is that Excel charts are not persisted to XML, so I expect they are not supported in the DTD at this time.
Feb 04 2004
prev sibling next sibling parent reply J C Calvarese <jcc7 cox.net> writes:
Carlos Santander B. wrote:
 Today I was playing a bit trying to create an excel file (workbook) by
 writing code. First, I started with VB6, since I had done it before. Then,
 after burning I don't how many zillions of neurons, I managed to do the same

 to start in DMC or DMD. Can somebody please give me some pointers?
 
 -----------------------
 Carlos Santander Bernal
 In case you need a bit more of info, all I first want to do is
 something
 like this:
 with (new Excel.Application()) {
<snip> I'd like to be able to work with with COM in this way, too. I'm mostly interested in using DAO and ADODB, but I'd probably use the Microsoft Office apps through automation as well. If you're looking for links on the web, Microsoft likes to call this OLE and ActiveX. In my understanding, COM is a general term that includes OLE, ActiveX, and other fancy acronyms. I have developed a COM example in D, but I doubt it'll be much use to you unless you want to create shortcuts: http://jcc_7.tripod.com/d/tutor/createLink.html Also, Walter has put an example or two in \dmd\samples\d. The Right Way? I think we'd get the best results if we took the relevant .idl files and/or Windows headers and imported them into our D files. This is similar to the way that Mike Wynn demonstrated using IBrowser at http://www.geocities.com/one_mad_alien/dcom_not_dcom.html. (I suspect Mike's code is broken from recent additions to std.c.windows.windows, but it may be easy to fix.) The Quick-and-Dirty Way? I'd like to do something like this in D: http://www.aleax.it/TutWin32/s39.htm (it's in Italian). I've played around with a BCX port of this. I suppose it's something of a hack, but it lets you do cool stuff without tracking down and porting hundreds of .idl's (hyperbole?). It's not the ideal system, but I think it could be pretty useful. What happens is an instance of a scripting engine is started (i.e. VBScript) and then one can create and use COM objects, such as an Excel application. I was working on porting the LCC-Win32 C code produced by the BCX version when I got bogged down by minutia. If you're interesting in this idea, I can post some not-quite-compiling code for you. -- Justin http://jcc_7.tripod.com/d/
Feb 03 2004
parent "Matthew" <matthew.hat stlsoft.dot.org> writes:
"J C Calvarese" <jcc7 cox.net> wrote in message
news:bvpcqp$1luh$1 digitaldaemon.com...
 Carlos Santander B. wrote:
 Today I was playing a bit trying to create an excel file (workbook) by
 writing code. First, I started with VB6, since I had done it before.
Then,
 after burning I don't how many zillions of neurons, I managed to do the
same

how
 to start in DMC or DMD. Can somebody please give me some pointers?

 -----------------------
 Carlos Santander Bernal
> In case you need a bit more of info, all I first want to do is > something > like this: > with (new Excel.Application()) { <snip> I'd like to be able to work with with COM in this way, too. I'm mostly interested in using DAO and ADODB, but I'd probably use the Microsoft Office apps through automation as well.
It's completely useless to your current requirements, but I also have an intention to use COM and D, both for rewriting and extending the shell extensions (http://shellext.com/) and also for automating word. Since I'm stupid enough to be starting another book next month, I'd love to be able to automatically create global indexes, and all kinds of other crap using tools written in D. I'll watch your collective efforts with interest, and hopefully I'll have time to contribute myself at some point.
Feb 03 2004
prev sibling parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
Carlos Santander B. wrote:
 Today I was playing a bit trying to create an excel file (workbook)
 by writing code. First, I started with VB6, since I had done it
 before. Then, after burning I don't how many zillions of neurons, I

 in VC++6, and I have no idea how to start in DMC or DMD. Can
 somebody please give me some pointers?
I managed to do it in D, but only with the help of the Apollo library. I don't know if that's a good idea, but it's a start. ----------------------- Carlos Santander Bernal
Feb 04 2004
parent reply J C Calvarese <jcc7 cox.net> writes:
Carlos Santander B. wrote:
 Carlos Santander B. wrote:
 
Today I was playing a bit trying to create an excel file (workbook)
by writing code. First, I started with VB6, since I had done it
before. Then, after burning I don't how many zillions of neurons, I

in VC++6, and I have no idea how to start in DMC or DMD. Can
somebody please give me some pointers?
I managed to do it in D, but only with the help of the Apollo library. I don't know if that's a good idea, but it's a start.
Sounds great to me. Did you have to write something in Delphi? I think anything would be good as a starting point. Please give me a hint as to what you did. I'm dying to know.
 
 -----------------------
 Carlos Santander Bernal
-- Justin http://jcc_7.tripod.com/d/
Feb 04 2004
parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
J C Calvarese wrote:
 Carlos Santander B. wrote:
 I managed to do it in D, but only with the help of the Apollo
 library. I don't know if that's a good idea, but it's a start.
Sounds great to me. Did you have to write something in Delphi? I think anything would be good as a starting point. Please give me a hint as to what you did. I'm dying to know.
Yes, it's the same idea as the Apollo library: pointers to Delphi objects. Then a DLL, a lib, the declarations, and use them. They're not wrapped inside classes yet because it was only a tryout. I can put the files online if you want. BTW, I could do the same in VC++ 6. Still waiting for VC++.NET to good behave ;). ----------------------- Carlos Santander Bernal
Feb 04 2004
parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
 J C Calvarese wrote:
 Sounds great to me. Did you have to write something in Delphi? I
 think anything would be good as a starting point. Please give me a
 hint as to what you did.  I'm dying to know.
Maybe I should explain something. Everything that's available for Delphi can be available for the Apollo library. That's both a blessing and a curse. A blessing because, as you know, Delphi is very popular and there're an incredible large of components for it. But a curse because to use them, there's always gonna be the need to write wrappers just like in Apollo: a dll in Delphi, import it as a DM lib, write function declarations (which can be easy anyway, considering there's del2d) and, if you want to give it proper use, write D classes around those functions, and then, just then, use the library, always depending on the dll. And most likely you're gonna end up depending on various dlls (suppose you're writing an oe clone: you'll need the Apollo dll, the dll for the outlook bar, dll for this, dll for that...). As you say, it's a starting point, but for what I think I'm gonna be doing, I don't think it's good enough. That's the reason I was playing with so many tools. ----------------------- Carlos Santander Bernal
Feb 04 2004
parent reply J C Calvarese <jcc7 cox.net> writes:
Carlos Santander B. wrote:
J C Calvarese wrote:

Sounds great to me. Did you have to write something in Delphi? I
think anything would be good as a starting point. Please give me a
hint as to what you did.  I'm dying to know.
Maybe I should explain something. Everything that's available for Delphi can be available for the Apollo library. That's both a blessing and a curse. A blessing because, as you know, Delphi is very popular and there're an incredible large of components for it. But a curse because to use them, there's always gonna be the need to write wrappers just like in Apollo: a dll in Delphi, import it as a DM lib, write function declarations (which can be easy anyway, considering there's del2d) and, if you want to give it proper use, write D classes around those functions, and then, just then, use the library, always depending on the dll. And most likely you're gonna end up depending on various dlls (suppose you're writing an oe clone: you'll need the Apollo dll, the dll for the outlook bar, dll for this, dll for that...). As you say, it's a starting point, but for what I think I'm gonna be doing, I don't think it's good enough. That's the reason I was playing with so many tools.
There are always trade-offs. As hard drive sizes continue to increase, programmers tend to create bigger programs. In theory, it should be possible to write good programs that are only 100 KB, but what's the big deal if it's a megabyte or two? Disk space is cheap. I'm in favor of optimizing and getting the bloat out, but don't beat yourself up if you think your library weighs too much. And, yes, I'd like to see your code for the COM thing. But I'm not in a hurry. Whenever you're not busy...
 
 -----------------------
 Carlos Santander Bernal
-- Justin http://jcc_7.tripod.com/d/
Feb 04 2004
parent "Carlos Santander B." <carlos8294 msn.com> writes:
J C Calvarese wrote:
 And, yes, I'd like to see your code for the COM thing. But I'm not
 in a hurry. Whenever you're not busy...
Check out the other forums (http://s3.invisionfree.com/ln5yrestgv), there're instructions. ----------------------- Carlos Santander Bernal
Feb 04 2004