Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/05/2015, 08:50
verosb
 
Fecha de Ingreso: febrero-2007
Mensajes: 56
Antigüedad: 17 años, 2 meses
Puntos: 1
ReportViewer Render Excel 2007

Necesito exportar a Excel 2007 en lugar de a Excel 2003 un LocalReport.ReportViewer (rdlc), ¿hay alguna forma de hacerlo?

Si no es así, ¿alguien podría decirme un control similar al ReportViewer que podría utilizar?

He leído en otros foros que con el siguiente código debería funcionar pero no es así...

Dim warnings As Warning()
Dim streamids As String()
Dim mimeType As String
Dim encoding As String
Dim extension As String
Dim filename As String

Dim bytes As Byte() = ReportViewer1.LocalReport.Render("ExcelOpenXML", Nothing, mimeType, encoding, extension, streamids, warnings)

filename = String.Format("{0}.{1}", "ExportToExcel", "xls")
Response.ClearHeaders()
Response.Clear()
Response.AddHeader("Content-Disposition", Convert.ToString("attachment;filename=") & filename)
Response.ContentType = mimeType
Response.BinaryWrite(bytes)
Response.Flush()
Response.End()

El error que me aparece es el siguiente:

Specified argument was out of the range of valid values.
Parameter name: format

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: format

Dim bytes As Byte() = ReportViewer1.LocalReport.Render("ExcelOpenXML", Nothing, mimeType, encoding, extension, streamids, warnings)