Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Opening Excel document

Opening Excel document

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-net
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    soneliso
    wrote on last edited by
    #1

    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()

    S S 2 Replies Last reply
    0
    • S soneliso

      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()

      S Offline
      S Offline
      Sathesh Sakthivel
      wrote on last edited by
      #2

      What Code you have written for Opening the Excel document. How can we tell without seeing the code what is wrong in it?

      SSK.

      S 1 Reply Last reply
      0
      • S Sathesh Sakthivel

        What Code you have written for Opening the Excel document. How can we tell without seeing the code what is wrong in it?

        SSK.

        S Offline
        S Offline
        soneliso
        wrote on last edited by
        #3

        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

        S 1 Reply Last reply
        0
        • S soneliso

          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()

          S Offline
          S Offline
          Sandeep Kumar
          wrote on last edited by
          #4

          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

          S 1 Reply Last reply
          0
          • S soneliso

            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

            S Offline
            S Offline
            Sathesh Sakthivel
            wrote on last edited by
            #5

            Try with the Code as Sandeep Said.

            SSK.

            1 Reply Last reply
            0
            • S Sandeep Kumar

              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

              S Offline
              S Offline
              soneliso
              wrote on last edited by
              #6

              I 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.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups