A
Alex
Hello people,
I am having an issue with a C# Word add-in (but a VBA solution could help as well).
I am trying to create a copy of the current document.
First naive attempt:
using Word = Microsoft.Office.Interop.Word;
object missing = System.Reflection.Type.Missing;
object no = false;
Word.Document doc = myWordApp.ActiveDocument;
Word.Document newDoc = myWordApp.Documents.Add(ref missing, ref missing, ref missing, ref no);
newDoc.Range(ref missing, ref missing).FormattedText = doc.Range(ref missing, ref missing);
That copied the text, formatting and bookmarks but not other elements like headers/footers, textboxes, graphics, etc.
Question: how do I create a copy that will include all the content and formatting in the original document?
Thank you.
Best wishes,
Alex.
I am having an issue with a C# Word add-in (but a VBA solution could help as well).
I am trying to create a copy of the current document.
First naive attempt:
using Word = Microsoft.Office.Interop.Word;
object missing = System.Reflection.Type.Missing;
object no = false;
Word.Document doc = myWordApp.ActiveDocument;
Word.Document newDoc = myWordApp.Documents.Add(ref missing, ref missing, ref missing, ref no);
newDoc.Range(ref missing, ref missing).FormattedText = doc.Range(ref missing, ref missing);
That copied the text, formatting and bookmarks but not other elements like headers/footers, textboxes, graphics, etc.
Question: how do I create a copy that will include all the content and formatting in the original document?
Thank you.
Best wishes,
Alex.