Re: [SQL] Re: [GENERAL] Link Office Word form document with data from PostgreSQL

2015-03-30 Thread Vincenzo Campanella

Il 30.03.2015 15:01, Vincent Veyron ha scritto:

Hi,

I use Perl for this. The process is :

-unzip the .docx document, and look for /word/document.xml in the resulting 
directory
-substitute field names with their values in this file (I don't use MS Word 
'fields', though, just placeholders that are unlikely to be found in documents, 
such as client_name, client_address, facturation_date, etc)
-zip the archive anew with a .docx extension

VoilĂ .

The code is about 40 lines long, I can post it if you care; the same process 
also works with Libre/OpenOffice documents


Hi Vincent, could you please post the code? That would be very nice.

Thank you
vince


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [SQL] Re: [GENERAL] Link Office Word form document with data from PostgreSQL

2015-03-30 Thread Vincent Veyron
On Mon, 30 Mar 2015 17:37:28 +0200
Vincenzo Campanella vin...@gmail.com wrote:
Stirling Newberry stirling.newbe...@gmail.com wrote:

post the code

Here you go :

http://pastebin.com/eVXZiFws


This is a mod_perl module used in the HeaderParser phase of the Apache request 
cycle; it first grabs the sql associated with the model, and passes parameters 
to it; this sql is used to retrieve the required values for the model, and the 
placeholders in the document are replaced with those values. The user is then 
redirected to the newly created document

You can see it in action in the demo account of the site referenced in my 
signature : open any file (those are legal files/insurance claims), click on 
the 'Contributors' tab (third tab from left; add a contributor if none is 
present), and click on 'Templates'. Click on the template to generate a document


-- 
Salutations, Vincent Veyron 

https://legalcase.libremen.com/ 
Legal case, contract and insurance claim management software


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [SQL] Re: [GENERAL] Link Office Word form document with data from PostgreSQL

2015-03-30 Thread avpro avpro
thank you all for your responses.

I think to easiest option for me would be to use the ODBC connection. Now
my problem is where to start with the VBA code; but that's for another list.
cheers

On 30 March 2015 at 19:51, Vincent Veyron vv.li...@wanadoo.fr wrote:

 On Mon, 30 Mar 2015 17:37:28 +0200
 Vincenzo Campanella vin...@gmail.com wrote:
 Stirling Newberry stirling.newbe...@gmail.com wrote:

 post the code

 Here you go :

 http://pastebin.com/eVXZiFws


 This is a mod_perl module used in the HeaderParser phase of the Apache
 request cycle; it first grabs the sql associated with the model, and passes
 parameters to it; this sql is used to retrieve the required values for the
 model, and the placeholders in the document are replaced with those values.
 The user is then redirected to the newly created document

 You can see it in action in the demo account of the site referenced in my
 signature : open any file (those are legal files/insurance claims), click
 on the 'Contributors' tab (third tab from left; add a contributor if none
 is present), and click on 'Templates'. Click on the template to generate a
 document


 --
 Salutations, Vincent Veyron

 https://legalcase.libremen.com/
 Legal case, contract and insurance claim management software



Re: [SQL] Re: [GENERAL] Link Office Word form document with data from PostgreSQL

2015-03-30 Thread Ken Tanzer
On Mon, Mar 30, 2015 at 1:51 PM, avpro avpro avprowebe...@gmail.com wrote:

 thank you all for your responses.

 I think to easiest option for me would be to use the ODBC connection. Now
 my problem is where to start with the VBA code; but that's for another list.
 cheers

 On 30 March 2015 at 19:51, Vincent Veyron vv.li...@wanadoo.fr wrote:

 On Mon, 30 Mar 2015 17:37:28 +0200
 Vincenzo Campanella vin...@gmail.com wrote:
 Stirling Newberry stirling.newbe...@gmail.com wrote:

 post the code

 Here you go :

 http://pastebin.com/eVXZiFws


 This is a mod_perl module used in the HeaderParser phase of the Apache
 request cycle; it first grabs the sql associated with the model, and passes
 parameters to it; this sql is used to retrieve the required values for the
 model, and the placeholders in the document are replaced with those values.
 The user is then redirected to the newly created document

 You can see it in action in the demo account of the site referenced in my
 signature : open any file (those are legal files/insurance claims), click
 on the 'Contributors' tab (third tab from left; add a contributor if none
 is present), and click on 'Templates'. Click on the template to generate a
 document


 --
 Salutations, Vincent Veyron

 https://legalcase.libremen.com/
 Legal case, contract and insurance claim management software



If PHP is an option, you might want to look at the Tiny But Strong template
system (http://www.tinybutstrong.com/), along with the OpenTBS plugin (
http://www.tinybutstrong.com/plugins/opentbs/demo/demo.html).

We used it to replace some homegrown code similar to what Vincent described
that directly manipulated the document.  There are enough idiosyncracies
 among the file formats that I've been much happier using the TBS code.  I
think this is especially true if you are merging multiple records into a
single, repeating template document as opposed to doing a single set of
replacements.

Cheers,
Ken

-- 
AGENCY Software
A Free Software data system
By and for non-profits
*http://agency-software.org/ http://agency-software.org/*
*https://agency-software.org/demo/client
https://agency-software.org/demo/client*
ken.tan...@agency-software.org
(253) 245-3801

Subscribe to the mailing list
agency-general-requ...@lists.sourceforge.net?body=subscribe to
learn more about AGENCY or
follow the discussion.