Problems with Merge Fields

Dear Aspose Team,

i got a problem, when using a merge field with a calculation. In the draft the calculation is performed. But in the generated document the whole merge field is deleted.

Please see encluded documents.

Thanks for your help.

Frank

Hi

Thanks for your inquiry. Could you please attach your template here for testing and provide me your code? I will check the issue on my side and provide you more information.
Best regards,

Hello Andrey,

thanks for your Request. The templatefile is the file named “in.doc”. The used code is here:

import com.aspose.barcode.BarCodeBuilder;
import com.aspose.barcode.License;
import com.aspose.barcode.Symbology;
import com.aspose.words.BorderType;
import com.aspose.words.Document;
import com.aspose.words.DocumentBuilder;
import com.aspose.words.LineStyle;
import com.aspose.words.ParagraphAlignment;
import com.aspose.words.TextureIndex;
import com.aspose.words.Underline;

import java.awt.*;

public class Hauptklasse
{
    public static final void main(String args[]) throws Exception {

        // Open the template document
        Document doc = new Document("C:\in.doc");

        // Once the builder is created, its cursor is positioned at the beginning of the document.
        DocumentBuilder builder = new DocumentBuilder(doc);

        // Specify font formatting before adding text.
        builder.getFont().setSize(16);
        builder.getFont().setBold(true);
        builder.getFont().setColor(Color.BLUE);
        builder.getFont().setName("Arial");
        builder.setUnderline(Underline.DASH);
        builder.write("This text");
        builder.setUnderline(Underline.NONE);
        builder.write(" is inserted at the beginning of the document and demonstrates ");

        // Set shading and border around a run of text, then clear the border.
        builder.getFont().getShading().setForegroundPatternColor(Color.CYAN);
        builder.getFont().getShading().setTexture(TextureIndex.TEXTURE_SOLID);
        builder.write("various font");
        builder.getFont().getShading().clearFormatting();
        builder.getFont().getBorder().setLineStyle(LineStyle.SINGLE);
        builder.write(" formatting ");
        builder.getFont().getBorder().clearFormatting();
        builder.writeln("options.");
        builder.insertParagraph();

        // Move the insertion cursor to a merge field.
        builder.moveToMergeField("MyInsertionPlace1");

        // Specify paragraph formatting before calling InsertParagraph or Writeln.
        builder.getParagraphFormat().getBorders().get(BorderType.TOP).setLineStyle(LineStyle.DOUBLE);
        builder.getParagraphFormat().getBorders().get(BorderType.TOP).setLineWidth(2);
        builder.getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
        builder.getParagraphFormat().getShading().setForegroundPatternColor(new Color(240, 255, 255));
        builder.getParagraphFormat().getShading().setTexture(TextureIndex.TEXTURE_SOLID);
        builder.getParagraphFormat().setLeftIndent(2 * 72); //2 inchdes by 72 points.
        builder.getParagraphFormat().setSpaceBefore(12);
        builder.getParagraphFormat().setSpaceAfter(12);
        builder.getFont().setName("Arial");
        builder.getFont().setSize(12);
        builder.write("This fragment demonstrates use of paragraph formatting to specify ");
        builder.writeln("alignment, spacing, borders and shading.");
        builder.getParagraphFormat().clearFormatting();

        doc.save("C:\out.doc");
    }
}

The generated output file is: “out.doc”.

Now i have the following problem. You see the fields in the template file “in.doc”. When you type in the Fields “Länge” “Breite” “Höhe” integer Values, the field “Volumen” calculates the result.

When i open this file with Aspose and do thinks like above, and save the file, the calculate field swallow the formula for calculation.

Please help, because the code didn’t do something with the calculation formel.

Thanks for help

Frank

Hi

Thank you for additional information. I managed to reproduce the problem on my side. You will be notified as soon as it is resolved.
Best regards.

Hi,

can you give me a approximate timeline when the problem is resolved?

Best regards.

Frank

Hi

Thanks for your inquiry. Currently it is difficult to provide you a reliable estimate regarding this issue. Please expect a reply before the next hotfix (within 4-5 weeks).
Best regards,

Hello,

i tested the version 4.0.0 beta. In this version the error isn’t fixed. Is this right?

With best regards.

Frank

Hi

Thanks for your request. Yes you are right, unfortunately, the issue is still unresolved in this version. You will be notified as soon as it is fixed.

Best regards,

Hi Frank,

It seems the problem you have reported earlier does not occur with the latest version of Aspose.Words. Could you please check and confirm? You can download the latest version of Aspose.Words for java from here:
https://releases.aspose.com/words/java
Best regards.

Hi Alexey,

i testet the document with Aspose.Words.Java v4.0.2Beta and the bug is stll present. The fields are no longer fields and no calculation where made.

Please confirm.

With best regards.

Frank

Hi Frank,

Thank you for additional information. Yes, I confirm that the problem still persist in Java version of Aspose.Words. however, it already resolved in .NET version. We will let you know once the fix is ported to Java.
Sorry for inconvenience.
Best regards.

The issues you have found earlier (filed as 11209) have been fixed in this .NET update and in this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.