This quick start guide creates java bindings to Excel and use those bindings to create an Excel spreadsheet containing "Hello World".
If you have not already done so, download jSegue from
SourceForge. Unzip the distribution. Download jSegue-2.0.0.394.zip
and install into C:/jSegue-2.0.0.394
.
Next create build.xml, an ant build script, to generate bindings to Excel. Use dispatch only based bindings so that you will not have to compile any JNI code.
Next run ant. You should see something similar to this output:
Buildfile: C:\cygwin\home\Hastings\wk-cga\jSegue\doc\quick-start\build.xml tlb-excel: [mkdir] Created dir: C:\cygwin\home\Hastings\wk-cga\jSegue\doc\quick-start\src\Office [mkdir] Created dir: C:\cygwin\home\Hastings\wk-cga\jSegue\doc\quick-start\src\VBIDE [mkdir] Created dir: C:\cygwin\home\Hastings\wk-cga\jSegue\doc\quick-start\src\Excel [exec] .\JavaAliasGen.cpp: skipping alias MsoRGBType [exec] Office method count: 1937 [exec] Office interface count: 240 [exec] Office enum count: 1439 [exec] VBIDE method count: 270 [exec] VBIDE interface count: 64 [exec] VBIDE enum count: 50 [exec] Excel method count: 13965 [exec] Excel interface count: 687 [exec] Excel enum count: 1544 all: BUILD SUCCESSFUL Total time: 53 seconds
Next import these java classes into Eclipse (or NetBeans or vi).
Write QuickStart.java. Run QuickStart
with the system property: -Dcom_moesol_bindings.library.path=C:/jSegue-2.0.0.394
.
When you run QuickStart
you should see Excel start with a
new work book that contains "Hello World"
in cell A1
.