You should get file as a stream, open it using open xml sdk (You need to have Open XML SDK: here).
If you are not familiar with Open XML SDK, you can also look at the blog post here which is also taken from the blog you already referenced.
Below code is a sample code how I create report and send to client using Open XML SDK with ASP.NET. I hope it can be helpful.
public void SendReport()
{
using (Stream stream = GetReportStream())
{
stream.Position = 0;
byte[] buffer = new byte[(int)stream.Length];
stream.Read(buffer, 0, (int)stream.Length);
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.Buffer = true;
System.Web.HttpContext.Current.Response.AddHeader("Content-Type", "application/pptx");
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=Report;");
System.Web.HttpContext.Current.Response.BinaryWrite(buffer);
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.Close();
}
}
private Stream GetReportStream()
{
MemoryStream stream = new MemoryStream();
using (FileStream file = File.Open(@"TemplateFileLocation", FileMode.Open))
{
byte[] buffer = new byte[file.Length];
file.Read(buffer, 0, (int)file.Length);
stream.Write(buffer, 0, buffer.Length);
}
using (PresentationDocument presentationDocument = PresentationDocument.Open(stream, true))
{
// Doing manipulations explained in your reference document link.
presentationPart.Presentation.Save();
}
return stream;
}
Don't forget to download and check the whole solution on the link you referenced.