Calculated form fields based on other form fields not updating


#1

I’m having problems getting calculated legacy form fields to work correctly (sample code below). When I open the output file in Word the contents of the field depend on the Aspose version - earlier versions have “!The Formula Not In Table” and later versions leave the field empty. I can double click that field then click “OK” in the options dialog without changing any settings to get it to update with the correct value, but I thought Aspose was able to update and populate calculated fields.

      var doc = new Document();
      var builder = new DocumentBuilder(doc);

      builder.InsertBreak(BreakType.ParagraphBreak);
      builder.InsertTextInput("text1", TextFormFieldType.Number, string.Empty, "1", 50);

      builder.InsertBreak(BreakType.ParagraphBreak);
      builder.InsertTextInput("text2", TextFormFieldType.Number, string.Empty, "1", 50);

      builder.InsertBreak(BreakType.ParagraphBreak);
      builder.InsertTextInput("text3", TextFormFieldType.Number, string.Empty, "1", 50);

      builder.InsertBreak(BreakType.ParagraphBreak);
      var field = builder.InsertTextInput("text4", TextFormFieldType.Calculated, string.Empty, string.Empty, 50);
      field.CalculateOnExit = true;
      field.TextInputDefault = "=SUM(text1, text2, text3)";
      
      doc.UpdateFields();

      doc.Save("test.docx");

Am I missing something?


#2

@mattb123456,

We have logged your problem in our issue tracking system. Your ticket number is WORDSNET-19209. We will further look into the details of this problem and will keep you updated on the status of the linked issue. We apologize for any inconvenience.