# How to make Mathematica graphs in Microsoft Word independent from Mathematica?

When I open a .docx file containing Mathematica graphs on a computer without Mathematica software installed, the graphs look corrupted. For example, PlotMarkers or FrameLabel looks differently. How can I keep these graphs looking as they were originally on a computer without Mathematica?

-
In my opinion, this question can be asked in a more generalised way: "Is there any way [or will there ever be] to keep [anything] as it is in [a] Microsoft Word file without changing text, shape, [position, colours, look, alignment, margins and document size]?" –  gpap Dec 12 '13 at 12:37
Can you try what whether the same issues appear when you export your graphics as wmf and include them in the docx? –  halirutan Dec 12 '13 at 14:53
Yes some of the issues are still over there, if I saved a graph and then open it in that system in which there is no mathematica software installed, frameMarkers, FrameLables and labelStyle are automatically changed. –  kamran Dec 12 '13 at 15:09

# Update

It's probably easier to use Edit -> Copy As -> Bitmap from the menubar. Changing the magnification of the notebook will change the size of the image that gets sent to the clipboard

There's likely a better answer out there, but I use a hack of the SEUploader to do this.

toclipboard2[] := If[
MemberQ[Hold[{}, $Failed, NotebookRead[$Failed]],
$Failed, (* there was nothing selected *) Module[{tag}, FrontEndExecute[ FrontEndToken[FrontEndSelectedNotebook[], "CopySpecial" , If[$OperatingSystem === "Windows", "MGF" , "TIFF" ]]];
Catch[
NotebookGet@ClipboardNotebook[] /.
r_RasterBox :> Block[{},
Throw[Image[First[r], "Byte" , ColorSpace -> "RGB"], tag] /; True];
$Failed, tag ] ] ]; CreatePalette[Button["clip", toclipboard2[]]]  This is the relevant section (the original function name is rasterizeSelection2). I'm assuming you are on a Windows platform, so this function should work for you. To use, execute the code, and a very small palette will appear. Highlight the cell you want to copy and click the "clip" button in the palette. Paste away. Note: I do use this function blindly; I don't understand all the ins and outs. @Szabolics can perhaps chime in and suggest why this is a good/bad idea. - It works well but resolution level of graphs is low when I printed out. Plz give suggestion(s), how it can be improve ? – kamran Dec 12 '13 at 14:31 @kamran You could use Magnify before copying the plot. – Sjoerd C. de Vries Dec 12 '13 at 14:42 ## The answer You create metafiles every time when you copy graphics from Mathematica FrontEnd and paste it in MS Word because it is native format for exchanging vector graphics under Windows. So your question is actually about corrupted metafiles in MS Word document opened on a machine without Mathematica fonts installed. This behavior is expected because unlike PDF and EPS formats metafiles do not allow font embedding. In the case when you cannot simply install Mathematica fonts on another machine you can preliminarily convert all the glyphs to outlines in Mathematica before exporting. The simplest way is to apply the following function to the whole graph: toOutlines = ImportString[ExportString[#, "PDF"], "PDF", "TextOutlines" -> True] &  The disadvantage of this approach is that all the glyphs will be outlined, not only glyphs from Mathematica fonts. If your problem is just PlotMarkers in ListPlot (which by default are glyphs from a Mathematica font) you could convert to outlines only them or specify PlotMarkers explicitly as graphical primitives. You can find an example here. Another alternative is to insert in the Word document not a metafile (which you do by default by selecting graphics in the FrontEnd, copying and pasting it in MS Word) but an EPS vector image with Mathematica fonts embedded in it. It is slightly more difficult because Mathematica's EPS export is rudimentary and you will need to Export your graphics to PDF first, then use third-party software to create EPS level 2 file from the exported PDF. But it is worth the effort because this way allows you to achieve the best possible vector quality for printing purposes. Here I discuss how to do it using free Poppler utilities for Windows, and here - using Adobe Illustrator or CorelDraw. If you are concerned mainly with on-screen appearance or the above methods give unsatisfactory results you always can revert to good old raster image format as described in the other answer. Here is a modification of that palette which copies graphics with target width of 1000 pixels: toclipboard3[] := Module[{selection = NotebookRead[SelectedNotebook[]]}, If[MemberQ[Hold[{},$Failed, NotebookRead[$Failed]], selection],$Failed (*there was nothing selected*),
CopyToClipboard[
Rasterize[
selection, Cell[BoxData[selection]]]},
Options[SelectedNotebook[]]], "Image", RasterSize -> 1000]]]];
CreatePalette[Button["Copy 1000 pixel width", toclipboard3[]]]


Note however that due to abundance of bugs and shortcomings in the current implementation of Mathematica's graphical functionality sometimes increasing resolution results in significant changes in the appearance of graphics (see this answer for discussion). It is often preferred to Export graphics to PDF first, then use Adobe Acrobat (or another renderer) for rendering it with arbitrary resolution.

The simplest way to copy notebook's content to MS Word while preserving original appearance is to copy as Metafile. Just select the cell(s) and copy, then paste in MS Word. The inserted content will appear in Word in vector form so you will not have any problems when printing. Note however that FrontEnd samples metafiles with screen-resolution fidelity, so if you copy graphics you sometimes will need to increase magnification in order to get better quality.

-
Another possible solution is to embed Mathematica fonts directly into the Word document as described in this answer. –  Alexey Popkov May 28 at 10:24

You may find setting this font option improves the appearance in Word:-

(* Take note of your original settings *)
originalsettings = Options[$FrontEnd, PrivateFontOptions] (* Set not to use Mathematica-only fonts *) SetOptions[$FrontEnd, PrivateFontOptions -> {"OperatorSubstitution" -> False}]

(* If you need to find your front end init file it should be here *)
FileNames["*init.m", FileNameJoin@
Append[FileNameSplit@\$UserBaseDirectory, "FrontEnd"], Infinity]
`
-