Manipulating Excel with Netrexx and Jacob

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Manipulating Excel with Netrexx and Jacob

measel

KP, I’ve used Netrexx with the Jacob (java<->com) libraries to control excel and a number of other com thingies.  Once you get the basics, it’s quite fun to use nrx to do the dll dance.

 

To compile it you need the Jacob.jar in your classpath.  To execute, you need that jar on the classpath and the Jacob.dll files in the local directory or your system32.

 

Jacob download - http://sourceforge.net/projects/jacob-project/

 

/* getexcel.nrx -- excel manipulation with jacob and netrexx -  M.Measel - one hot day in August of 11   */ 

 

import com.jacob.com.

import com.jacob.activeX.

 

class getexcel

             

              activeSheet = ActiveXcomponent

 

method main(argstr = String[]) static public

             

              getexcel()

             

method getexcel()

              true = boolean 1                                                         

        false = boolean 0

        de = DispatchEvents

             

              ComThread.InitSTA(true)                                                                     -- Initialize the current java thread to be an STA COM Apartment

                                                                                                                                  -- if createMainSTA  parameter is true, create a separate MainSTA thread that will house all Apartment Threaded components

              do

                            

                             excelApp = ActiveXComponent("Excel.Application")                            -- get an excel object

                            

                                 excelApp.setProperty("Visible", true)                                                -- we want to watch

                                 

                             workbooks = excelApp.getPropertyAsComponent("Workbooks")                 -- getPropertyAsComponent gives us an activexobject rather than a variant

                            

                                workbookAsVariant = workbooks.invoke("Open", "C:\\test1.xls")              -- here we use invoke on the workbooks object to open an existing file

                                                                                                                                                                -- and a variant is returned

                                workbookDispatch = workbookAsVariant.getDispatch()                                 -- get the variant to a dispatch

                                workbook = ActiveXComponent(workbookDispatch)                                      -- make an activeX object from the dispatch

                                     --say workbook

                                    

                                 say "Name: " workbook.getProperty("Name")                                                                   -- now we can get and set with our object

                                

                                 activeSheet = workbook.getPropertyAsComponent("ActiveSheet")                       -- now lets get the activesheet object from the workbook

                                

                                 say "The active sheet is " activeSheet.getProperty("Name")

                                

                                                                                                                                                                                          

                                  a1rv = activeSheet.invoke("Range","(A1)")                                                      -- set a range on the active sheet

                                  a1d = a1rv.getDispatch()

                                  CellA1 = ActiveXComponent(a1d)                                                                -- now we have a named range object                                                                                                                                    

                                 

                                 CellA1.setProperty("Value","123")                                                              -- insert a value in the cell

                                 

                                   say "A1 = " CellA1.getProperty("Value")

                                 

                                  CellA2 = rangeX("(A2)" )                                  -- rangeX method to simplify getting range objects 

                                  

                                   say " has formula = " CellA2.getProperty("HasFormula")

                                

                                   RangeB1B2 = rangeX("(B1,B2)")

                                

                                  RangeB1B2.setProperty("Value","Hello World")

                                  rID = RangeB1B2.getProperty("Address")

                                  say rID || "=" || RangeB1B2.getProperty("Text")

                                

                              say "press enter to continue"    

                             pause = ask       

                            

                            

                             workbook.invoke("Save")

                             excelApp.invoke("Quit")

                            

                             catch e1 = ComException

                                           say e1

              end

             

              ComThread.Release                                                 -- cleanup 

              ComThread.quitMainSTA

             

             

method rangeX(range = String ) returns ActiveXComponent

              rVariant = activeSheet.invoke("Range", range)

        rDispatch = rVariant.getDispatch()

        ActiveXC = ActiveXComponent(rDispatch)

        return ActiveXC

 

class errEvents

              method Error(arge = Variant[])

                             say arge

             

             

/*

Uses these activeX objects via COM calls

    Excel Application -         The host Excel application is the top container for all Excel ActiveX Objects.

    Workbooks, Workbook and Worksheet

        Each .XLS file was called as workbook in Excel. The collection of workbooks will be the workbooks because we can open many .XLS file within one Excel session. Normally, a workbook can contain one or more worksheets.

    Range

        Cells in worksheet are called as "Range", the "Range" object can be one single cell, some cells or even all cells in the worksheet.

        Each range has a Cell Address string, if it is a single cell, the address may be a string like "B12", if the range contain so many cells or the Range is a single but merged cell, the address will be the combination of the LeftTop and RightBotton Single cell ID such  as "B1:F12".

*/


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Manipulating Excel with Netrexx and Jacob

Fernando Cassia-2
On Sun, Aug 14, 2011 at 11:16, Measel, Mike <[hidden email]> wrote:
> KP, I’ve used Netrexx with the Jacob (java<->com) libraries to control excel
> and a number of other com thingies.  Once you get the basics, it’s quite fun
> to use nrx to do the dll dance.


Nice approach, thanks for sharing it. But why depend on Microsoft's
Office and ActiveX when you can use OpenOffice.org?

http://api.openoffice.org/

http://cld.blog-city.com/java_and_openofficestaroffice__an_example.htm

http://codesnippets.services.openoffice.org/Calc/ooRexx.xml
FC

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Manipulating Excel with Netrexx and Jacob

ThSITC
In reply to this post by measel
Hello Mike,
   1.) thought you did unsubscribe this list, maybe my memory is wong?
   2.) Good to have you here, anyway :-)
   3.) Many thanks for you hint with jacob!
        that's a really interesting approach :-)

**************************************************************************************
Hello Rene, and all,

May I *strongly suggest* that we setup a LINK from org.netrexx to this jacob approach & software, please! Whil'st I've not tried it, I think it's worthwhile to
inform NetRexx user's of this possibility as well....
**************************************************************************************

Best regards,
Thomas.
=========================================================

.
 
Am 14.08.2011 16:16, schrieb Measel, Mike:

KP, I’ve used Netrexx with the Jacob (java<->com) libraries to control excel and a number of other com thingies.  Once you get the basics, it’s quite fun to use nrx to do the dll dance.

 

To compile it you need the Jacob.jar in your classpath.  To execute, you need that jar on the classpath and the Jacob.dll files in the local directory or your system32.

 

Jacob download - http://sourceforge.net/projects/jacob-project/

 

/* getexcel.nrx -- excel manipulation with jacob and netrexx -  M.Measel - one hot day in August of 11   */ 

 

import com.jacob.com.

import com.jacob.activeX.

 

class getexcel

             

              activeSheet = ActiveXcomponent

 

method main(argstr = String[]) static public

             

              getexcel()

             

method getexcel()

              true = boolean 1                                                         

        false = boolean 0

        de = DispatchEvents

             

              ComThread.InitSTA(true)                                                                     -- Initialize the current java thread to be an STA COM Apartment

                                                                                                                                  -- if createMainSTA  parameter is true, create a separate MainSTA thread that will house all Apartment Threaded components

              do

                            

                             excelApp = ActiveXComponent("Excel.Application")                            -- get an excel object

                            

                                 excelApp.setProperty("Visible", true)                                                -- we want to watch

                                 

                             workbooks = excelApp.getPropertyAsComponent("Workbooks")                 -- getPropertyAsComponent gives us an activexobject rather than a variant

                            

                                workbookAsVariant = workbooks.invoke("Open", "C:\\test1.xls")              -- here we use invoke on the workbooks object to open an existing file

                                                                                                                                                                -- and a variant is returned

                                workbookDispatch = workbookAsVariant.getDispatch()                                 -- get the variant to a dispatch

                                workbook = ActiveXComponent(workbookDispatch)                                      -- make an activeX object from the dispatch

                                     --say workbook

                                    

                                 say "Name: " workbook.getProperty("Name")                                                                   -- now we can get and set with our object

                                

                                 activeSheet = workbook.getPropertyAsComponent("ActiveSheet")                       -- now lets get the activesheet object from the workbook

                                

                                 say "The active sheet is " activeSheet.getProperty("Name")

                                

                                                                                                                                                                                          

                                  a1rv = activeSheet.invoke("Range","(A1)")                                                      -- set a range on the active sheet

                                  a1d = a1rv.getDispatch()

                                  CellA1 = ActiveXComponent(a1d)                                                                -- now we have a named range object                                                                                                                                    

                                 

                                 CellA1.setProperty("Value","123")                                                              -- insert a value in the cell

                                 

                                   say "A1 = " CellA1.getProperty("Value")

                                 

                                  CellA2 = rangeX("(A2)" )                                  -- rangeX method to simplify getting range objects 

                                  

                                   say " has formula = " CellA2.getProperty("HasFormula")

                                

                                   RangeB1B2 = rangeX("(B1,B2)")

                                

                                  RangeB1B2.setProperty("Value","Hello World")

                                  rID = RangeB1B2.getProperty("Address")

                                  say rID || "=" || RangeB1B2.getProperty("Text")

                                

                              say "press enter to continue"    

                             pause = ask       

                            

                            

                             workbook.invoke("Save")

                             excelApp.invoke("Quit")

                            

                             catch e1 = ComException

                                           say e1

              end

             

              ComThread.Release                                                 -- cleanup 

              ComThread.quitMainSTA

             

             

method rangeX(range = String ) returns ActiveXComponent

              rVariant = activeSheet.invoke("Range", range)

        rDispatch = rVariant.getDispatch()

        ActiveXC = ActiveXComponent(rDispatch)

        return ActiveXC

 

class errEvents

              method Error(arge = Variant[])

                             say arge

             

             

/*

Uses these activeX objects via COM calls

    Excel Application -         The host Excel application is the top container for all Excel ActiveX Objects.

    Workbooks, Workbook and Worksheet

        Each .XLS file was called as workbook in Excel. The collection of workbooks will be the workbooks because we can open many .XLS file within one Excel session. Normally, a workbook can contain one or more worksheets.

    Range

        Cells in worksheet are called as "Range", the "Range" object can be one single cell, some cells or even all cells in the worksheet.

        Each range has a Cell Address string, if it is a single cell, the address may be a string like "B12", if the range contain so many cells or the Range is a single but merged cell, the address will be the combination of the LeftTop and RightBotton Single cell ID such  as "B1:F12".

*/

_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


--
Thomas Schneider (www.thsitc.com)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

RE: Manipulating Excel with Netrexx and Jacob

measel

Fernando, I did excel because of KP Kirchdoefer’s earlier question about manipulating excel from Netrexx.   

 

As for StarOffice, it’s java so to talk to it you use it’s java interfaces:

 

http://api.openoffice.org/docs/java/ref/overview-summary.html

 

Maybe you could make us an example.  I would but I don’t have staroffice installed.

 

From: Thomas Schneider [mailto:[hidden email]]
Sent: Monday, August 15, 2011 9:58 AM
To: IBM Netrexx
Cc: Measel, Mike; [hidden email]
Subject: Re: [Ibm-netrexx] Manipulating Excel with Netrexx and Jacob

 

Hello Mike,
   1.) thought you did unsubscribe this list, maybe my memory is wong?
   2.) Good to have you here, anyway :-)
   3.) Many thanks for you hint with jacob!
        that's a really interesting approach :-)

**************************************************************************************
Hello Rene, and all,

May I *strongly suggest* that we setup a LINK from org.netrexx to this jacob approach & software, please! Whil'st I've not tried it, I think it's worthwhile to
inform NetRexx user's of this possibility as well....
**************************************************************************************

Best regards,
Thomas.
=========================================================

.
 
Am 14.08.2011 16:16, schrieb Measel, Mike:

KP, I’ve used Netrexx with the Jacob (java<->com) libraries to control excel and a number of other com thingies.  Once you get the basics, it’s quite fun to use nrx to do the dll dance.

 

To compile it you need the Jacob.jar in your classpath.  To execute, you need that jar on the classpath and the Jacob.dll files in the local directory or your system32.

 

Jacob download - http://sourceforge.net/projects/jacob-project/

 

/* getexcel.nrx -- excel manipulation with jacob and netrexx -  M.Measel - one hot day in August of 11   */ 

 

import com.jacob.com.

import com.jacob.activeX.

 

class getexcel

             

              activeSheet = ActiveXcomponent

 

method main(argstr = String[]) static public

             

              getexcel()

             

method getexcel()

              true = boolean 1                                                         

        false = boolean 0

        de = DispatchEvents

             

              ComThread.InitSTA(true)                                                                     -- Initialize the current java thread to be an STA COM Apartment

                                                                                                                                  -- if createMainSTA  parameter is true, create a separate MainSTA thread that will house all Apartment Threaded components

              do

                            

                             excelApp = ActiveXComponent("Excel.Application")                            -- get an excel object

                            

                                 excelApp.setProperty("Visible", true)                                                -- we want to watch

                                 

                             workbooks = excelApp.getPropertyAsComponent("Workbooks")                 -- getPropertyAsComponent gives us an activexobject rather than a variant

                            

                                workbookAsVariant = workbooks.invoke("Open", "C:\\test1.xls")              -- here we use invoke on the workbooks object to open an existing file

                                                                                                                                                                -- and a variant is returned

                                workbookDispatch = workbookAsVariant.getDispatch()                                 -- get the variant to a dispatch

                                workbook = ActiveXComponent(workbookDispatch)                                      -- make an activeX object from the dispatch

                                     --say workbook

                                    

                                 say "Name: " workbook.getProperty("Name")                                                                   -- now we can get and set with our object

                                

                                 activeSheet = workbook.getPropertyAsComponent("ActiveSheet")                       -- now lets get the activesheet object from the workbook

                                

                                 say "The active sheet is " activeSheet.getProperty("Name")

                                

                                                                                                                                                                                          

                                  a1rv = activeSheet.invoke("Range","(A1)")                                                      -- set a range on the active sheet

                                  a1d = a1rv.getDispatch()

                                  CellA1 = ActiveXComponent(a1d)                                                                -- now we have a named range object                                                                                                                                    

                                 

                                 CellA1.setProperty("Value","123")                                                              -- insert a value in the cell

                                 

                                   say "A1 = " CellA1.getProperty("Value")

                                 

                                  CellA2 = rangeX("(A2)" )                                  -- rangeX method to simplify getting range objects 

                                  

                                   say " has formula = " CellA2.getProperty("HasFormula")

                                

                                   RangeB1B2 = rangeX("(B1,B2)")

                                

                                  RangeB1B2.setProperty("Value","Hello World")

                                  rID = RangeB1B2.getProperty("Address")

                                  say rID || "=" || RangeB1B2.getProperty("Text")

                                

                              say "press enter to continue"    

                             pause = ask       

                            

                            

                             workbook.invoke("Save")

                             excelApp.invoke("Quit")

                            

                             catch e1 = ComException

                                           say e1

              end

             

              ComThread.Release                                                 -- cleanup 

              ComThread.quitMainSTA

             

             

method rangeX(range = String ) returns ActiveXComponent

              rVariant = activeSheet.invoke("Range", range)

        rDispatch = rVariant.getDispatch()

        ActiveXC = ActiveXComponent(rDispatch)

        return ActiveXC

 

class errEvents

              method Error(arge = Variant[])

                             say arge

             

             

/*

Uses these activeX objects via COM calls

    Excel Application -         The host Excel application is the top container for all Excel ActiveX Objects.

    Workbooks, Workbook and Worksheet

        Each .XLS file was called as workbook in Excel. The collection of workbooks will be the workbooks because we can open many .XLS file within one Excel session. Normally, a workbook can contain one or more worksheets.

    Range

        Cells in worksheet are called as "Range", the "Range" object can be one single cell, some cells or even all cells in the worksheet.

        Each range has a Cell Address string, if it is a single cell, the address may be a string like "B12", if the range contain so many cells or the Range is a single but merged cell, the address will be the combination of the LeftTop and RightBotton Single cell ID such  as "B1:F12".

*/

 
 
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
 

 

--
Thomas Schneider (www.thsitc.com)


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Manipulating Excel with Netrexx and Jacob

ThSITC
Hello Mike,
   I'm bloody Thomas Schneider, *not* Fernando, and I do have staroffice NOT installed either, currently, as I'm still an ancient MS Windows XP user,
and also IBM's zOS PL/I, COBOL, and a couple of other languages ;-).

But MAYBE Rony Flatscher, or some other's, having StarOffice, could help ??

From the very valuable LINK below, Mike did provide, I do have a *suggestion*, however, for both www.REXXLA.org *and* www.netrexx.org 

**************************************************************************************
We should setup somthing like a SPREAD-SHEET of *useful LINKS*,
with a TOPIC and the LINK (maybe using Mike Cowlishaw's  excellent MemoWiki ??????

*on both home-pages*

That might be really helpfui to demonstrate the concerted power of all those
Rexx Dialect's present currently to the community  :-) :-) :-)

**************************************************************************************
kind regards from dark Vienna,

Thomas Schneider (author of Rexx2Nrx, DB-123, PP, ReyC (never yet released), etc ............................... ;-)
*************************************************************************************
Am 15.08.2011 20:13, schrieb Measel, Mike:

Fernando, I did excel because of KP Kirchdoefer’s earlier question about manipulating excel from Netrexx.   

 

As for StarOffice, it’s java so to talk to it you use it’s java interfaces:

 

http://api.openoffice.org/docs/java/ref/overview-summary.html

 

Maybe you could make us an example.  I would but I don’t have staroffice installed.

 

From: Thomas Schneider [[hidden email]]
Sent: Monday, August 15, 2011 9:58 AM
To: IBM Netrexx
Cc: Measel, Mike; [hidden email]
Subject: Re: [Ibm-netrexx] Manipulating Excel with Netrexx and Jacob

 

Hello Mike,
   1.) thought you did unsubscribe this list, maybe my memory is wong?
   2.) Good to have you here, anyway :-)
   3.) Many thanks for you hint with jacob!
        that's a really interesting approach :-)

**************************************************************************************
Hello Rene, and all,

May I *strongly suggest* that we setup a LINK from org.netrexx to this jacob approach & software, please! Whil'st I've not tried it, I think it's worthwhile to
inform NetRexx user's of this possibility as well....
**************************************************************************************

Best regards,
Thomas.
=========================================================

.
 
Am 14.08.2011 16:16, schrieb Measel, Mike:

KP, I’ve used Netrexx with the Jacob (java<->com) libraries to control excel and a number of other com thingies.  Once you get the basics, it’s quite fun to use nrx to do the dll dance.

 

To compile it you need the Jacob.jar in your classpath.  To execute, you need that jar on the classpath and the Jacob.dll files in the local directory or your system32.

 

Jacob download - http://sourceforge.net/projects/jacob-project/

 

/* getexcel.nrx -- excel manipulation with jacob and netrexx -  M.Measel - one hot day in August of 11   */ 

 

import com.jacob.com.

import com.jacob.activeX.

 

class getexcel

             

              activeSheet = ActiveXcomponent

 

method main(argstr = String[]) static public

             

              getexcel()

             

method getexcel()

              true = boolean 1                                                         

        false = boolean 0

        de = DispatchEvents

             

              ComThread.InitSTA(true)                                                                     -- Initialize the current java thread to be an STA COM Apartment

                                                                                                                                  -- if createMainSTA  parameter is true, create a separate MainSTA thread that will house all Apartment Threaded components

              do

                            

                             excelApp = ActiveXComponent("Excel.Application")                            -- get an excel object

                            

                                 excelApp.setProperty("Visible", true)                                                -- we want to watch

                                 

                             workbooks = excelApp.getPropertyAsComponent("Workbooks")                 -- getPropertyAsComponent gives us an activexobject rather than a variant

                            

                                workbookAsVariant = workbooks.invoke("Open", "C:\\test1.xls")              -- here we use invoke on the workbooks object to open an existing file

                                                                                                                                                                -- and a variant is returned

                                workbookDispatch = workbookAsVariant.getDispatch()                                 -- get the variant to a dispatch

                                workbook = ActiveXComponent(workbookDispatch)                                      -- make an activeX object from the dispatch

                                     --say workbook

                                    

                                 say "Name: " workbook.getProperty("Name")                                                                   -- now we can get and set with our object

                                

                                 activeSheet = workbook.getPropertyAsComponent("ActiveSheet")                       -- now lets get the activesheet object from the workbook

                                

                                 say "The active sheet is " activeSheet.getProperty("Name")

                                

                                                                                                                                                                                          

                                  a1rv = activeSheet.invoke("Range","(A1)")                                                      -- set a range on the active sheet

                                  a1d = a1rv.getDispatch()

                                  CellA1 = ActiveXComponent(a1d)                                                                -- now we have a named range object                                                                                                                                    

                                 

                                 CellA1.setProperty("Value","123")                                                              -- insert a value in the cell

                                 

                                   say "A1 = " CellA1.getProperty("Value")

                                 

                                  CellA2 = rangeX("(A2)" )                                  -- rangeX method to simplify getting range objects 

                                  

                                   say " has formula = " CellA2.getProperty("HasFormula")

                                

                                   RangeB1B2 = rangeX("(B1,B2)")

                                

                                  RangeB1B2.setProperty("Value","Hello World")

                                  rID = RangeB1B2.getProperty("Address")

                                  say rID || "=" || RangeB1B2.getProperty("Text")

                                

                              say "press enter to continue"    

                             pause = ask       

                            

                            

                             workbook.invoke("Save")

                             excelApp.invoke("Quit")

                            

                             catch e1 = ComException

                                           say e1

              end

             

              ComThread.Release                                                 -- cleanup 

              ComThread.quitMainSTA

             

             

method rangeX(range = String ) returns ActiveXComponent

              rVariant = activeSheet.invoke("Range", range)

        rDispatch = rVariant.getDispatch()

        ActiveXC = ActiveXComponent(rDispatch)

        return ActiveXC

 

class errEvents

              method Error(arge = Variant[])

                             say arge

             

             

/*

Uses these activeX objects via COM calls

    Excel Application -         The host Excel application is the top container for all Excel ActiveX Objects.

    Workbooks, Workbook and Worksheet

        Each .XLS file was called as workbook in Excel. The collection of workbooks will be the workbooks because we can open many .XLS file within one Excel session. Normally, a workbook can contain one or more worksheets.

    Range

        Cells in worksheet are called as "Range", the "Range" object can be one single cell, some cells or even all cells in the worksheet.

        Each range has a Cell Address string, if it is a single cell, the address may be a string like "B12", if the range contain so many cells or the Range is a single but merged cell, the address will be the combination of the LeftTop and RightBotton Single cell ID such  as "B1:F12".

*/

 
 
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
 

 

--
Thomas Schneider (www.thsitc.com)



--
Thomas Schneider (www.thsitc.com)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: Manipulating Excel with Netrexx and Jacob

Fernando Cassia-2
In reply to this post by measel
On Mon, Aug 15, 2011 at 15:13, Measel, Mike <[hidden email]> wrote:
> Fernando, I did excel because of KP Kirchdoefer’s earlier question about
> manipulating excel from Netrexx.

My point was that OpenOffice opens excel files just fine.

And StarOffice was the commercial build by Sun of OpenOffice.org, with
commercial support.

It´s the same code. Oracle renamed it "Oracle Open Office" shortly
before the LibreOffice fork that led to the killing of the product and
the firing of all paid devs.

Luckily it will live on as Apache OpenOffice
FC

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Manipulating Excel with Netrexx and Jacob

KP Kirchdörfer
In reply to this post by Fernando Cassia-2

Mike;

 

Am Sonntag, 14. August 2011, 19:11:59 schrieb Fernando Cassia:

> On Sun, Aug 14, 2011 at 11:16, Measel, Mike <[hidden email]> wrote:

> > KP, I’ve used Netrexx with the Jacob (java<->com) libraries to control

> > excel and a number of other com thingies.  Once you get the basics, it’s

> > quite fun to use nrx to do the dll dance.

 

Thanks very much for the hint and extensive example - I'll look into jacob.

Sadly it seems to misses a javadoc, or did I miss it?.

 

> Nice approach, thanks for sharing it. But why depend on Microsoft's

> Office and ActiveX when you can use OpenOffice.org?

 

Fernando;

 

The documents I have to deal with, *are* Excel files and this won't change in the foreseeable future - I have no choice and can't change the direction of two entities.

 

kp


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Manipulating Excel with Netrexx and Jacob

Fernando Cassia-2
On Mon, Aug 15, 2011 at 15:54, KP Kirchdoerfer <[hidden email]> wrote:
> Fernando;
>
>
>
> The documents I have to deal with, *are* Excel files and this won't change
> in the foreseeable future - I have no choice and can't change the direction
> of two entities.

It seems I have not explained myself well. OpenOffice.org opens and
saves XLS files just fine. Just a different tool, to read and save the
same excel files, but without having to pay a license to Microsoft for
the Office suite.

What part am I missing?.

FC
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

RE: Manipulating Excel with Netrexx and Jacob

measel
In reply to this post by KP Kirchdörfer

KP, you shouldn’t need anything beyond what’s in the example, but there are javadocs in the Jacob download.  There’s invoke, set, and get.  That’s about it.

 

For others interested in how to control excel and other things like IE, Word and .Net, you can open any of these from the object browser within vb or excel.  In Excel, press ALT+F11, then F2.

This will show you all the methods and properties that you can use from the various components.

For things not listed you can right click and select “add reference”, which opens a search window where you can pick a dll or typelib to view.

 

 

 

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of KP Kirchdoerfer
Sent: Monday, August 15, 2011 1:54 PM
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Manipulating Excel with Netrexx and Jacob

 

Mike;

 

Am Sonntag, 14. August 2011, 19:11:59 schrieb Fernando Cassia:

> On Sun, Aug 14, 2011 at 11:16, Measel, Mike <[hidden email]> wrote:

> > KP, I’ve used Netrexx with the Jacob (java<->com) libraries to control

> > excel and a number of other com thingies.  Once you get the basics, it’s

> > quite fun to use nrx to do the dll dance.

 

Thanks very much for the hint and extensive example - I'll look into jacob.

Sadly it seems to misses a javadoc, or did I miss it?.

 

> Nice approach, thanks for sharing it. But why depend on Microsoft's

> Office and ActiveX when you can use OpenOffice.org?

 

Fernando;

 

The documents I have to deal with, *are* Excel files and this won't change in the foreseeable future - I have no choice and can't change the direction of two entities.

 

kp


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Manipulating Excel with Netrexx and Jacob

KP Kirchdörfer
In reply to this post by Fernando Cassia-2

Am Montag, 15. August 2011, 21:38:26 schrieben Sie:

> On Mon, Aug 15, 2011 at 15:54, KP Kirchdoerfer <[hidden email]> wrote:

> > Fernando;

> >

> >

> >

> > The documents I have to deal with, *are* Excel files and this won't

> > change in the foreseeable future - I have no choice and can't change the

> > direction of two entities.

>

> It seems I have not explained myself well. OpenOffice.org opens and

> saves XLS files just fine. Just a different tool, to read and save the

> same excel files, but without having to pay a license to Microsoft for

> the Office suite.

>

> What part am I missing?.

 

Ok, I got it (finally).

 

I missed to explain, that it might be difficult to get permission to install OO.org in the corporate environment - though that's true for jvm, netrexxR/C and jacob as well :(

 

 

kp


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

RE: Manipulating Excel with Netrexx and Jacob

measel

Fernando, the other thing is that with this technique you can manipulate any COM+ application from NetRexx, not just excel.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of KP Kirchdoerfer
Sent: Tuesday, August 16, 2011 1:57 PM
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Manipulating Excel with Netrexx and Jacob

 

Am Montag, 15. August 2011, 21:38:26 schrieben Sie:

> On Mon, Aug 15, 2011 at 15:54, KP Kirchdoerfer <[hidden email]> wrote:

> > Fernando;

> >

> >

> >

> > The documents I have to deal with, *are* Excel files and this won't

> > change in the foreseeable future - I have no choice and can't change the

> > direction of two entities.

>

> It seems I have not explained myself well. OpenOffice.org opens and

> saves XLS files just fine. Just a different tool, to read and save the

> same excel files, but without having to pay a license to Microsoft for

> the Office suite.

>

> What part am I missing?.

 

Ok, I got it (finally).

 

I missed to explain, that it might be difficult to get permission to install OO.org in the corporate environment - though that's true for jvm, netrexxR/C and jacob as well :(

 

 

kp


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Manipulating Excel with Netrexx and Jacob

Fernando Cassia-2
On Tue, Aug 16, 2011 at 16:29, Measel, Mike <[hidden email]> wrote:
> Fernando, the other thing is that with this technique you can manipulate any
> COM+ application from NetRexx, not just excel.

I never said such technique wasnt useful or interesting. I just wanted
to point out that there is a SDK for Java development and interfacing
with OpenOffice.org which would achieve the Excel read/write without
having to pay the cost of a MS Office license, and remain
cross-platform (at least on all platforms where OO.o is available).

FC

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/