Insert a Table instead of a Paragraph

I have a problem when inserting a Table to a Document who contains Header or Footer – the table is corrupted.
The table is inserted fine if there is no header or footer.
sect.Body.InsertAfter(table, paragraph)
Thanks

Please attach the template document and a code snippet sufficient to reproduce the error.

Problem solved.
I changed the code a bit and the table is no longer corrupted.
Thanks