Important Information

This project is hosted at : SourceForge.net Logo

Introduction

This is an Open Office mail merge class, it takes an open office documents and merges it with the data in a simple data xml file.

This replaces mailmerge.

By placing text fields delimited by << and >> the class will replace them with values in the data xml file.

This was written using the NetBean IDE 6.1 and, as it is all Java, will run on any operating system that supports Java. Currently it is targetting 1.6.0

In the source zip file there is a couple of examples but the basic principle is:

Your Open Office document has this in it:

 Dear <<salutation>>
   How are you...
 signed
   <<letterSender>>


The data xml file looks like this:

 
  <mailmerge>
    <record>
      <field name="salutation">
        Mr Smith
      </field>
      <field name="letterSender">
        medge
      </field>
    </record>
    <record>
      <field name="salutation">
        Mr Jones
      </field>
      <field name="letterSender">
        medge
      </field>
    </record>
  </mailmerge>

Which will produce:

 Dear Mr Smith
   How are you...
 signed
   medge
next page
 Dear Mr Jones
   How are you...
 signed
   medge

Top Of Page

1st June 2010
This is a rewrite of mailmerge, starting from scratch.
This is version 1.0.0

Top Of Page 23rd June 2010
Now looks into styles.xml for images that are used.
This is version 1.1.0

Top Of Page

PDF converter script for OpenOffice.org.

Add this code to you open office macros:
REM  *****  BASIC  *****
Sub ConvertWordToPDF(cFile)
   cURL = ConvertToURL(cFile)
   
   ' Open the document.
   ' Just blindly assume that the document is of a type that OOo will
   '  correctly recognize and open -- without specifying an import filter.
   oDoc = StarDesktop.loadComponentFromURL(cURL, "_blank", 0, Array(MakePropertyValue("Hidden", True), ))
   
   cFile = Left(cFile, Len(cFile) - 4) + ".pdf"
   cURL = ConvertToURL(cFile)
   
   ' Save the document using a filter.
   oDoc.storeToURL(cURL, Array(MakePropertyValue("FilterName", "writer_pdf_Export"), ))
   
   oDoc.close(True)
   
End Sub

Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
   Dim oPropertyValue As New com.sun.star.beans.PropertyValue
   If Not IsMissing( cName ) Then
      oPropertyValue.Name = cName
   EndIf
   If Not IsMissing( uValue ) Then
      oPropertyValue.Value = uValue
   EndIf
   MakePropertyValue() = oPropertyValue
End Function

Top Of Page