# Problem displaying eps exported histograms in Word 2010

I am having problems displaying histograms exported as .eps in Word 2010. I don't have problems though displaying them in a specialized .eps viewer. (Postsript viewer from Rampant logic) I am writing histograms because there were no problems in exporting or displaying any other plot type.

plot = Histogram[RandomVariate[NormalDistribution[0, 1], 200]]
Export["plot.eps", plot]


Could it be that .eps files for histograms are corrupted? I did not find a way to attach the .eps file, so I hope that I am not the only person with this problem, although this is kind of wicked.

-
Try printing your Word document on a PostScript printer (or a virtual printer that outputs PDF) and see if it displays fine that way. Word does not support displaying EPS on screen. It does give a rough approximation sometimes, but this is just an approximation, not the final appearance. –  Szabolcs Feb 26 '13 at 17:57
This seems to be more of a Word problem than anything to do with Mathematica. The usual format to use if you want to include figures in a Word document is EMF, not EPS. –  Oleksandr R. Feb 26 '13 at 17:57
Reference for my previous comment: office.microsoft.com/en-us/word-help/… EDIT This is for Word 2003, not sure if 2010 is different in this repsect –  Szabolcs Feb 26 '13 at 17:58
Thanks for your swift comments. I tried both printing to pdf and printing to paper and in both cases it only shows "This image cannot currently be displayed", the same message as in word,perhaps some standard error image. I want to use EPS because the quality of the plots is much better. EMF shows compression artifacts. Also I posted the question here as I thought it might be a bug in Mathematica which messes up only the histogram EPS code, but not the EPS code of any other plot. –  malumno Feb 26 '13 at 18:07
Hm, you are right. There also seems to be an issue, particular to the histogram, with EMF output: EMF is a vector format, just like EPS, yet this plot is being rasterized for export (hence the artifacts you see--they are not characteristic of the EMF format in general). I wonder what it is about histograms that causes difficulties with vector output formats. –  Oleksandr R. Feb 26 '13 at 18:48

This is not a complete solution to your problem, since I face the same issue (see also here). You can improve the screen display of EPS in Word by using the ImageResolution option, like this:

Export["epstestg.eps", epstest, {"Graphics"}, ImageResolution -> 300]


A word of warning that this feature expects actual Graphics. If you are actually wanting to export a Grid of graphics and other things as a single graphic (which my application requires), you will need to do something like this to get the thing to be exported:

epstest =
With[{mygraph =
mySpecialBarChartFunction[fakedata, ChartLayout -> "Stacked"]},
With[{dims = ImageDimensions[Rasterize[mygraph]]},
Graphics[Inset[mygraph], ImageSize -> First[dims ],
AspectRatio -> (dims[[2]]/dims[[1]]),
BaseStyle -> {FontFamily -> "Arial", FontSize -> 16}] ]]


## There is always a "But..."

In my tests, this results in acceptable results on-screen. It also prints nicely.

But...

When you then try to save the resulting Word document as a PDF, the EPS graphics show as black rectangles.

If I work out a workaround to this, I will revise this answer.

-