Hi,

i don't know where you get this example from but it is not from the SDK. You should take a look on the C# samples coming with the SDK to get impression how it works.

If you want to specify properties (MediaDescriptor) for loadComponentFromURL you should set the myArgs[0].Value as well . If you don't want to specify any properties you shouldn't create a new sequence with length 1 but no element.

Juergen

On 12/25/09 4:07 AM, 国华 曾 wrote:
hello:
      when I got the OpenOffice SDK from the master openoffice Page and Used 
it,however the program  was wrong !Oh,MyGold!I don't kown  how to deal with it 
!so,can you help me!

program:

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:/test.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;
  error:
      the red line  is error :Return argument has an invalid type

   Thank you very much!


       ___________________________________________________________
   好玩贺卡等你发,邮箱贺卡全新上线!
http://card.mail.cn.yahoo.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to