I’m having an issue with formatting when trying to do a mail merge. If I save the document to html in word the formatting is fine, but when mail merged and displayed in an email the formatting changes. Its just a simple document with text and images, but the back ground image gets displayed as one page and the text and foreground images get put on a new page below the background image. Is there anything I can do to force the formatting to stay the same?
string body = ConvertContents(msg.Body, SaveFormat.Mhtml);
msg.To = EncodeMailAddress(msg.To);
msg.From = EncodeMailAddress(msg.From);
msg.Subject = EncodeUTF8(msg.Subject);
msg.SubjectEncoding = Encoding.UTF8;
msg.HtmlBody = body.Substring(body.IndexOf("=EF=BB=BF") + 9);
msg.Headers[“Content-Type”] = "text/html; charset=“utf-8"”;
msg.Headers.Add(new MimeHeader(“Content-Disposition”, “inline; filename=“document.html””));
msg.Headers.Add(new MimeHeader(“Content-Location”, “document.html”));
// convert contents code
UTF8Encoding encoding = new UTF8Encoding();
byte[] buffer = encoding.GetBytes(contents);
msIn = new MemoryStream(buffer);
msIn.Position = 0;
Document doc = new Document(msIn);
msOut = new MemoryStream();
doc.Save(msOut, format);
msOut.Position = 0;
sr = new StreamReader(msOut);
text = sr.ReadToEnd();
Hi Keith,
Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word do. If you do mail merge and document conversion to html by using MS Word, you will get the same output.
It would be great if you please share following detail for investigation purposes. I will investigate the issue on my side and provide you more information.
- Please create a simple application
(for example a Console Application Project) that helps us reproduce the
same problem on our end and attach it here for testing. You are not doing mail merge in shared code.
- Please supply us with the output document showing the undesired behavior
- Please supply us with the expected document showing the desired behavior