Hi,
I just switched from the 4.0.3 Version to the 14.6.0 version of Aspose.Words.
I have found some issues that have worked in the previously version but not in the new version:
- Repeated table headers
- I am using a template that contains a table. The first row is marked as header in the template and the data is inserted using the mail merge feature. In the old version the table headers where repeated at each page of the created document if the table is longer than one page. This don’t work anymore
- IFieldMergingCallback not called
- Version 14.6.0 changed the interface for callbacks during the mail merge. I am using 4 of these callbacks. I changed the interface to the new IFieldMergingCallback interface and adding support for images (merge fields that starts with Image: tag). The image callback is using the method imageFieldMerging and is called correctly. All other callbacks are no longer called (The method fieldMerging is not called). I didn’t changed the way to register the callbacks:
- document.getMailMerge().setFieldMergingCallback(new HtmlMergeFieldHandler(documentBuilder));
- The HtmlMergeFieldHandler is instantiated but the fieldMerging method is not called. The usage seems to be pretty the same as described in https://reference.aspose.com/words/java/com.aspose.words/FieldMergingArgs
Some features are still missing:
- If using the TableStart: / TableEnd: Tags for multiple data entries in a table, each data entry is delimited by a linebreak. Is there a way to set an own delimiter (like ‘,’) for suppressing the starting of a new line for every entry?
- I think this is filed as WORDSNET-3197 Issue
- If a table in a word doocument that is used as template for mail merge is column-sorted, the sorting is not available in the created document.
A feedback about these points would be very nice.
Hi Sascha,
Thanks for your inquiry.
SaschaRue:
- Repeated table headers
- I
am using a template that contains a table. The first row is marked as
header in the template and the data is inserted using the mail merge
feature. In the old version the table headers where repeated at each
page of the created document if the table is longer than one page. This
don’t work anymore
IFieldMergingCallback not called
- Version
14.6.0 changed the interface for callbacks during the mail merge. I am
using 4 of these callbacks. I changed the interface to the new
IFieldMergingCallback interface and adding support for images (merge
fields that starts with Image: tag). The image callback is using the
method imageFieldMerging and is called correctly. All other callbacks
are no longer called (The method fieldMerging is not called). I didn’t
changed the way to register the callbacks:
- document.getMailMerge().setFieldMergingCallback(new HtmlMergeFieldHandler(documentBuilder));
- The
HtmlMergeFieldHandler is instantiated but the fieldMerging method is
not called. The usage seems to be pretty the same as described in
https://reference.aspose.com/words/java/com.aspose.words/FieldMergingArgs
It would be great if you please share following detail for investigation purposes.
- Please attach your input Word documents.
- Please
create a standalone/runnable simple Java application that demonstrates the code (Aspose.Words code) you used to generate
your output document
- Please attach the output Word file that shows the undesired behavior.
- Please
attach your target Word document showing the desired behavior. You can
use Microsoft Word to create your target Word document. I will
investigate as to how you are expecting your final document be generated
like.
Unfortunately,
it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) and simple project to
reproduce the problem. As soon as you get these pieces of information to
us we’ll start our investigation into your issue.
*SaschaRue:
If using the TableStart: / TableEnd:
Tags for multiple data entries in a table, each data entry is delimited
by a linebreak. Is there a way to set an own delimiter (like ‘,’) for
suppressing the starting of a new line for every entry?*
- I think this is filed as WORDSNET-3197 Issue
Unfortunately, Aspose.Words does not support the
requested feature at the moment. We had already logged this issue in our
issue tracking system. Yes, the ID of this issue is WORDSNET-3197.
Your thread has been linked to this issue and you will be notified via
this thread once this issue is resolved. We apologize for your
inconvenience.
*SaschaRue:
If
a table in a word doocument that is used as template for mail merge is
column-sorted, the sorting is not available in the created document.*
Could you please share your input, expected output document along with code here for our reference? We will then provide you more information about this query along with code.
Hi,
I am on vacation for one week, afterwards I will supply the runnable code for you.
Is there an estimation when the WORDSNET-3197 issue will be solved as our cutomer needs this feature urgently.
Best regards
Hi Sascha,
Thanks for your inquiry. I have requested the development team to share the ETA of this feature. As soon as any information is shared by them, I will be more than happy to share that with you. Thanks for your patience.
Hi,
while developing the sources for showing the behaviour, I found out, that repeating table headers are working just fine.
For the other problems, I added an example.
-
Sorting not available. See Output.docx for the output of the test programm. If you highlight the table and select table options, you’ll notice that the sorting (first column desc) was taken over from the Input.docx file but the sorting was not done. (After clicking “Ok” you’ll get the Output-wanted.docx with the correct sorting).
-
IFieldMergingCallback is never called: In our previous version (4.0.6) you could add more than on IFieldMergingCallback and all were called during execution. In the given programm example, only the second one is called. Is there a way to add more than one IFieldMergingCallback so I don’t have to combine all callbacks that I am actually using?
Best regards
Hi Sascha,
Thanks for sharing the detail.
*SaschaRue:
- Sorting not available. See Output.docx for the output of the test programm. If you highlight the table and select table options, you’ll notice that the sorting (first column desc) was taken over from the Input.docx file but the sorting was not done. (After clicking “Ok” you’ll get the Output-wanted.docx with the correct sorting).*
Could you please share some more detail about this query?
If you want to sort table’s data by columns,
Aspose.Words does not support this feature. However, we had already
logged this feature as WORDSNET-6022 in our issue tracking system. You
will be notified via this forum thread once this feature is available.
We apologize for your inconvenience.
*SaschaRue:
- IFieldMergingCallback is never called: In our previous version (4.0.6) you could add more than on IFieldMergingCallback and all were called during execution. In the given programm example, only the second one is called. Is there a way to add more than one IFieldMergingCallback so I don’t have to combine all callbacks that I am actually using?*
This is the expected behavior of Aspose.Words. If you want to use IFieldMergingCallback more then once, you can achieve this. In this case, you need to call MailMerge.ExecuteWithRegions multiple times with different data sources. For each call, you need to implement IFieldMergingCallback separately. Please check the following highlighted code snippet.
Document document = new Document(MyDir + "Input.docx");
document.getMailMerge().setFieldMergingCallback(new IFieldMergingCallback() {
public void imageFieldMerging(ImageFieldMergingArgs fieldMergingArgs) throws Exception {
}
public void fieldMerging(FieldMergingArgs arg0) throws Exception {
System.out.println("Called first callback");
}
});
document.getMailMerge().executeWithRegions(new IMailMergeDataSource() {
.....
.....
.....
});
document.getMailMerge().setFieldMergingCallback(new IFieldMergingCallback() {
public void imageFieldMerging(ImageFieldMergingArgs fieldMergingArgs) throws Exception {
}
public void fieldMerging(FieldMergingArgs arg0) throws Exception {
System.out.println("Called second callback");
}
});
document.getMailMerge().executeWithRegions(new IMailMergeDataSource() {
.....
.....
.....
});
document.save(MyDir + "Output.docx");
The issues you have found earlier (filed as WORDSNET-3197) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(15)
Hi Sascha,
Thanks for being patient.
Regarding WORDSNET-3197, it is to update you that we have closed this issue. We have introduced a new LINQ Reporting Engine which is a part of the Aspose.Words API that enables you to build reports using an extended set of reporting features. The engine enables you to reference business objects of your application in report templates directly, which agrees well with Domain-Driven Design widely used in modern software development. Moreover, the engine uses a subset of C# language in its template syntax. These features enable you as a developer to compose report templates in a familiar and intuitive way.
For example, using this new reporting engine you can repeat part of a Paragraph as follows:
DocumentBuilder builder = new DocumentBuilder();
builder.write("The items are: <<foreach [item in items]>><<[item]>>, <>and others.");
Document doc = builder.getDocument();
ArrayList arrList = new ArrayList();
arrList.add("Item1");
arrList.add("Item2");
arrList.add("Item3");
ReportingEngine engine = new ReportingEngine();
engine.buildReport(doc, arrList, "items");
doc.save(getMyDir() + "out.docx");
For more details, please visit this article:
https://docs.aspose.com/words/java/working-with-common-data-bands/
I hope, this helps.
Best regards,