SOLVED - Out of memory exception saving large documents
Posted: Fri Nov 13, 2015 5:26 am
I have a situation whereby I have to write each individual report out to disk and then pull them all back into single document. And yes I have to do this way even though I'd prefer not to 
The problem seems to be related to SaveEncryptedDocument and SavePackedDocument. The document can be 100's of individual reports all stitched together and saves when not using either of these methods. I can't save it unencrypted or at the very least packed as they're invoices and in theory could be modified prior to printing leading to all sorts of fun and games with auditors.
So, I figure "Hey, just use a cryptostream"
This allows me to save the document, but now I can't open it as it appears the report.Load overload when using a stream calls Length and cryptostream doesn't allow seeking so it throws a 'Stream does not support seeking' exception. I've attached an example and who really appreciate some help in getting a large in-memory report to disk using encryption.
Thanks!
Example: https://www.dropbox.com/s/sqkdp2abe7air ... 7.zip?dl=0

The problem seems to be related to SaveEncryptedDocument and SavePackedDocument. The document can be 100's of individual reports all stitched together and saves when not using either of these methods. I can't save it unencrypted or at the very least packed as they're invoices and in theory could be modified prior to printing leading to all sorts of fun and games with auditors.
So, I figure "Hey, just use a cryptostream"
This allows me to save the document, but now I can't open it as it appears the report.Load overload when using a stream calls Length and cryptostream doesn't allow seeking so it throws a 'Stream does not support seeking' exception. I've attached an example and who really appreciate some help in getting a large in-memory report to disk using encryption.
Thanks!
Example: https://www.dropbox.com/s/sqkdp2abe7air ... 7.zip?dl=0