Hello,
I have noticed an issue regarding doc.UpdateFields(). When calling this method on the attached document, the values get really messed up. Instead of being 12 and 3, they become 78 and 18.
Please see the following code used to reproduce the issue:
var document = new Document(“testFile.docx”);
var source1 = document.FirstSection.Body.Paragraphs[2].GetText();
var source2 = document.FirstSection.Body.Paragraphs[3].GetText();
document.UpdateFields();
var current1 = document.FirstSection.Body.Paragraphs[2].GetText();
var current2 = document.FirstSection.Body.Paragraphs[3].GetText();
Console.WriteLine(source1, current1);
Console.WriteLine(source2, current2);
InternalID: 25714
Thank you,
Stanescu Jean-Alexandru
Junior Developer
IBM Romania
Hi Stanescu,
Best regards,
Hi Stanescu,
Thanks for being patient. Regarding WORDSNET-12384, our product team has completed the work on your issue and has come to a conclusion that this issue and the undesired behaviour you’re observing is actually not a bug in Aspose.Words. So, we have closed this issue as ‘Not a Bug’.
The problem occurs because Document.UpdateFields() doesn’t recalculate word count by itself. Please call Document.UpdateWordCount() prior to Document.UpdateFields() to fix this issue. Hope, this helps.
Best regard,
Hello again,
I have tried your fix and it seems to be working in this case. We also did not have the Words license set, so that would be another problem.
Thank you,
Jean-Alexandru Stanescu
Junior Developer
IBM Romania
Hi Jean,
Thanks for your feedback. It is great that the fix works for you. Secondly, please learn about the limitations when using Aspose.Words in evaluation mode here:
Best regards,