8

I have a Microsoft Word document in DOCX format. I need to import it into Mathematica as a String preserving all formatting (font, size, bold/italic style, colors, etc), tables and embedded images with highest possible fidelity (Mathematica strings support formatting and arbitrary embedded expressions including images). All text should remain editable, so it should not be converted to an image. Is there a way to do this?

I can convert the document to RTF, PDF, XPS, MHT or ODT format before importing, if it helps.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Vladimir Reshetnikov
  • 7,213
  • 27
  • 75

2 Answers2

6

David Carlisle wrote about it back in 2007. The process seems to be rather cumbersome and I have not checked myself if it is reliable working but here are some links that might help you on your specific problem:

XHTML and MathML from Office 2007

Going Wordless at the Advanced Mathematica Summer School

Stefan
  • 5,347
  • 25
  • 32
  • Hi Stefan, can you show me a little about how to obtain the formulas in Word(maybe Mathtype form) in Notebook? I've tried a little, and Import .xml file(obtain form word) to Notebook. – HyperGroups Jun 23 '13 at 02:08
  • @HyperGroups sorry about my late answer. Embarrassingly no :(. I have no windows and on my mac I do have (astonishingly) Word 2011, but the equation editor is different from the windows version. I've tried it out, but the equations are immediately converted into jpg after exporting...sorry about that. I only had those links and posted them as an answer (concealing the fact, that I'm hopelessly clueless about any Office related question; failing even using these applications) – Stefan Jun 23 '13 at 11:35
  • 2
    I DID it 6 months after it was asked, see here: https://mathematica.stackexchange.com/a/65687/1056 – WolframFan May 06 '18 at 03:33
5

As of 14.0, Import of DOCX file is supported:

https://reference.wolfram.com/language/ref/format/DOCX.html

But the functionality doesn't fully meet your requirement i.e. "import it into Mathematica as a String preserving all formatting (font, size, bold/italic style, colors, etc), tables and embedded images" at least for now. Please check the examples in the document for more info.

xzczd
  • 65,995
  • 9
  • 163
  • 468