2016-10-06 2 views
0

리피터 컨트롤에서 Excel 파일을 생성하고 사용자가 파일을 저장할 수있게하고 있습니다. 엑셀 파일을 생성 한 후 어떻게 이것을 디스크에 저장할 수 있습니까? 이메일의 첨부 파일로 보내겠습니다.리피터에서 바인딩 한 후 파일을 디스크에 저장하십시오.

Dim output As String = WebUI.RenderControl(plcList) 
Response.AppendHeader("content-disposition", "attachment;filename=report_dd_rejection.xlxs") 
Response.Write(output) 
Response.End() 

감사의 말을 보내 주시면 감사하겠습니다.

감사

크리스

답변

0

는 제가 질문을 이해 있는지 확실하지 않습니다.

하지만 이미 사용자의 브라우저로 전송되는 엑셀 데이터가있는 경우, 당신은 디스크에 데이터를 기록 할 필요가

Dim filePhysicalFolder = Environment.CurrentDirectory() 
Dim output As String = WebUI.RenderControl(plcList) 

Using outputFile As New StreamWriter(Path.Combine(filePhysicalFolder, "report_dd_rejection.xlxs")) 
    outputFile.Write(output) 
End Using 

Response.AppendHeader("content-disposition", "attachment;filename=report_dd_rejection.xlxs") 
Response.Write(output) 
Response.End() 
관련 문제