OpenOffice Mailmerge service

Posted by hinko65 on 24-Jul-2014 03:21

Hi,

We want to implement a MailMerge service in OpenOffice. I have found a ABL code example of opening a writer document. I'm trying to implement a MailMerge service in ABL for OpenOffice.

Does anybody have experience with this and wants to share that with me?

Thanx,

Hinko van der Boom

Netherlands

All Replies

Posted by RWEBSTER on 24-Jul-2014 07:42

Do you have your heart set on Openoffice documents? AlonB has created a really nice set of tools for creating DOCX files straight from ABL, which are really well suited to creating mailmerges.

community.progress.com/.../10549.aspx

Posted by jmls on 24-Jul-2014 07:44

https://www.gov.uk/government/news/open-document-formats-selected-to-meet-user-needs

;)

On 24 July 2014 13:42, RWEBSTER
wrote:
> RE: OpenOffice Mailmerge service
> Reply by RWEBSTER
>
> Do you have your heart set on Openoffice documents? AlonB has created a
> really nice set of tools for creating DOCX files straight from ABL, which
> are really well suited to creating mailmerges.
>
> community.progress.com/.../10549.aspx
>
> Stop receiving emails on this subject.
>
> Flag this post as spam/abuse.



--
Julian Lyndon-Smith
IT Director,
dot.r
http://www.dotr.com

Posted by hinko65 on 24-Jul-2014 07:49

Rwebster : thank you for your info about creating docx files.

All our customers are using Word. But at this moment we have a large prospect who is using OpenOffice. And we don't want to lose that prospect. Thay is why we want to have a MailMerge in OpenOffice.

Posted by andrew.may on 24-Jul-2014 08:19

Alon was recently asking people what they would want as a next feature of his docx libraries.
 
I believe that OpenOffice support was one of the options.
Might be worth contacting him.
 
[collapse]
From: jmls [mailto:bounce-jmls@community.progress.com]
Sent: 24 July 2014 13:45
To: TU.OE.Development@community.progress.com
Subject: Re: [Technical Users - OE Development] OpenOffice Mailmerge service
 
Reply by jmls
https://www.gov.uk/government/news/open-document-formats-selected-to-meet-user-needs

;)

On 24 July 2014 13:42, RWEBSTER
wrote:
> RE: OpenOffice Mailmerge service
> Reply by RWEBSTER
>
> Do you have your heart set on Openoffice documents? AlonB has created a
> really nice set of tools for creating DOCX files straight from ABL, which
> are really well suited to creating mailmerges.
>
> community.progress.com/.../10549.aspx
>
> Stop receiving emails on this subject.
>
> Flag this post as spam/abuse.



--
Julian Lyndon-Smith
IT Director,
dot.r
http://www.dotr.com
Stop receiving emails on this subject.

Flag this post as spam/abuse.





Business Computer Projects Ltd is a limited company registered in England and Wales.

Registered number: 1813992. Registered office: BCP House, 151 Charles Street, Stockport, Cheshire SK1 3JY. Tel: +44 (0)161 355-3000. Fax: +44 (0)161 355-3001 Web: http://www.bcpsoftware.com

Disclaimer: This message, and any associated attachment is confidential. If you have received it in error, please delete it from your system, do not use or disclose the information in any way, and notify either the sender or Postmaster@BCPSoftware.com immediately. The contents of this message may contain personal views which are not necessarily the views of Business Computer Projects Ltd., unless specifically stated. Whilst every effort has been made to ensure that emails and their attachments are virus free, it is the responsibility of the recipient(s) to verify the integrity of such emails.
[/collapse]

Posted by blichal on 24-Jul-2014 09:20

The first question I would ask is how complicated are the documents you will be creating (or plan to create in the future)? If it's simple letters, mail merge could definitely do the job. I think, as long as it's a single page, no repeating sections and only fields then you're good (although there are all kinds of tricks to create simple lists with some work).

BTW if you're planning to run the mail merge code in UNIX/Linux, you'll probably need to do it from another language besides progress if the code you looked at uses com-handles then it won't work on UNIX/Linux.

You could open .docx files in openoffice/libreoffice and there are also other converters but compatibility isn't perfect and in some cases it's far from it.

You could create the openoffice files directly (the xml files wrapped in a zip), I'd be happy to show you but it's alot of dirty work.

How soon do you need it? if it's a few month or so, maybe it's possible and in the meantime you could use the docx library. .docx and .odt files are very similar in essence so it's not an impossible thing to do.

BTW if you create the files in the free docxfactory project, it will be extremely fast. You could create a file in 0.02 seconds. Plus it has a ton of features like support for a extensive list of 80, 1D and 2D barcodes and you could also create Excel files, not just Word files.

Good luck and please share your findings.

Posted by rab on 04-Aug-2014 08:18

Hello blichal,

My colleague Hinko is on holiday but I got it working. See source code below. The goal is to create simple letters. We need it in a few months or so but one of these days we need to confirm with our prospect that we can support OpenOffice.

There is one problem. If the datasource connects to a text file (e.g. CSV), the encoding should be ANSI and not UTF-8 otherwise OpenOffice does not detect the first column.

/* oo-mailmerge.p
 * Perform mailmerge in OpenOffice.
 * The source document already contains the data source 'test'.
 * Versions:
 * OpenEdge 11.3.2 (32-bits)
 * OpenOffice 4.1.0
 * OS: Windows 7 Ultimate (32-bits)
 */

define variable sourcedoc        as character  no-undo initial 'C:/Temp/test-basis.odt'.
define variable outputdir        as character  no-undo initial 'C:/Temp/'.
define variable outputfile       as character  no-undo initial 'MERGED'.
define variable datasource       as character  no-undo initial 'test'.
define variable tablename        as character  no-undo initial 'test'.
define variable hOO_application  as com-handle no-undo.
define variable hOO_mailmerge    as com-handle no-undo.
define variable Args             as raw        no-undo.

session:appl-alert-box = true.

/* Start OpenOffice application or get handle to running application. */
message 'Start OpenOffice'.
create "com.sun.star.ServiceManager" hOO_application.

/* Create mailmerge service. */
hOO_mailmerge = hOO_application:createinstance("com.sun.star.text.MailMerge").

/* Set mailmerge properties.
 * http://www.openoffice.org/api/docs/common/ref/com/sun/star/text/MailMerge.html
 */
message 'Set mailmerge properties'.
assign
  hOO_mailmerge:DocumentURL    = 'file:///' + sourcedoc /* source document (forward slashed only) */
  hOO_mailmerge:DataSourceName = datasource             /* name of data source (included in source document) */
  hOO_mailmerge:CommandType    = 0                      /* 0 = table name, 1 = query name, 3 = SQL command */
  hOO_mailmerge:Command        = tablename              /* name of table in data source */
  hOO_mailmerge:OutputType     = 2                      /* 1 = printer, 2 = file, 3 = email */
  hOO_mailmerge:OutputUrl      = 'file:///' + outputdir /* output directory (forward slashes only) */
  
  /* There are 2 ways to generate output: one single file or multiple individual files */
  
  /* 1. Output to a single file */
  hOO_mailmerge:FileNameFromColumn = false      /* explicitly set output file name */
  hOO_mailmerge:FileNamePrefix     = outputfile /* output file name (excl. extension) */
  hOO_mailmerge:SaveAsSingleFile   = true       /* save as single file */
  
  /* 2. Output to multiple individual files
  hOO_mailmerge:FileNameFromColumn = true       /* get file name from data source column */
  hOO_mailmerge:FileNamePrefix     = 'column1'  /* name of data source column */
  hOO_mailmerge:SaveAsSingleFile   = false      /* save as multiple files */
  */
  .

/* Execute mailmerge.
 * The execute method takes a sequence (array) of com.sun.star.beans.NamedValue objects.
 * It is not clear how to create such a sequence in ABL, but fortunately this not required.
 * Instead, we feed an empty object of the RAW datatype to the execute method.
 * This causes the mailmerge service to use the default properties we set above.
 */
message 'Execute'.
hOO_mailmerge:execute(Args).

/* Dispose mailmerge service */
message 'Dispose'.
hOO_mailmerge:dispose().

release object hOO_mailmerge   no-error.
release object hOO_application no-error.

Do you have more information on direct manipulation/creation of the OpenOffice ODT ZIP files? We are doing something similar with DOCX/XSLX files but we are getting complaints from some our users, so the Docxfactory seems to be the better solution. Thank you for that.

This thread is closed