Hello I have the following code which saves the workbook as an attchment to an email.
MailMessage email = new MailMessage(fromAddress, address, subject, bodytext);
MemoryStream dstStream = new MemoryStream();
dstStream.Position = 0;
Attachment attachment = null;
attachment = new Attachment(dstStream,filename.Replace(".xls",".pdf"));
attachment = new Attachment(dstStream, filename);
SmtpClient smtp = new SmtpClient(smtpServer, smtpPort);
The PDF branch works correctly and an email with the PDF attachment is as expected however the excel one does not, find attached the file that is created. The file appears to be empty. Is there a known issue Saveing FileFormatType.Default to a stream.