Free Support Forum -

PresentationEx.Write method throws Index was out of range Exception

Dear Support team,

I am trying to write my pptx object to Response.OutputStream

string filename = path + “\t1.pptx”;
Response.AddHeader(“Content-Disposition”, “attachment;filename=”" + filename + “”");
pres.Write(Response.OutputStream); // pres is PresentationEx object

but the last line throws an exception.

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

Can you please help.
Also, is there a way to find the size (bytes) of pptx object that I am trying to write to my response.


Actually after checking the StackTrace of InnerException I realized that one of the Chart API calls is throwing the exception.

May be I should pass the right data to the chart otherwise it generates charts that are not writable to streams.

Hi Varun,

I have shared the response with you in similar thread over this link. Please share, if I may help you further in this regard.

Many Thanks,