Hi,
I am a developer and I am using Aspose to convert Outlook mails to pdf. Unfortunately the SaveToPdf()-method does not works for some mails; mostly for those mails containing (ms-office)-tables… I am using the following code to do the conversion:
MapiMessage mail = MapiMessage.FromFile("OutlookMail.msg");
string someExtraText = "\\par " + "This is an outlook mail conversion. The sender is: " + mail.SenderName + " \\line ";
using (System.IO.MemoryStream rtfStream = new System.IO.MemoryStream())
{
System.IO.StreamWriter tw = new System.IO.StreamWriter(rtfStream);
tw.Write(@"{\rtf1 \ansi\ansicpg1252{\fonttbl{\f1001\fswiss\fcharset0 Arial;}} \f1001" + someExtraText + @"\line \pard \brdrb \brdrs\brdrw10\brsp20 {\fs4\~}\par \pard \line");
tw.Write(mail.BodyRtf);
tw.Flush();
Aspose.Words.Document doc = new Aspose.Words.Document(rtfStream);
try
{
doc.SaveToPdf("OutlookMail.pdf");
}
catch (Exception exp)
{
Console.WriteLine(exp.Message);
}
}
And Iam becoming the following error message:
===================================
Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.(Aspose.Words)
------------------------------
Program Location:
bei ?.?.?(Shape ?, SizeF ?, Matrix ?, Single ?, Single ?, Single ?)
bei ?.?.?(ShapeBase ?, SizeF ?)
bei ?.?.?(? ?)
bei ?.?.?(? ?)
bei ?.?.?(? ?, ? ?)
bei Aspose.Words.Document.?(Int32 ?)
bei Aspose.Words.Document.SaveToPdf(Int32 pageIndex, Int32 pageCount, Stream stream, PdfOptions pdfOptions)
bei Aspose.Words.Document.SaveToPdf(Int32 pageIndex, Int32 pageCount, String fileName, PdfOptions pdfOptions)
bei Aspose.Words.Document.SaveToPdf(String fileName)
===================================
Can you imagine why this is going wrong?
Iam using Aspose.Words 8.2.0.0 and Aspose.Pdf 4.1.0.0, Aspose.Pdf.Kit 3.4.0.0
For confidentiality purposes I can not share the mails. I have attached a screenshot of the mail to show you it’s structure
Many Thanks in Advance