We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Adding From- To- CC- Subjact to bodyRtf in Aspose.Network.Outlook.MapiMessage

We are able to store the bodyRtf into Oracle Blob and convert that to pdf using Aspose product. The requirement is to display the e-mail as it is in PDF i.e., I have to add To, Cc, Subject to the BodyRtf and convert to pdf later. It is doing text addition to bodyRtf and when it converts to PDF it is converting as like from text and it isn't in readable format. So, the question is how to add text to bodyRtf and store as rtf so that the pdf conversion happens as if it is from rtf to pdf? I appreciate any help in this regard. thanks.

Hi,


Thanks for your inquiry.

I am sorry, it is not yet possible to set the BodyRtf property in Aspose.Network for .NET.

Could you please try the below example? It uses Aspose.Network to get the RTF and Aspose.Words for .NET for adding other message contents e.g. from, to and subject.

// load the message
MapiMessage message = MapiMessage.FromFile(strOutlookFile);
// get the RTF and save to a file
StreamWriter sw = new StreamWriter(“test.rtf”);
sw.Write(message.BodyRtf);
sw.Close();

// Open the RTF in Aspose.Words
Document document = new Document(“test.rtf”);
DocumentBuilder builder = new DocumentBuilder(document);
// Add the from, to and subject to the document
builder.Writeln("From: " + message.SenderEmailAddress);
builder.Writeln(“To: " + message.Recipients[0].EmailAddress);
builder.Writeln(“Subject: " + message.Subject);
builder.InsertHtml(”
”);
// save as PDF
document.Save(strPdfFile, SaveFormat.Pdf);

Hi, I tried it. But I need to store the entire message in oracle blob field and convert to pdf later. That is the process I should follow. what property I should use to get the rtf from builder, so that I can store it and use it later for pdf conversion. Thanks.