agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Vincent Veyron <vv.lists@wanadoo.fr>
To: avpro avpro <avprowebeden@gmail.com>
Cc: pgsql-novice@postgresql.org
Cc: pgsql-sql@postgresql.org
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Link Office Word form document with data from PostgreSQL
Date: Mon, 30 Mar 2015 15:01:21 +0200
Message-ID: <20150330150121.39fc80c1614692b758a6aae3@wanadoo.fr> (raw)
In-Reply-To: <CAAQdDn=JssA0S5WX2_x-Gvh9LxkH87zBLDB5Vox1Tark4CFv5Q@mail.gmail.com>
References: <CAAQdDn=JssA0S5WX2_x-Gvh9LxkH87zBLDB5Vox1Tark4CFv5Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

On Mon, 30 Mar 2015 10:20:15 +0200
avpro avpro <avprowebeden@gmail.com> wrote:

> Have you ever experienced how to populate fields from a MS Office Word
> document with a PostgreSQL data available either in a table or view?
> 
> I haven’t seen anything on the web; only possible with MS products, VS or
> Access.

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

-- 
					Salutations, Vincent Veyron

https://marica.fr/
Gestion des contentieux, des dossiers de sinistres assurance et des contrats pour le service juridique


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



view thread (11+ messages)  latest in thread

Message-ID: <20150330150121.39fc80c1614692b758a6aae3@wanadoo.fr>
Permalink:  ../20150330150121.39fc80c1614692b758a6aae3@wanadoo.fr/
Also on:    postgresql.org/message-id/20150330150121.39fc80c1614692b758a6aae3@wanadoo.fr

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: vv.lists@wanadoo.fr, avprowebeden@gmail.com, pgsql-novice@postgresql.org, pgsql-general@postgresql.org
  Subject: Re: [GENERAL] Link Office Word form document with data from PostgreSQL
  In-Reply-To: <20150330150121.39fc80c1614692b758a6aae3@wanadoo.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox