Greetings everyone again, i have another problem linked to UNOIDL library and C#.
I wrote this function
public static object[] Load_LO_calc_file_complete(string filePath, PropertyValue[] loadProps)
{
//==================================================
XComponentContext context = uno.util.Bootstrap.bootstrap();
XMultiComponentFactory xMSF = context.getServiceManager();
uno.Any[] argsArray = new uno.Any[] { new uno.Any(context)};
XDesktop desktop = (XDesktop)xMSF.createInstanceWithArgumentsAndContext("com.sun.star.frame.Desktop", argsArray, context);
XComponentLoader componentLoader = (XComponentLoader)desktop;
XComponent calcDoc = componentLoader.loadComponentFromURL("file:///" + filePath, "_blank", 0, loadProps);
XModel xModel = (XModel)calcDoc; // Ottieni XModel dal documento
XSpreadsheetDocument xSpreadsheetDocument = (XSpreadsheetDocument)calcDoc;
XSpreadsheets spreadsheets = xSpreadsheetDocument.getSheets();
XIndexAccess sheetsIndex = (XIndexAccess)spreadsheets;
XSpreadsheet currentSheet = (XSpreadsheet)sheetsIndex.getByIndex(0).Value;
string activeSheetName = Get_active_sSheet_name(calcDoc);
XPrintable printDocument = (XPrintable)calcDoc;
// Prepare objects for return
object[] references = {
context,
xMSF,
desktop,
componentLoader,
calcDoc,
xSpreadsheetDocument,
xModel,
spreadsheets,
sheetsIndex,
currentSheet,
activeSheetName,
printDocument};
return references;
}
But I’ve some problems with this instruction (context):
uno.Any[] argsArray = new uno.Any[] { new uno.Any(context)};
the error:
Error CS1503 Argument 1: cannot convert from ‘unoidl.com.sun.star.uno.XComponentContext’ to ‘char’
I don’t understand the error and i don’t know what to do . Does anyone smarter than me have any ideas?
Thank you in advance
[erAck: edited to format code as code, see This is the guide - How to use the Ask site? - #6 by erAck]