Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
415
how to generate stream/bytes from report using Infragistics.Documents.Reports.Report
posted

I have a report object which I can generate PDF by calling report.Publish(fileName, fileType) method and it works fine. However I need another method where I can generate stream bytes[] or the object. I tried using following code but it shows error because Report object is not serializable. My code:

//convert report object to bytes
byte[] bytes = ObjectToByteArray(report);

private static byte[] ObjectToByteArray(object obj)
{
if (obj == null)
return null;
BinaryFormatter bf = new BinaryFormatter();
using (MemoryStream ms = new MemoryStream())
{
  bf.Serialize(ms, obj);//ERROR comes here
  return ms.ToArray();
}
}

any help is appreciated.