Mhtml to Doc/x Rtf Svg problem

Hello:
error.zip (86.7 KB)

Kindly check Source.mht and target saved formats: Docx Rtf Svg which are rendered incorrectly.

For Rtf, I used:

.ExportCompactSize = False
.ExportImagesForOldReaders = True
.SaveImagesAsWmf = True
.PrettyFormat = True

And opened target in Windows Wordpad.
Thanks :slight_smile:

Sorry to load plain text files with .txt extension, shall I use Txt?
https://reference.aspose.com/words/net/aspose.words.loading/txtloadoptions/
I guess not as plain text does not support .Password, how to load txt? :slight_smile:

@australian.dev.nerds Unfortunately, I cannot reproduce the problem on my side. I have used the following code for testing:

Document doc = new Document(@"C:\Temp\in.mht");

// Save as DOCX
doc.Save(@"C:\Temp\out.docx");

// Save as RTF
RtfSaveOptions rtfOpt = new RtfSaveOptions();
rtfOpt.ExportCompactSize = true;
rtfOpt.ExportImagesForOldReaders= true;
rtfOpt.SaveImagesAsWmf = true;
rtfOpt.PrettyFormat= true; // Does not have effect for RTF.
doc.Save(@"C:\Temp\out.rtf", rtfOpt);

// Save as SVG
SvgSaveOptions svgOpt = new SvgSaveOptions();
svgOpt.ExportEmbeddedImages = true;
doc.Save(@"C:\temp\out.svg", svgOpt);

Here are output documents produced on my side: out.zip (10.6 KB)

You can load TXT document using code like this:

Document doc = new Document(@"C:\\Temp\\in.txt");

or by explicitly specifying load format:

Document doc = new Document(@"C:\\Temp\\in.txt", new LoadOptions() { LoadFormat = LoadFormat.Text });

Or by specifying additional TXT load options:

TxtLoadOptions opt = new TxtLoadOptions();
opt.TrailingSpacesOptions = TxtTrailingSpacesOptions.Trim;
Document doc = new Document(@"C:\\Temp\\in.txt", opt);
1 Like

Hello
OK made the sample:
WinApp4.zip (34.8 KB)

Just copy latest aspose email/words to the project.

Kindly view the output SVG with MS Edge and IE/Firefox and open RTF in Wordpad, I’m using the latest Win10 build.

Seems that TIFF also has a minor issue:
WinApp5.zip (34.8 KB)

Kindly check the exported TIFF and zoom in a little to see the horizontal/vertical lines on the right and down side of page…

screenshot:
lines.zip (18.4 KB)

@australian.dev.nerds

Your code throws an exception on this line when I run it on my side:

If MyMailMessage.IsEncrypted = True Then MyMailMessage = MyMailMessage.Decrypt()

If comment this line of code the output loos fine: Target.zip (110.4 KB)

Also, it is not quite clear what is the purpose of converting Mhtml to Mhtml using Aspose.Email before converting to using Aspose.Words. Why dont you simply convert the Mhtml directly using Aspose.Words as in my example?

1 Like

Hello, because eml/mhtml files might be smime and will need to get encrypted first, also might be other email formats than eml/mhtml…
Thanks then :slight_smile:

@australian.dev.nerds Unfortunately, I cannot reproduce the problem you have described neither by direct document conversion using Aspose.Words nor using the code you have provided.