Chem4Word – Chemistry add-in for Microsoft Word

.Net Foundation

.Net Foundation

The Chemistry add-in for Word (Chem4Word) is a chemistry-aware add-in for Microsoft Word which is sponsored and supported by the .NET Foundation (http://dotnetfoundation.org).

Microsoft Office Extensibility

Starting with Microsoft Word 2007 (or later) users are given the option to store documents as Office Open XML files with a “.docx” extension. Such documents are no longer stored as binary files, but are extensible mark-up language (XML) files describing how the document is laid out, this XML data is compressed using the industry standard ZIP compression algorithm before being saved with the “.docx” extension.  The “x” of “.docx” signifies that the files contain compressed xml not the older binary data.

Microsoft Office allows a programmer to use the Microsoft Office extensibility layer called “Visual Studio Tools for Office” (VSTO) to write a .net program which will enhance the capabilities of office applications, such as Microsoft Word. They do this by writing a special program called an add-in.  Once an add-in is installed it runs when Microsoft Word is started.  Typically an add-in will create an extra Microsoft Office Ribbon to allow the user to interact with the document using its functions.

Microsoft Word add-ins can store complete XML documents called Custom Xml Parts inside a special area of a document.  Microsoft Word also has containers called Content Controls, which can store various types of content such as drawings.

How the Chem4Word Add-In works

The Chem4Word add-in stores the chemical structures as Chemical Mark-up Language (CML) in the aforementioned Custom XML Parts then renders the structure inside a Custom Controls using Drawing ML. If the user is running Word 2007 which does not support Drawing ML the add-in falls back to rendering the structures as a “.png” image.  The Chem4Word add-in also allows the user to depict the structure by one of its textual descriptors.  When you edit a chemistry structure and save the results, all of its linked visualisations are also updated.  A ChemSpider web service is then used to generate a code known as an InChiKey, this uniquely identifies the structure, the InChiKey is stored as an additional textual descriptor element inside the CML.

One big advantage of having the chemistry embedded as machine readable XML is that the data is very easily imported into other information systems such as SharePoint, allowing unique chemical structures to be catalogued and search.

The Chem4Word add-in allows the user to interact with chemistry in a document as follows

  • Edit / draw your structures using an embedded open source chemical structure editor called ChemDoodle Web Sketcher.
  • Edit textual descriptors for a structure.
  • Import chemical structures from web services such as PubChem and Opsin.
  • Import files in CML or MDL Molfile format.
  • Export drawn or imported structures in CML or MDL Molfile format. You can use this option to copy drawings to other documents of share them with colleagues.

A screen shot of Microsoft Office 2016 showing the Chem4Word ribbon and an embedded structure is shown below.

Chem4Word Add-In

Click to show full size

Further Information

You can download the latest version of the Chemistry Add in for Microsoft Word from our Codeplex site. The site also includes documentation, which includes a user guide and an architecture guide.

Help

If you have any problems using Chem4Word, then please get in touch with us via our Chem4Word facebook group page.

Are you’re a developer, who has Microsoft Visual Studio 2010 installed on your PC and are interested in seeing how the add-in works then you can download the latest source code from our source code repository at GitHub.

Do you have time to spare and wish to contribute to the project, if so please get in touch with us also via our Chem4Word facebook group page.

33,140 total views, 50 views today