I am new to Aspose and I am trying to delete the sections that are containing any remaining mergefields.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
I am struggling with this for a while now.
Any help is really appreciated.
I am stuck at:
Aspose.Words.Document document = new Document(this._DocumentStream);
DocumentBuilder builder = new DocumentBuilder(document);
// a list with the remaining merge fields
List<string> emptyFields = document.MailMerge.GetFieldNames().ToList<string>();
while (emptyFields.Count != 0)
{
string mergeField = emptyFields[0];
mergeField = emptyFields[0];
builder.MoveToMergeField(mergeField);
Section section = builder.CurrentSection;
if (section.ParentNode != null)
{
document.Sections.Remove(section);
}
}
document.Save(this._DocumentStream, this._DocumentFormat);
Thanks in advance.