Opening Excel document
-
Hi I have been trying to open existing excel document from my asp.net page, it does not give me an error but it does not open the excel file. Any help i will appreciate that Thanks if isTrue Then call Stop() Else call Start()
What Code you have written for Opening the Excel document. How can we tell without seeing the code what is wrong in it?
SSK.
-
What Code you have written for Opening the Excel document. How can we tell without seeing the code what is wrong in it?
SSK.
Sorry for that i'm using VB here is my code Dim ExcelObj As Excel.Application Dim workbook As Excel.Workbook ExcelObj = New Excel.Application workbook = ExcelObj.Workbooks.Open(strFullFileName, 0, True, 5, "", "", True, Excel.XlPlatform.xlWindows, ",", False, False, 0, True) 'workbook = ExcelObj.Workbooks.Open(strFullFileName) workbook.Application.Visible = True workbook.Close() workbook = Nothing ExcelObj.Quit() ExcelObj = Nothing
-
Hi I have been trying to open existing excel document from my asp.net page, it does not give me an error but it does not open the excel file. Any help i will appreciate that Thanks if isTrue Then call Stop() Else call Start()
Hi, First add reference of Excel and try to open the document. Example:
Excel.ApplicationClass _appClass = new ApplicationClass(); Excel.Workbook _workbook = null; Excel.Worksheet _worksheet = null; try { _workbook = _appClass.Workbooks.Open( excelSheetNamePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); _worksheet = (Excel.Worksheet)_workbook.Worksheets[1];
Regards, Sandeep Kumar.V -
Sorry for that i'm using VB here is my code Dim ExcelObj As Excel.Application Dim workbook As Excel.Workbook ExcelObj = New Excel.Application workbook = ExcelObj.Workbooks.Open(strFullFileName, 0, True, 5, "", "", True, Excel.XlPlatform.xlWindows, ",", False, False, 0, True) 'workbook = ExcelObj.Workbooks.Open(strFullFileName) workbook.Application.Visible = True workbook.Close() workbook = Nothing ExcelObj.Quit() ExcelObj = Nothing
Try with the Code as Sandeep Said.
SSK.
-
Hi, First add reference of Excel and try to open the document. Example:
Excel.ApplicationClass _appClass = new ApplicationClass(); Excel.Workbook _workbook = null; Excel.Worksheet _worksheet = null; try { _workbook = _appClass.Workbooks.Open( excelSheetNamePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); _worksheet = (Excel.Worksheet)_workbook.Worksheets[1];
Regards, Sandeep Kumar.VI have tried that but it didn't work. I have tried a different way... I pass a variable to HTML Hidden tag FileName.Value = "C:\MyExcel.csv" Then here is A tag GetFile This work like fine, but it display the excel file on a html page. Here is what i'm doing. I have an aspx page with a button and ExportToExcel icon. When clicking on the button is should create a table using a DataTable which is returned from Database Class and create and save a csv file to C:\. On click on Export to Excel icon, it should open the saved file. Is there an easier way to do this.