ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Write Worksheet to MemoryStream in .NET 2.0 (https://www.excelbanter.com/excel-programming/373695-write-worksheet-memorystream-net-2-0-a.html)

[email protected]

Write Worksheet to MemoryStream in .NET 2.0
 
I am developing a windows forms application in .NET 2.0 using VS2005.

One of my forms has a grid that I want to convert to Excel and attach
to an email and send using System.Net.Mail.

..NET 2.0 has a MemoryStream class that can be attached to an email.

mail.Attachments.Add(New Attachment(attachmentStream1, "ExcelFile.xls",
"excel/xlsss"))

Using Excel Automation, I have created a Workbook. I can save the
workbook to disk, but I want to write it to the MemoryStream object to
use as the attachmentStream.

How can I get the Worksheet into to MemoryStream?



All times are GMT +1. The time now is 01:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com