Equations in Word doc rendered as tofu boxes in Aspose Word to Html conversion


#1

While converting a Word document into HTML containing math equations, few symbols are rendered as tofu boxes.

The equations were created using MathType plugin.

Please help if there is any fix for this issue


#2

@Abie9703,

I have observed your comments, Can you please share source files along with generated result, environment details and sample project so that we may further investigate to help you out.


#3

Input word Document:
MATHS NOTES.docx.zip (675.9 KB)

Output Html:

Math.zip (460.9 KB)

In the above conversion,
“alpha” symbol is rendered as “a”
“not equal to” symbol is not rendered
“belongs to” and “not belongs to” symbol is not rendered
“brackets” are not rendered


#4

@Abie9703,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 18.7 with following code example. We have not found the shared issue. Please use Aspose.Words for .NET 18.7. We have attached the output HTML with this post for your kind reference. 18.7.zip (476.5 KB)

Document doc = new Document(MyDir + "MATHS NOTES.docx");

Aspose.Words.Saving.HtmlSaveOptions options = new Aspose.Words.Saving.HtmlSaveOptions();
doc.Save(MyDir + @"18.7.html", options);

#5

Thanks a lot.

I also find some slight alignment issues in few of the equations.
When I edit the generated HTML and add align=“center” for all images, the alignment seems to be proper.


#6

@Abie9703,

Thanks for your inquiry. Please share the screenshots of problematic sections of output document and page numbers of document that are not exported correctly. We will investigate the issue and provide you more information on it.


#7

Screenshot of the alignment issue in HTML: Screen Shot 2018-07-12 at 1.12.57 AM.png (43.5 KB)

Page number in word doc : Page 22

Also, just for clarification, is the latest version Apsose.Word 18.7, available for Java?


#8

@Abie9703,

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-17167. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.


#9

@Abie9703,

The latest version of Aspose.Words for Java is 18.6. Hopefully, the new version of Aspose.Words for Java 18.7 will be available at the end of this week.


#10

Thanks a lot :slight_smile:


#11

Tried with same word doc using Aspsoe.Words 18.7 for Java.
The issue doesn’t seemed to be resolved

“alpha” symbol is rendered as “a”
“not equal to” symbol is not rendered
“belongs to” and “not belongs to” symbol is not rendered
“brackets” are not rendered

Output HTML: 18.7.zip (142.2 KB)

Document doc = new Document("MATHS NOTES.docx");
HtmlSaveOptions options = new HtmlSaveOptions();
doc.save("18.7.html", options);

#12

@Abie9703,

Thanks for your inquiry. Please make sure that fonts use in your document are installed on the machine where you are converting DOCX to HTML. Please install fonts ‘Times New Roman’, ‘Microsoft Sans Serif’, ‘Calibri’, and ‘Cambria Math’ on your machine to get the desired output.

We suggest you please read following article.
How to Receive Notification of Missing Fonts and Font Substitution during Rendering

Following code example show how to receive notification for missing fonts.

Document doc = new Document(MyDir + "MATHS NOTES.docx");

HtmlSaveOptions options = new HtmlSaveOptions();
options.setPrettyFormat(true);
doc.setWarningCallback(new IWarningCallback() {
    @Override
    public void warning(WarningInfo warningInfo) {
        if (WarningType.FONT_EMBEDDING == warningInfo.getWarningType()
                || WarningType.FONT_SUBSTITUTION == warningInfo.getWarningType()) {
            System.out.println(warningInfo.getDescription());
        }
    }
});
doc.save(MyDir + "18.7.html", options);

#13

Thanks for your inputs. Verified the fonts installed and still faced the same issue.
Screen Shot 2018-07-17 at 10.25.16 PM.png (79.9 KB)


#14

@Abie9703,

Thanks for your inquiry. Please use following code at your end and share if you are getting any warning messages. Moreover, please share the detail of your operating system.

doc.setWarningCallback(new IWarningCallback() {
    @Override
    public void warning(WarningInfo warningInfo) {
            System.out.println(warningInfo.getDescription());
    }
});

#15

My code:

    FontSettings fontSettings = new FontSettings();
    Document doc = new Document(MyDir + "MATHS NOTES.docx");

    FontSettings.getDefaultInstance().setFontsFolder
            ("/Users/aabira/Library/Fonts", true);

    HtmlSaveOptions options = new HtmlSaveOptions();
    options.setPrettyFormat(true);

    doc.setWarningCallback(new IWarningCallback() {
        @Override
        public void warning(WarningInfo warningInfo) {
            System.out.println(warningInfo.getDescription());
        }
    });
    doc.save(MyDir + "18.7.html", options);

Warning Message:
DrawingML is not supported in Html format and will be converted to shape.

Operating System:
macOS version 10.12.6


#16

@Abie9703,

Thanks for sharing the detail. We are investigating this issue and will get back to you soon.