Meikel > (def c (.. Dispatch (call ws "Cells" 1 1) (toDispatch))) > Here you retrieve the actual cell.
If I have file "hello.xls" already and I have say 'Emeka at Cell 1 1, using the above line could I get 'Emeka . Regards, Emeka On Sun, May 17, 2009 at 8:06 PM, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi Emeka, > > Am 17.05.2009 um 21:59 schrieb janus: > > I can't figure out how to read cells with Jacob. I need a help. >> > > I'm totally sorry. I forgot to answer your pm. :| > > This is the example you quoted. And there you already have > the solution. > > (import '(com.jacob.com Dispatch ComThread)) >> >> (def xl (new Dispatch "Excel.Application")) >> > Start Excel. > > (def wbl (.. Dispatch (get xl "Workbooks") (toDispatch))) >> > Get the Workbooks collection. > > (def wb (.. Dispatch (call wbl "Add") (toDispatch))) >> > Add a new Workbook. > > (def wsl (.. Dispatch (get wb "Worksheets") (toDispatch))) >> > Get the Worksheets collection of the new Workbook. > > (def ws (.. Dispatch (call wsl "Item" 1) (toDispatch))) >> > Get the first Worksheet. (Probably "Sheet1") > > (def c (.. Dispatch (call ws "Cells" 1 1) (toDispatch))) >> > Here you retrieve the actual cell. > > (. Dispatch put c "Value" "Hello, World!") >> > Write "Hello, World!" into the cell. > > (. Dispatch call wb "SaveAs" "Hello.xls") >> > Save the Workbook... > > (. Dispatch call wb "Close" false) >> > ... and close it. > > (. Dispatch call xl "Quit") >> > Close Excel. > > (. ComThread Release) >> > And make sure it's really stopped. > > Hope that helps. > > Sincerely > Meikel > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---