*/
public void testSafeArrayViaExcel() {
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
try {
Dispatch cell;
SafeArray sAProdText;
Dispatch workbooks = xl.getProperty("Workbooks").toDispatch();
System.out.println("have workbooks");
Dispatch workbook = Dispatch.call(
workbooks,
"Open",
getWindowsFilePathToPackageResource(
"SafeArrayViaExcel.xls", this.getClass()))
.toDispatch();
System.out.println("Opened File - SafeArrayViaExcel.xls\n");
Dispatch sheet = Dispatch.get(workbook, "ActiveSheet").toDispatch();
cell = Dispatch.invoke(sheet, "Range", Dispatch.Get,
new Object[] { "A1:D1000" }, new int[1]).toDispatch();
System.out.println("have cell:" + cell);
sAProdText = Dispatch.get(cell, "Value").toSafeArray();
System.out.println("sa: dim=" + sAProdText.getNumDim());