Issue Converting Excel snippet to MHTML from Word document

Trouble translating regular Excel columns/rows when they are pasted into a Word document.
The scenario here is a user creates a word document and cuts and pastes a section of an Excel worksheet into Word. Then a user requests the document through an online application which renders the document in MHTML using Aspose Words (Save As MHTML) before presenting it to the user.

I’ve attached the original Excel document and the resultant MHTML. I saved it in a Word document.
The original MHTML document contains sensitive information that cannot be transmitted in its current form.
ther is one more related issue. It has to do with the use of MS Shapes on a word document. I’ve attached a detailed example.
Please let me know how this can be corrected.

Hi
Thanks for your request. But could you please attach your input word document and output Mhtml (as Mhtml) here for testing?
The problem might occur because you are inserting Excel data into Word as embedded OLE object, in this case these data will be represented as an image in output Mhtml. Anyways I need your source Word document to investigate the issue.
Best regards,

Hi I attached examples of the issues that were described in my posting, but have not heard anything back from Aspose since early July.
Can you please have a look at the attached word and MHTML results and let me know if you can recommend how this issue can be resolved?
Thanks!

Hi Brian,
Thanks for your inquiry and we apologise for the delay.

  1. I managed to reproduce the issue on my side. As Alexey predicted, your Excel spreadsheet in this document is stored as an embedded object. This object has a vector image which is converted to raster upon export to HTML which is why there is some change in quality. However it should look nicer than this so we will fix this. We will keep you informed of any developments.

In the mean time you can use this code instead to work around the issue for now. Just run it before exporting to HTML. Using this code produces a much nicer looking image.

foreach(Shape shape in doc.GetChildNodes(NodeType.Shape, true))
{
    // Convert all vector images in the document to png.
    if (shape.HasImage && (shape.ImageData.ImageType == ImageType.Emf || shape.ImageData.ImageType == ImageType.Wmf))
    {
        using(MemoryStream vectorImageStream = new MemoryStream(shape.ImageData.ImageBytes))
        using(Image image = Image.FromStream(vectorImageStream))
        {
            Size newSize = new Size(image.Width * 4, image.Height * 4);
            using(Bitmap rasterImage = new Bitmap(newSize.Width, newSize.Height))
            {
                using(Graphics g = Graphics.FromImage(rasterImage))
                {
                    g.SmoothingMode = SmoothingMode.AntiAlias;
                    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    g.PixelOffsetMode = PixelOffsetMode.HighQuality;
                    g.DrawImage(image, new Rectangle(0, 0, newSize.Width, newSize.Height));
                    using(MemoryStream rasterImageStream = new MemoryStream())
                    {
                        image.Save(rasterImageStream, ImageFormat.Png);
                        shape.ImageData.SetImage(rasterImage);
                    }
                }
            }
        }
    }
}
  1. I could not see any issue with your output document, could you please clarify where the issue is?
  2. This behaviour is occuring because floating shapes cannot overlap one another in HTML. Instead try grouping all of the shapes together into a GroupShape (Right click -> Group) or inserting the shapes as they are into a textbox. This will cause them to be rendered as an image and preserved in HTML better.

If you have any further queries, please feel free to ask.
Thanks,

Hi I added the code you provided to my test suite, and unfortunatlely the fidelity is still inconsistent for issue 1. It appears that isssue 2 has been improved, though.
In addition to issue 1 and 2, a new issue which is also related to rendering and it is with charts taht are pasted from Excel into Word.
Our goal is to obtain the same fidelity we can get by performing a save as MHTML from MS Word 2007.
I’ve attached a zip file with examples of each document type and the output from Aspose and MS Word.
Please have a look at these examples and let me know your recommendation for resolving these issues.
Thanks.

Hi
Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
Best regards,

Hello. I just wanted to follow-up to see if there has been any progress made on this issue? In particular teh pasting of Excel Worksheets and Excel Charts wtihin a Word document. As described above, and within the attached zip files, there are several issues occurring when we save Word documents with these contents to MHTML.
Our users are concerned with the results of these conversions. We are stating to look at alternative means of obtaining MHTML conversions, but we have a lot invested in our Aspose solution. We would like to continue with the Aspose solution, but the users are not happy with the results.
Can you pleas let me know if a solution to these issues is close.
Regards,
Brian

Hello
Thanks for your request. Unfortunately, these issues are still unresolved. As soon as the responsible developer will analyze the issue and we will be able to provide you additional information.
We will be sure to inform you of any developments regarding these issues.
Best regards,

Please provide a substantive update for the issues described in this thread. The original inquiry was made in July. It is now November. Please let me know if these issues are beyond the feature capability of Aspose Words when converting documents to MHTML.
In summary the issues are:
Issue Converting Excel snippet to MHTML from Word document

  1. Inserting excel spreadsheet and then populating data comes out as bolded text and sometimes is unreadable.
  2. Copy and paste special of excel data results in excessive bolding of document data.
  3. Adding circle shape over existing picture object (matrix) within word results in shape misalignement when converted to MHTML using Aspose and, as we learned later, also using MS Word
  4. Copying and Pasting Charts from Excel render improperly with bolded text and are, for the most part unreadable. When copied as MS Drawing Onjects, the charts do not show up at all in the rendered MHTML.

Please provide an update on whether or not these issues can be resolved.

Hi Brian,

Thanks for your inquiry.

We are currently analysing your issues, we will inform you as soon as there are any developments.

Thanks,

Hi. This relates to the charts rendering issue (item 4 in reply 340650). Even with the temporary fix, provided by Aspose (reference replies 323487 and 323469), the graphics are still not rendering well enough to support our user’s needs.
We found a C++ program that provides features to convert images from BMP to EMF and vice versa. The quality of these conversions is an improvement over what we have been able to achieve when we convert Word documents to MHTML using Aspose Words alone.
I have included a zip file which contains: a Word document which contains several charts saved in various formats, the MHTML output of this Word document, produced by Aspose Words for .Net 10.7.0., several C++ source files along with the emf files that can be used to test the C++, and finally, the C# source (Wordtemplate.cs) which contains the refineImage method, the contents of which were provided by Aspose.
I’d like to see if you could emulate the methods (ConvertEMFToBMP and ConvertBMPToEMF) included in the C++ class ConvertEMFToBMP.cpp by implementing these methods in C#? If you could do that, we could then call that new method at the point where we are calling refineImage and improve the quality of the graphic images being rendered.

Please let me know if you have any questions relating to this request.
Thank you.

Hi
Thank you for additional information. I forwarded this information to our developers. We will let you know one the issue is resolved.
Best regards,

Could you please provide an update on the latest iquiry relating to this issue. I submitted some sample C++ code in early December that improves the rendering into MHTML of several of the objects that are not being properly converted by Aspose Words for .Net.
Please let me know what you can about the effort to incorporate the C++ rendering fix into the Aspose Words for .Net code line.
Regards,
Brian

Hi Brian,

Thanks for your inquiry.

I’m afraid these issues are still unresolved. We will inform you as soon as there are any developments.

Thanks,

HI. I see this issue is still unresolved and I just wanted to check-in to see if you could provide an update as to when a fix will be available.
We are eager to get this one resolved.
Your team helped resolve an item related to line-height in MHTML conversions and that has been well received!
Keep up the good work!

Hi Brian,

I see that default resolution is enough for showing the image better than now. Nevertheless, as a simple workaround, you can use the following code:

Document doc = new Document("ASPOSE ISSUE1.docx");
HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions();
htmlSaveOptions.ImageResolution = 600;
doc.Save("ASPOSE ISSUE1. html", htmlSaveOptions);

Html will look good, but unfortunately this will increase size of image file.

Hi Brian,

we’ve moved the issue to more appropriate sub-team. Hope, it will help with sooner analysis.

Hello, Brian.

Analysis shows that there’s no error in rendering code. The specified image is windows metafile and it’s rendered into bitmap via standard GDI+ methods internally. We have no control over it. It seems that default resolution isn’t enough to render it in accpetable quality, so the only way to improve it is to increase the image renderering resolution, just like it was suggested by Andrey above.

I’m closing this issue as “not a bug”.

In nearest or next release we’re going to support antialiasing for rendered images, this also may improve the overall image quality a little bit.

Thanks,

The issues you have found earlier (filed as WORDSNET-5159) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as WORDSNET-5236) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)