Презентация Openxml: как загрузить файл(web httpresponse) без сохранения в физическом пути.
i replace text in presentationDocumentNew Save file on Physical path - Its worked presentationDocumentNew.SaveAs(tmpFilePath); presentationDocumentNew.Close(); Question: OpenXml Presentation(PPT-pptx) i don't want to save in physical part. I just want to download file directly from browser using HttpResponse I try many way to But its not worked. File downloed but its correpted. Try: 1) presentationDocumentNew.PresentationPart.GetStream().CopyTo(Response.OutputStream); 2) take Stream or Memory stream or FileStream, set in response Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("Content-Disposition", "attachment; filename=" + "cccc.pptx"); ......etc Not worked all
Что я уже пробовал:
<pre>PresentationDocument presentationDocumentNew = null;
using (PresentationDocument presentationDocument = PresentationDocument.Open(file, false)) { presentationDocumentNew = (PresentationDocument)presentationDocument.Clone(); presentationDocument.Close(); }
if (presentationDocumentNew != null) {
// i replace text in presentationDocumentNew // Save file on Physical path - Its worked // presentationDocumentNew.SaveAs(tmpFilePath); // presentationDocumentNew.Close(); //Question: i don't want to save in physical part. I just want to download file directly from browser using HttpResponse // I try many way to But its not worked. File downloed but its correpted. // Try: 1) presentationDocumentNew.PresentationPart.GetStream().CopyTo(Response.OutputStream); // 2) take Stream or Memory stream or FileStream, set in response // Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; // Response.AddHeader("Content-Disposition", "attachment; filename=" + "cccc.pptx"); // ......etc // Not worked all
}