Modifying Doc and Xls files

If you want to edit Word or Excel files programatically, you need to install Microsoft Office products (Word or Excel) in the machine and then use C# COM InterOp reference library to do so through your programs. The problem with COM InterOp library is that it needs Word or Excel application to be installed in the machine where this program will run which is going to modify the Doc or Excel sheets. This is so because COM InterOp actually executes the Word or Excel application to modify the document or excel sheet. One more downside is that you can handle only one document at a time through your application even if you execute multiple instances of your application. The whole process gets stuck if one document gets stuck due to any problem or the Word or Excel instance remains in memory from the previous work. The whole process is a very slow one. Moreover Microsoft does not recommend to do so in any server.

Open XML also lets you play with the content of Docx and Xlsx files programatically, like COM InterOp but with extensive benefits. Whatever you can do through COM InterOp you can do through OpenXML too. You can change font of some selected text, apply paragraph style, text style on any selected paragraph or text, delete text, insert text etc. The positive side of using open xml for the job is that you don't require Microsoft Word or Excel application to be installed on the machine on which you modify the Docx or Xlsx files and you can work on any no of documents at the same time using different instances of your application or using threads. It is way more faster too as it does not require to execute the Word or Excel application before doing any work on the Document or Excel Sheet.

 So here I present some basic tricks to work with Open XML word files.

Keep reading

Comments

Popular posts from this blog

Privacy Policy