Hello everyone. I was converting .doc, .odt and .dot format files into .pdf using Aspose words for .NET.
My Aspose words version is 21.2.0.
I’m attaching the original files and generated files. You will see the generated files has “Name of Specialist (if required): -CUSTOM " where the original file has " Name of Specialist (if required): -”.
Below is the code that I used to convert the word file into PDF.
Aspose.Words.License license = new Aspose.Words.License();
//license.SetLicense("Aspose.Total.NET.lic");
Console.WriteLine("License set successfully.");
Aspose.Words.Document doc = new Aspose.Words.Document("C:\\Users\\abc\\Downloads\\Referral Elsa A (1).dot");
Aspose.Words.DocumentBuilder builder = new DocumentBuilder(doc);
// Create the headers.
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.Write("Attachment: Referral Elsa A.odt \n");
doc.UpdateFields();
doc.UpdatePageLayout();
doc.Save("C:\\Users\\abc\\Downloads\\Referral Elsa A (1).dot.pdf");
Interestingly, when I remove those line which write extra text to header, this problem is solved.
Also, this problem is occurring with specific files and not with all the files.
Copy paste of the line causing issue from original document - " Name of Specialist (if required): -" don’t know why there are these ** symbols in the text where as it does not display in the word or PDF. This could be causing some issue?
Any help is greatly appreciated.
Note: you may find some patient data in the files. It is all fake data and use at free will. Template and logos may be copy righted.
Referral Elsa A (1).dot.zip (486.3 KB)