Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 03, 2004 com, excel, guid... | ||||
---|---|---|---|---|
| ||||
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 in Delphi and VC#, however I couldn't do it in VC++6, and I have no idea how to start in DMC or DMD. Can somebody please give me some pointers? ----------------------- Carlos Santander Bernal |
February 03, 2004 Re: com, excel, guid... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | 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 in Delphi and VC#, however I couldn't do it 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
|
February 04, 2004 Re: com, excel, guid... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | 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 > in Delphi and VC#, however I couldn't do it in VC++6, and I have no idea 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. 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/ |
February 04, 2004 Re: com, excel, guid... | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | "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 > > in Delphi and VC#, however I couldn't do it in VC++6, and I have no idea 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. |
February 04, 2004 Re: com, excel, guid... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | 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 managed to do the same in Delphi and VC#, however I couldn't do it 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 > > |
February 04, 2004 Re: com, excel, guid... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | 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 in Delphi and VC#, however I couldn't do it 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
|
February 04, 2004 Re: com, excel, guid... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Clint Olson | 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
|
February 04, 2004 Re: com, excel, guid... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | 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. |
February 05, 2004 Re: com, excel, guid... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | 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 >>managed to do the same in Delphi and VC#, however I couldn't do it >>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/ |
February 05, 2004 Re: com, excel, guid... | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | 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
|
Copyright © 1999-2021 by the D Language Foundation