How to write Multiple ROWS of DataTable to bookmark in Word 2007

Oct 19, 2011 at 5:24 AM

Hi,

I'm new to Power Tools and Open XML ..!

I have a DataTable with 20 rows. I have set up the word document (.docx) with necessary bookmarks.

I have loop the contents of the DataTable and tried to write the contents in to the document.

I can see only the last row written in to the document, since all the previous rows were replaced by the subsequent next row.

I need to write all the rows and column values in the document like table structure.

Thanks,

Oct 19, 2011 at 5:41 AM

Hi,

If you are familiar with HTML tables, you may find the following blog post to be helpful.
I think that you have a bug in your program which is causing you to replace previous row with next row. Instead of using bookmarks, I recommend using content controls to delineate content / spaces in a document.
-Eric
Oct 19, 2011 at 6:13 AM

Thanks Eric.

I will try in that way.

But as far as I tried, It just replaces the bookmarks with the text given.

So, when we loop though the rows in DataTable, it replaces values at the same place for all the 20 rows. Finally last row only present in the Document. What I need is like a linebreak (bookmark) or something like that to get that to next line when it reached the last column of DataTable.