Note that there are some explanatory texts on larger screens.

plurals
  1. POopen files from output stream
    primarykey
    data
    text
    <p>I'm trying to save my chart image so that I can put it into an excel file created using epplus</p> <pre><code>Response.ContentType = "image/bmp" Response.AppendHeader("Content-Disposition", "attachment;filename=chart.bmp") Chart1.SaveImage(Response.OutputStream) Dim imgchart As Bitmap imgchart = New Bitmap("chart.bmp") Using package As New ExcelPackage(newFile) ' add a new worksheet to the empty workbook Dim worksheet As ExcelWorksheet = package.Workbook.Worksheets.Add("LIMS") 'Add the headers worksheet.Cells(1, 1).Value = "Analyzer Time" worksheet.Cells(1, 2).Value = "Analyzer Data" worksheet.Cells(1, 3).Value = "Lab Date" worksheet.Cells(1, 4).Value = "Lab Data" Dim row row = 2 For i = 0 To count1 - 1 worksheet.Cells(row, 1).Value = col1(i) worksheet.Cells(row, 2).Value = col2(i) row = row + 1 Next row = 2 For i = 0 To labcount - 1 worksheet.Cells(row, 3).Value = col3(i) worksheet.Cells(row, 4).Value = col4(i) row = row + 1 Next worksheet.Drawings.AddPicture("chart", imgchart) Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" Response.AppendHeader("Content-Disposition", "attachment;filename=chart.xlsx") package.SaveAs(Response.OutputStream) Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" Response.AppendHeader("Content-Disposition", "attachment;filename=chart.xlsx") Response.WriteFile("chart.xlsx") Response.End() End Using </code></pre> <p>What do I need to fix in this code? I'm new to file streams and response.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload