I'm working on a product that creates MS Word output by generating an HTML document with the appropriate bits of Word CSS and XML magic embedded in it. I now need to embed RTF (images and styled text) in the document, and so am looking at the multipart HTML generation features in .NET.
I'd like to generate the MHTML document by converting the RTF snippets into images in memory, and then just embedding the Base64-encoded data directly into the MHTML object. So far, I can't find any .NET solutions to do that.
The MS CDO stuff is promising, but it looks like the only way to create an attachment is to provide a URL to the data and use AddRelatedBodyPart() to add it to the object.
The System.Net.Mail package also looks compelling (as documented here and in a previous question here), but I don't see a straightforward way to convert the generated mail object to a string -- the API seems to be focused around sending mail messages, not generating files.
Right now, I'm pushing forward with an approach that uses CDO and temporary directories, but I'm unhappy with that as a long-term approach. Any better suggestions?