I have created a a project that reads different files and puts then in different sheets with a spreadsheet. I have used Open office calc spreadsheet therefore used the following code to open a blank file:
public XSpreadsheet getSpreadsheet(int nIndex, XComponent xComp)
{
XSpreadsheets xSheets = ((XSpreadsheetDocument)xComp).getSheets();
XIndexAccess xSheetsIA = (XIndexAccess)xSheets;
XSpreadsheet xSheet =(XSpreadsheet)xSheetsIA.getByIndex(nIndex).Value;
return xSheet;
}
I call a sheet to be used like so:
XSpreadsheet newSheet = getSpreadsheet(sheetIndex, xComp);
where xComp
is:
string filePathway = @"file:///c:/temp/blank.ods";
PropertyValue[] propVals = new PropertyValue[0];
XComponent oCalcuDoc = oDesktop.loadComponentFromURL(filePathway, "_blank", 0, propVals);
However my problem is that file blank.ods needs to be set up with the number of sheets that will be required already inserted into the spreadsheet before the application is run. This is not ideal as the number of sheets needed is not always known. Is there a way of inserting sheets from within my application?
Any help would be appreciated.