Foros del Web » Programando para Internet » ASPX (.net) »

exportar datos a excel

Estas en el tema de exportar datos a excel en el foro de ASPX (.net) en Foros del Web. Hola, necesito exportar unos datos a excel en vb.net. Cree una aplicacion: windows application e hice un ejemplo sencillo ke me funciono: Private Function excel() ...
  #1 (permalink)  
Antiguo 30/07/2008, 16:51
 
Fecha de Ingreso: abril-2008
Mensajes: 14
Antigüedad: 16 años
Puntos: 0
exportar datos a excel

Hola, necesito exportar unos datos a excel en vb.net. Cree una aplicacion: windows application e hice un ejemplo sencillo ke me funciono:

Private Function excel()
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Const sSampleFolder = "C:\ExcelData\"

'Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add

'Add data to cells of the first worksheet in the new workbook.
oSheet = oBook.Worksheets(1)
oSheet.Range("A1").Value = "Prueba"
oSheet.Range("B1").Value = "Segundo"
oSheet.Range("A1:B1").Font.Bold = True
oSheet.Range("A2").Value = "xxxxx"
oSheet.Range("B2").Value = YYYY"

'Save the workbook and quit Excel.
oBook.SaveAs(sSampleFolder & "Book1.xls")
oSheet = Nothing
oBook = Nothing
oExcel.Quit()
oExcel = Nothing
GC.Collect()
End Function

Esta me funciono bien, kise hacer la misma funcion en una aplicacion Asp.net web application t me marco este error:

No se puede crear el componente ActiveX.



Línea 184:
Línea 185: 'Start a new workbook in Excel.
Línea 186: oExcel = CreateObject("Excel.Application")


ke estoy haciendo mal o ke me falta?
  #2 (permalink)  
Antiguo 30/07/2008, 17:02
Avatar de Peterpay
Colaborador
 
Fecha de Ingreso: septiembre-2007
Ubicación: San Francisco, United States
Mensajes: 3.858
Antigüedad: 16 años, 7 meses
Puntos: 87
Respuesta: exportar datos a excel

Agregar las mismas referencias a interop de excel library.
o hacerlo del modo como usando Response y Headers como hay 100 de ejemplos aqui en el foro.
__________________
Curso WF4
http://cursos.gurudotnet.com/ DF
Aprende HTML5
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:57.