I am trying to find a way in Aspose.Words to clear out all “content” (text, tables, images, bookmarks, etc) from a document, and also preserve the styles at the same time? The idea is to copy a document, keep the basic document template, but blow away all of its content. My best stab at this so far has been the following:
Aspose.Words.Document newDocument = sourceDocument.Clone(); newDocument.RemoveAllChildren(); newDocument.RemoveMacros(); newDocument.Range.Bookmarks.Clear();
I know that Document.RemoveMacros() does the macro part of this, and Document.Range.Bookmarks.Clear() takes care of the bookmarks, but the remainder of the content is where I’m getting stuck.