為什麽我在用c#操作時,紅色部份代碼總是報:傳回的引數具有無效的型別。
using unoidl.com.sun.star.lang;
using unoidl.com.sun.star.beans;
using unoidl.com.sun.star.uno;
using unoidl.com.sun.star.frame;
using unoidl.com.sun.star.table;
using unoidl.com.sun.star.sheet;
using unoidl.com.sun.star.container;
XComponentContext xContext = uno.util.Bootstrap.bootstrap();
XMultiServiceFactory xFactory = (XMultiServiceFactory)xContext.getServiceManager();
XComponentLoader xLoader = (XComponentLoader)xFactory.createInstance("com.sun.star.frame.Desktop");
// PropertyValue[] myArgs = new PropertyValue[1];
// myArgs[0] = new PropertyValue();
// myArgs[0].Name = "Hidden";
XComponent xComponent = xLoader.loadComponentFromURL("file:///C:/江西帳號(B0F6).ods", "_blank", 0,new PropertyValue[1]);
XSpreadsheetDocument xSheetDocument = (XSpreadsheetDocument)xComponent;
XSpreadsheets xSheets = xSheetDocument.getSheets();
XIndexAccess xAccess = (XIndexAccess)xSheets;
XSpreadsheet xSheet = (XSpreadsheet)xAccess.getByIndex(0).Value;
不知道該怎麼解決,有哪位知道的大俠告訴我一下,是什麽原因,謝謝了!
XComponent xComponent = xLoader.loadComponentFromURL("file:///C:/江西帳號(B0F6).ods", "_blank", 0,new PropertyValue[1]);
不知道是不是最後一個參數的問題,new PropertyValue[] { }這樣的空數組