After running the following code on certain Word documents to strip the headers and footers, the document will cause Word to lock up or crash. Do you have any suggestions as to why this code would cause this problem?
Thank you.
Dim Sec As Aspose.Word.Section
'----- Create a document to work with
Dim Doc As Aspose.Word.Document = New Aspose.Word.Document(FileName)
'----- Create a builder to work with our document
Dim builder As DocumentBuilder = New DocumentBuilder(Doc)
For Each Sec In builder.Document.Sections
Sec.ClearHeadersFooters()
Sec.DeleteHeaderFooterShapes()
Next
'----- Save the doc
Doc.Save(FileName)