Question

Is there any way I can replace bookmarks in .NET, without having MS Office installed in the PC? The reason because, the bookmark in my case needs to be replaced in server and the client is not willing to install MS OFFICE at server side. Is there any .NET api's ore 3rd party api's which will do the job for me?

Many Thanks Girish

Was it helpful?

Solution

Given it's a bad idea to use the Office Automation API on a server anyway, don't worry about not having Office installed. Source: http://support.microsoft.com/kb/257757/en-us

If your documents are all the new Office Open XML (OOXML, .docx etc) format then you can open them as a *.zip file and modify the XML that defines the Document bookmarks. See here for more information: http://msdn.microsoft.com/en-us/library/office/bb448854(v=office.15).aspx Warning: the Office Open XML library is very bare-bones, so I hope you're billing by the hour.

The only other option (besides doing everything yourself, which you really don't want to do) is to use a third-party library and so far the only one I can recommend is Aspose ( http://www.aspose.com/ ), but it's expensive.

Disclaimer: I am a Microsoft employee, however this personal recommendation is from my own experience. I do not work on Office.

OTHER TIPS

If you are talking about Office documents that use the new .docx, .xlsx file formats then these are essentially a ZIP file containing XML. The documents conform to the Office Open XML Formats and can be manipulated just like any other piece of XML.

The following article gives an overview of how to do this. OOXML is pretty complex

How to: Manipulate Office Open XML Formats Documents

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top