Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
August 18, 2008 XLS Files | ||||
---|---|---|---|---|
| ||||
Is there easy way of to get access to *.xls files. To particular cells in sheets. I need to read some data from spreadsheet straight to my program. Thanks in advance. |
August 18, 2008 Re: XLS Files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zarathustra | Zarathustra <adam.chrapkowski@gmail.com> wrote: > Is there easy way of to get access to *.xls files. > To particular cells in sheets. > I need to read some data from spreadsheet straight to my program. > Thanks in advance. Under linux there are catdoc tools that can transform xls files into CSV (plain text, comma-separeted-values) which are easily parsable. No idea how to access such stuff under windows but I'd guess there should be a more elegant way there, at least if excel is installed on the machine that runs your program. Sorry if this doesn't help you ;) Henning -- GPG Public Key: http://pgpkeys.pca.dfn.de/pks/lookup?op=get&search=0x30C7FC378DB14BE5 |
August 19, 2008 Re: XLS Files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zarathustra | On Mon, 18 Aug 2008 03:35:52 -0400, Zarathustra <adam.chrapkowski@gmail.com> wrote:
>Is there easy way of to get access to *.xls files.
>To particular cells in sheets.
>I need to read some data from spreadsheet straight to my program.
>Thanks in advance.
As you can access COM objects from D, you could use Automation or whatever they call it now.
|
August 19, 2008 Re: XLS Files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Max Samukha | Max Samukha Wrote:
> On Mon, 18 Aug 2008 03:35:52 -0400, Zarathustra <adam.chrapkowski@gmail.com> wrote:
>
> >Is there easy way of to get access to *.xls files.
> >To particular cells in sheets.
> >I need to read some data from spreadsheet straight to my program.
> >Thanks in advance.
>
> As you can access COM objects from D, you could use Automation or whatever they call it now.
Reply to Max Samukha:
Could you tell me where can I find more information about this way?
|
August 19, 2008 Re: XLS Files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zarathustra | Try these (I'm not a COM developer, but these might get you started): http://msdn.microsoft.com/en-us/library/ms221375.aspx http://msdn.microsoft.com/en-us/library/aa272254%28office.11%29.aspx (lists Automation objects, from a high-level [VBA] point of view; adaptation should be possible, if a little tricky) HTH On 2008-08-19 01:10, Zarathustra spoke thusly: > Max Samukha Wrote: > >> On Mon, 18 Aug 2008 03:35:52 -0400, Zarathustra >> <adam.chrapkowski@gmail.com> wrote: >> >>> Is there easy way of to get access to *.xls files. >>> To particular cells in sheets. >>> I need to read some data from spreadsheet straight to my program. >>> Thanks in advance. >> As you can access COM objects from D, you could use Automation or >> whatever they call it now. > > Reply to Max Samukha: > > Could you tell me where can I find more information about this way? > |
August 19, 2008 Re: XLS Files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zarathustra | using DWin on Windows: http://www.dsource.org/projects/dwin/ here is an example from D China http://bbs.d-programming-language-china.org/thread-797-1-1.html import dwin.sys.win32.com.Core; import dwin.sys.win32.com.Client; import tango.io.Stdout; void main() { auto app = new DispatchObject("Excel.Application"); app.set("Visible",1); auto vbooks = app.get("Workbooks"); auto books = new DispatchObject(vbooks.pdispVal); auto vbook = books.get("Open", "d:\\200.xls"); \\打开此文件 auto book = new DispatchObject(vbook.pdispVal); auto vsheet = book.get("ActiveSheet"); auto sheet = new DispatchObject(vsheet.pdispVal); auto vrange = sheet.get("Range", "A1"); \\设定单元格 auto range = new DispatchObject(vrange.pdispVal); auto vvalue = range.get("Value"); \\读该设定的单位格的值 Stdout ( vvalue ).newline; \\ vvalue 是Variant结构体,为什么可直接输出成员变量的值 呢? } Zarathustra <adam.chrapkowski@gmail.com> wrote: > Max Samukha Wrote: > > > On Mon, 18 Aug 2008 03:35:52 -0400, Zarathustra <adam.chrapkowski@gmail.com> wrote: > > > > >Is there easy way of to get access to *.xls files. > > >To particular cells in sheets. > > >I need to read some data from spreadsheet straight to my program. > > >Thanks in advance. > > > > As you can access COM objects from D, you could use Automation or whatever they call it now. > > Reply to Max Samukha: > > Could you tell me where can I find more information about this way? > -- yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/ |
August 20, 2008 Re: XLS Files | ||||
---|---|---|---|---|
| ||||
Posted in reply to yidabu | Reply to yidabu:
Great it's working.
Thanks a lot.
yidabu Wrote:
>
> using DWin on Windows: http://www.dsource.org/projects/dwin/
>
> here is an example from D China http://bbs.d-programming-language-china.org/thread-797-1-1.html
>
> import dwin.sys.win32.com.Core;
> import dwin.sys.win32.com.Client;
> import tango.io.Stdout;
>
>
> void main()
> {
> auto app = new DispatchObject("Excel.Application");
>
> app.set("Visible",1);
>
> auto vbooks = app.get("Workbooks");
> auto books = new DispatchObject(vbooks.pdispVal);
>
> auto vbook = books.get("Open", "d:\\200.xls"); \\´ò¿ª´ËÎļþ
> auto book = new DispatchObject(vbook.pdispVal);
>
> auto vsheet = book.get("ActiveSheet");
> auto sheet = new DispatchObject(vsheet.pdispVal);
>
> auto vrange = sheet.get("Range", "A1"); \\É趨µ¥Ôª¸ñ
> auto range = new DispatchObject(vrange.pdispVal);
>
> auto vvalue = range.get("Value"); \\¶Á¸ÃÉ趨µÄµ¥Î»¸ñµÄÖµ
> Stdout ( vvalue ).newline; \\ vvalue ÊÇVariant½á¹¹Ì壬Ϊʲô¿ÉÖ±½ÓÊä³ö³ÉÔ±±äÁ¿µÄÖµ ÄØ£¿
>
> }
>
>
>
> Zarathustra <adam.chrapkowski@gmail.com> wrote:
>
> > Max Samukha Wrote:
> >
> > > On Mon, 18 Aug 2008 03:35:52 -0400, Zarathustra <adam.chrapkowski@gmail.com> wrote:
> > >
> > > >Is there easy way of to get access to *.xls files.
> > > >To particular cells in sheets.
> > > >I need to read some data from spreadsheet straight to my program.
> > > >Thanks in advance.
> > >
> > > As you can access COM objects from D, you could use Automation or whatever they call it now.
> >
> > Reply to Max Samukha:
> >
> > Could you tell me where can I find more information about this way?
> >
>
>
> --
> yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin
>
> D ÓïÑÔ-ÖÐÎÄ(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/
>
>
|
August 20, 2008 Re: XLS Files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zarathustra | That reminded me about an old win32 tutorial. Here is my favorite part: http://www.relisoft.com/win32/olerant.html |
August 24, 2008 Re: XLS Files | ||||
---|---|---|---|---|
| ||||
Posted in reply to yidabu | yidabu wrote:
> void main()
> {
> auto app = new DispatchObject("Excel.Application");
>
> app.set("Visible",1);
>
> auto vbooks = app.get("Workbooks");
> auto books = new DispatchObject(vbooks.pdispVal);
>
> auto vbook = books.get("Open", "d:\\200.xls");
> auto book = new DispatchObject(vbook.pdispVal);
>
> auto vsheet = book.get("ActiveSheet");
> auto sheet = new DispatchObject(vsheet.pdispVal);
>
> auto vrange = sheet.get("Range", "A1");
> auto range = new DispatchObject(vrange.pdispVal);
>
> auto vvalue = range.get("Value");
> Stdout ( vvalue ).newline;
> }
Wow! That example really shows the simplifications possible with auto! Looking up those type chains alone would have taken half an hour!
I'm really amazed!
Best Regards
Ingo Oeser
|
Copyright © 1999-2021 by the D Language Foundation