I’m trying to process the attached document with the following code but I’m receiving error from the Aspose’s end. Could you please help?
try
{
Aspose.Words.License license = new Aspose.Words.License();
license.SetLicense("Aspose.Words.lic");
Document doc = new Document(@"C:\TEMP\test.docx");
Aspose.Words.Document document = doc;
string tempDOcxfile = "wordfile.docx";
document.UnlinkFields();
document.Range.Fields.Where(f => f.Type == FieldType.FieldNoteRef).ToList().ForEach(f => f.IsLocked = true);
foreach (Aspose.Words.Section section in document)
{
Aspose.Words.HeaderFooter Header;
Header = section.HeadersFooters[Aspose.Words.HeaderFooterType.HeaderPrimary];
section.PageSetup.HeaderDistance = 36;
section.PageSetup.TopMargin = 36;
section.PageSetup.FooterDistance = 36;
section.PageSetup.BottomMargin = 36;
}
document.UpdatePageLayout();
document.UpdateFields();
document.UnlinkFields();
try
{
Aspose.Words.Saving.SaveOutputParameters objSave = document.Save(@"C:\Temp\AsposeLatestout.pdf", SaveFormat.Pdf);
Aspose.Words.Saving.SaveOutputParameters objSaveWord = document.Save(@"C:\Temp\AsposeLatestout.docx", SaveFormat.Docx);
}
catch (Exception ex)
{
throw;
}
}
catch (Exception ex)
{
throw;
}
test.docx (1.7 MB)