Question about process field math in word

Hi, I am use Python aspose API to convert docx file to html(mathml or latex). But I cannot process this filed math here. how can get the right result?test(11).docx (11.3 KB)

@zhilunx Equations in your document are represented by EQ fields, by default Aspose.Words renders such equations as images. You can also output them as MathML or Text by specifying HtmlSaveOptions.office_math_output_mode.

If you need to get the HTML that looks exactly as the document looks in MS Word, you can consider using HtmlFixed format:

doc = aw.Document("C:\\Temp\\in.docx")
opt = aw.saving.HtmlFixedSaveOptions()
opt.export_embedded_css = True
opt.export_embedded_fonts = True
opt.export_embedded_images = True
opt.export_embedded_svg= True
doc.save("C:\\Temp\\out.html", opt)

out.zip (14.8 KB)

Thanks Alex

How can I access all lines in document? And find the none-Chinese chars, and convert them into math? For example:

***** a + b *****( means chinese chars)
to -> ****** a + b *******
it convert to word math

@zhilunx

MS Word documents are flow document and do not have concept of page or line. The document consumer applications (MS Word, Open Office etc) reflows the document content into lines and pages on the fly.

You can use regular expressions to font the required content. Unfortunately, in the current version of Aspose.Words for python, you cannot use IReplacingCallback to replace the matched text with other kind of nodes (the feature request is logged as WORDSNET-24685). Currently, you can only replace the matched text with other text.