Bryan
Bryan

Reputation: 857

Can I find the location of text in a Word document using OpenXML SDK?

I would like to put some known text in a Word doc and programmatically find it's x,y location with respect to the document or page using .NET. Is that possible? I was looking at using the OpenXML SDK but I don't see a path to getting that to work. Or could I use something like an image or bookmark to do this?

Ultimately I'm trying to save the Word doc as a PDF or image (using a library like Aspose) and overlay some content at that location. Any ideas are appreciated.

Upvotes: 0

Views: 2194

Answers (2)

This is an old question but I think it's helpful to point out this.

A solution is to put a placeholder text, find it it the document, replace it with an image and save.

This is explained in detail in this answer

Upvotes: 2

Bryan
Bryan

Reputation: 857

Based on further research and general understanding of the XML structure of the docs, it doesn't look like this is possible. I looked at the third party components from Aspose to see if they supported it and they don't from a Word doc, but it may be possible from a PDF. So I thought I'd post a link to that info: http://www.aspose.com/community/forums/thread/420805.aspx

Upvotes: 0

Related Questions