Problem when exporting Excel data with rdlc

0

I'm having trouble rendering a file in excel. Every time I export to open the file looks like this:

ThecodeforgeneratingExcelexportislikethis:

PrivateSubRenderizaRelatorioExcel(ByValreportviwerAsReportViewer)DimwarningsAsWarning()=NothingDimstreamidsAsString()=NothingDimmimeTypeAsString="application/ms-excel"
        Dim encoding As String = Nothing
        Dim fileNameExtension As String = Nothing
        Dim context As HttpContext = HttpContext.Current

        Dim exportBytes() As Byte = reportviwer.LocalReport.Render("Excel", Nothing, mimeType, encoding, fileNameExtension, streamids, warnings)

        context.Response.Buffer = True
        context.Response.Clear()

        'INFORMAÇÕES DE CABEÇALHO
        context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("Windows-1252")
        context.Response.Charset = "ISO-8859-1"
        context.Response.ContentType = mimeType
        context.Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}{1}", "ExportedReport.", fileNameExtension))
        context.Response.BinaryWrite(exportBytes)
        context.Response.Flush()
        context.Response.End()
    
asked by anonymous 29.05.2018 / 22:56

0 answers