We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Mail Merge with Aspose - Creation of an ODT template

Hello,

I am trying to create a template in Open Office that will be merged with Aspose.Words, but I encounter the two following problems :

  1. I have an image in the header of my odt template that disappear after Aspose mail merge.
  2. Is there any way to format fields after merging ? For example, I would like to format a Date field. With MS, I am using « Switches » and I am looking for an equivalent functionnality.

You will find in attachement : the ODT template, the result after Aspose mail merge.

I will be grateful for any help you can provide.

Mélodie

Hi Melodie,


Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-11843. Our product team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Secondly, I think, you can apply custom formatting to date fields values inside IFieldMergingCallback.FieldMerging event. Please refer to the following article:
http://www.aspose.com/docs/display/wordsnet/How+to++Apply+Custom+Formatting+during+Mail+Merge

Best regards,

Hello,


Thank you for your answer.

About the formatting, yes, I could use IFieldMergingCallback, but my goal is to do it without writing any specific code.

In fact, I am working on a project in which we want the final users to be able to generate their own templates (we provide the DataSource, they make use of it the way they want in their own documents).
Let’s take the example of a Date field : some users will want to display it in the format DD/MM/YYYY, some others may want to display it in the format DD-MM…

Do you know if there is a way to format fields in the template without writing any specific code (just like we would do with MS Word “switches”) ?

If not, we can still provide different fields in different format to the final user (date_long, date_short, etc…).

Best regards,
Mélodie



Hi Mélodie,


Thanks for your inquiry. During template creation/generation stage, against date fields in your data source, you can present user with a set of possible date formats in some drop down list for example and then based on selected value insert that format inside a newly created merge field. Please see the following code:

Document doc = new Document();

FieldMergeField mf = (FieldMergeField)doc.FirstSection.Body.FirstParagraph.AppendField(FieldType.FieldMergeField, false);

mf.FieldName = "mf";

FieldFormat ff = mf.Format;

ff.DateTimeFormat = "yyyy/MM/dd";

doc.MailMerge.Execute(new string[] { "mf" }, new object[] { DateTime.Now });

doc.Save(MyDir + @"15.3.0.odt");


I hope, this helps.

Best regards,

Ok, thank you.


Best regards,
Mélodie

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


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

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for .NET 18.12 update and this Aspose.Words for Java 18.12 update.