简体   繁体   中英

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM