bit bit - 1 year ago 169
C# Question

Copy Word Footnotes

I've two word documents. Both documents are equals except for footnotes (just one doc contains notes).
I need to copy that notes form one document to another one on the same position.
I'm using Microsoft.Office.Interop.Word COM reference..

Any idea?

bit bit
Answer Source

Well, I found a solution by mysefl:

  foreach (Microsoft.Office.Interop.Word.Footnote x in doc.Footnotes)

                    object selStart = x.Range.Start;
                    object selEnd = x.Range.End;
                    object missing = Type.Missing;
                    object footnote = x.Range.Text;
                    Range range = doc2.Range(ref selStart, ref selEnd);
                    doc2.Footnotes.Add(range, ref missing, x.Range.Text);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download