Insert a Searchable Drawing in Word?

Is it possible to create a drawing where the text is searchable when inserted into a Word document? In addition to copy/paste from OmniGraffle into Word, I’ve tried exporting to PDF, EPS, and SVG and inserting those files. I was hoping one of those approaches would have preserved the text in a searchable form. However, all seem to simply get converted to a bitmap, so they can’t be searched.

And it is not just word. I exported image as PDF and search did not work in Pages or in Preview (which was a bit of a surprise).

Did you throw the graphic into a text editor and try searching for the text?

PDF and EPS and SVG are all data streams that would preserve the text as a string (barring extreme cases such as chopping the text into individual letters).

If you mean searchable from the default MS Word find dialog, that may be a long stretch – I think it’s unlikely that the Word search process is applied to inserted images at all, regardless of their nature.

As for PDF, text in images may well be encoded as vector paths (outlines of the graphic representation of characters – essentially numeric rather than textual data)

PS, if I wanted to some sort of diagram searching process ( a list of matching graphic coordinates derived from a text string, perhaps translated into cursor highlighting) then I would personally:

  1. Put MS Word aside – I don’t think it will be able to support that.
  2. Save the image as SVG (an XML text format)
  3. Query the SVG with XQuery

For example, if the SVG contains a <text> element like that below, containing the string “Hello world”, we can obtain X Y coordinates from that same tag:

<text transform="translate(272.5 154)" fill="black">
  <tspan font-family="Helvetica Neue" 
   font-size="16" font-weight="400" fill="black" 
   x="14.22" y="15">Hello world</tspan>
</text>

An HTML page with embedded SVG, and some JavaScript to manage querying and match-highlighting seems more plausible, but someone would have to put a bit of work into it.

This kind of thing might be a resource or starting point:

https://code.google.com/archive/p/svg-edit/

Martin,
Interesting tip, so I tested the exported files in BBEdit. PDF and EPS are encoded in a way that I can’t find the text with BBEdit. In SVG the text is easy to find.

draft8,
You appear to be correct. Despite the text being present in those formats, Word won’t search it.

So, I ran one more experiment. I created a test document where I inserted the PDF, EPS, SVG, and directly pasted from OmniGraffle. Then, I exported from Word to a PDF. In all 4 cases the diagram text is searchable in the exported PDF. So, regardless of how I move the drawing from OmniGraffle into Word, and despite Word’s search not working, the text is preserved and becomes searchable once exported to PDF.

That is acceptable. PDF will be the final document format anyway.

Thanks.

2 Likes