AxSpreadsheet

  • Thread starter Thread starter [Trunks]³
  • Start date Start date
T

[Trunks]³

Hi,
I'm using an activex spreadsheet object in a vb.net application, with the
export method I can save my data in an excel document. How can I open an
excel document, that I already have, in the spreadsheet object?

Mirko
 
AxSpreadsheet cannot open xls

I hope this isnt too late. The AxSpreadsheet web component in .net cannot open xls files. Luckily it can open xml files. When refering to the xml file that you would like to be opened attach either 'file:' or 'http:' as the prefix to the location on disk. Excel can save to xml, as an option in the saveas function or you can convert the xml file programmatically. Here is some example code [in C#.NET]:

private void OpenExcelDoc(string xlsFileName)
{
string xmlFileName = "C:\\temp.xml";
Excel.ApplicationClass excel = new Excel.ApplicationClass();
Excel.Workbook workbook = null;
if (excel != null)
{
workbook = excel.Workbooks.Open(xlsFileName,0,true,5,"","",true,
Excel.XlPlatform.xlWindows,"\t",false,false,0,true,false,false);
}

try
{
excel.DisplayAlerts = false;
excel.ActiveWorkbook.SaveAs(xmlFileName,Excel.XlFileFormat.xlXMLSpreadsheet,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);


}
catch (System.Exception e)
{
MessageBox.Show(e.Message);
}

this.axSpreadsheet.XMLURL = "file:" + xmlFileName;

//closing the instances of the excel COM object
excel.Quit();
Marshal.ReleaseComObject(workbook);
Marshal.ReleaseComObject(excel);
}
 
Allow cell drag and drop in axspreadsheet

Hi,

Does anyone know how to "Allow cell drag and drop" in axspreadsheet.
 
Back
Top