MERGEFIELD number formatting

@Ajisha To make the engine fill the whole cell rather than a piece of text between opening and closing backColor tags, it is needed to put the closing backColor at the end of the cell, so opening and closing backColor tags to capture the whole cell. For example see the following simple template:

Document doc = new Document("C:\\Temp\\in.docx");

ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, new object());
           
doc.Save("C:\\Temp\\out.docx");

in.docx (13.1 KB)
out.docx (10.3 KB)

@alexey.noskov I am using the latest version 24.8.0 in aspose.words and using the license aspose.total.net.lic. In this version the aspose.words wraps the text in the table to the next row. However the version 20.8 does not have this issue. Do you have a solution for this?

Thanks
Ajisha

@Ajisha Could you please attach your input, problematic and expected output documents along with code that will allow us to reproduce the problem? We will check the issue and provide you more information.

@alexey.noskov I used the latest version and the issue is resolved. Thanks

1 Like

Removed the content from the para

@Ajisha There is no defect in Aspose.Words. The table cell in your template is simply too narrow. So the content is wrapped. Here is a simplified document and code that demonstrates this:

Document doc = new Document(@"C:\Temp\in.docx");

ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, 4.529, "val");
            
doc.Save(@"C:\Temp\out.docx");
doc.Save(@"C:\Temp\out.pdf");

As you can see content is wrapped the same in MS Word and in PDF. So Aspose.Words renders the document the same way as MS Word does.
in.docx (80.0 KB)
out.docx (73.6 KB)
out.pdf (88.2 KB)

Is there a way we can fix this without touching the document

The same document works perfectly with the aspose version 20.8. Can you please tell me why the version renders differently.

@Ajisha

No, I am afraid without modifying the template, there is no way to resolve this.

The development goal of the Aspose.Words Document Layout Engine is to make it as close to MS Word as possible, rather than maintaining the same rendering results as older versions of Aspose.Words. This means that differences in document layout may occur between older and newer versions due to continuous improvements in the layout engine.

You’re comparing versions 20.8 and 25.3 of Aspose.Words, which represent about 5 years of development. The output produced by the newer version is closer to the results in MS Word. It’s likely that the older version had a bug or a missing feature that, by coincidence, produced the rendering result you expected.