Preparing a Document in OpenOffice

Hi there
I was interested to know we could create a document as described below in Openoffice, and if so how?
https://docs.aspose.com/words/net/mail-merge-template/
Thanks

This message was posted using Page2Forum from Prepare a Document - Aspose.Words for .NET and Java

Hi Jason,
Using Aspose.Words you can load and use a similar document to the one you specified in .ODF format. Check here for details of the features supported in ODF.
I’m not quite sure what it is your requesting though, could you clarify exactly what part you are having trouble with?
Thanks,

Hi Adam,
Thank you for the prompt response. We were looking to create a Mail Merge Document in Openoffice, we had tried using the one we give our clients from Word but it removes the merge fields.
What is the best way that we could create these documents in Openoffice?
Thanks

Hi Jason,
Cheers. Can you attach your document here and the code your using and we’ll take a look at whats happening.
Thanks,

Hi

Thanks for your inquiry. To insert merge fields in OpenOffice, you first should setup Mail Merge data source. This can be a simple TXT file, which contains field names separated by coma. Please see the following link to learn how to setup data source:
http://wiki.services.openoffice.org/wiki/Documentation/How_Tos/Creating_Mail_Merge_Documents_From_Text/CSV_or_Spreadsheets
Once your data source is setup, you can insert merge fields. Go to Insert/Fields/Other menu, select Database tab, select “Mail merge fields” and then select name of field from your data source.
Unfortunately, OpenOffice does not allow inserting merge fields without data source.
Best regards.

Thanks Alexey.

I have just tried this and it doesn’t seem to merge my document with our data. Is it possible for you to send me a sample document that I could take a look at?

Would I need to collect the data from our database and then run the merge or could it work from our application?
Also, does it matter what the document type is?
Regards

Hi

Thanks for your inquiry. I attached sample template and output document produced by the following code:

// Open template.
Document doc = new Document(@"Test001\in.odt");
// Execute simple mail merge.
doc.MailMerge.Execute(new string[]
{
    "FirstName",
    "LastName",
    "City"
}, new object[]
{
    "James",
    "Bond",
    "London"
});
// Save output document.
doc.Save(@"Test001\out.odt");

Hope this helps.
You can execute mail merge in your application, you should just properly setup your template.
Best regards.

Many Thanks Alexey, we have this working now.
Just one more question if I may, how do I format my amount fields to show as $$ currency when we run the merge? I have tried changing the fields to currency and it doesn’t seem to pick these up.
Cheers

Hi

Thanks for your inquiry. You can specify format of data using formatting switches. Please see the following link to learn more about formatting switches in merge fields:
http://office.microsoft.com/en-us/word/HP051871801033.aspx
However, unfortunately, I cannot see any option in OpenOffice to specify this in the field’s code. I suppose, OpenOffice stores format of merge field somewhere in different place. So the only option, I can suggest at this stage is using MS Word to create templates.
Best regards.