How to enumerate word document using office interop API?
Posted
by
Shekhar
on Stack Overflow
See other posts from Stack Overflow
or by Shekhar
Published on 2010-08-18T12:21:09Z
Indexed on
2011/01/09
10:53 UTC
Read the original article
Hit count: 242
Hello everyone, I want to traverse through all the elements of an word document one by one and according to type of element (header, sentence, table,image,textbox, shape, etc.) I want to process that element. I tried to search any enumerator or object which can represent elements of document in office interop API but failed to find any. API offers sentences, paragraphs, shapes collections but doesnt provide generic object which can point to next element. For example :
<header of document>
<plain text sentences>
<table with many rows,columns>
<text box>
<image>
<footer>
(Please imagine it as a word document)
So, now I want some enumerator which will first give me <header of document>
, then on next iteration give me <plain text sentences>
, then <table with many rows,columns>
and so on.
Does anyone knows how we can achieve this? Is it possible?
I am using C#, visual studio 2005 and Word 2003.
Thanks a lot
© Stack Overflow or respective owner