agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
Link Office Word form document with data from PostgreSQL
11+ messages / 9 participants
[nested] [flat]

* Link Office Word form document with data from PostgreSQL
@ 2015-03-30 08:20  avpro avpro <avprowebeden@gmail.com>
  0 siblings, 4 replies; 11+ messages in thread

From: avpro avpro @ 2015-03-30 08:20 UTC (permalink / raw)
  To: pgsql-novice@postgresql.org; pgsql-sql; pgsql-general@postgresql.org

Hi all,

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.

Thank you for your input

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Link Office Word form document with data from PostgreSQL
@ 2015-03-30 09:22  Tim Clarke <tim.clarke@manifest.co.uk>
  parent: avpro avpro <avprowebeden@gmail.com>
  3 siblings, 1 reply; 11+ messages in thread

From: Tim Clarke @ 2015-03-30 09:22 UTC (permalink / raw)
  To: PostgreSQL General List <pgsql-general@postgresql.org>

Two options that I know of:
1) Use Java and the Apache POI project
2) Write a file containing the data in some other format like HTML then
open that with Word.

Tim Clarke

On 30/03/15 09:20, avpro avpro wrote:
>
> Hi all,
>
> 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.
>
> Thank you for your input
>



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



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [SQL] Link Office Word form document with data from PostgreSQL
@ 2015-03-30 10:48  Hector Vass <hector.vass@metametrics.co.uk>
  parent: avpro avpro <avprowebeden@gmail.com>
  3 siblings, 0 replies; 11+ messages in thread

From: Hector Vass @ 2015-03-30 10:48 UTC (permalink / raw)
  To: avpro avpro <avprowebeden@gmail.com>; pgsql-novice@postgresql.org <pgsql-novice@postgresql.org>; pgsql-sql; pgsql-general@postgresql.org <pgsql-general@postgresql.org>

If you have windows then yes something like vba to pull data into MS Office Word .. search google for 'ms word odbc connection' a postgres mailing list is not the right place to do this search


If you are on *nix don't have/want windows & office products but want to generate/write to a MS Office Word document then postgresql extension perlu and something from the CPAN library like Win32::Word::Writer will work


Hector Vass



+44(0)7773 352 559
*  Metametrics, International House, 107 Gloucester Road,  Malmesbury, Wiltshire, SN16 0AJ
*   www.metametrics.co.uk<http://www.metametrics.co.uk/;

________________________________
From: pgsql-sql-owner@postgresql.org <pgsql-sql-owner@postgresql.org> on behalf of avpro avpro <avprowebeden@gmail.com>
Sent: 30 March 2015 09:20
To: pgsql-novice@postgresql.org; pgsql-sql@postgresql.org; pgsql-general@postgresql.org
Subject: [SQL] Link Office Word form document with data from PostgreSQL


Hi all,

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.

Thank you for your input

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [GENERAL] Link Office Word form document with data from PostgreSQL
@ 2015-03-30 13:01  Vincent Veyron <vv.lists@wanadoo.fr>
  parent: avpro avpro <avprowebeden@gmail.com>
  3 siblings, 1 reply; 11+ messages in thread

From: Vincent Veyron @ 2015-03-30 13:01 UTC (permalink / raw)
  To: avpro avpro <avprowebeden@gmail.com>; +Cc: pgsql-novice@postgresql.org; pgsql-sql; pgsql-general@postgresql.org

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



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Link Office Word form document with data from PostgreSQL
@ 2015-03-30 15:18  John R Pierce <pierce@hogranch.com>
  parent: avpro avpro <avprowebeden@gmail.com>
  3 siblings, 1 reply; 11+ messages in thread

From: John R Pierce @ 2015-03-30 15:18 UTC (permalink / raw)
  To: pgsql-general@postgresql.org

On 3/30/2015 1:20 AM, avpro avpro 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.
>
> Thank you for your input
>

Microsoft Office tools like Word should be able to directly access 
Postgres databases via ODBC or OLEDB with the suitable Postgres driver 
(odbc or oledb) installed on the Windows system, and configured to 
access the Postgres database.   I've done this in the past with Excel, 
no reason it wouldn't work in Word.



-- 
john r pierce, recycling bits in santa cruz



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



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: [SQL] Re: Link Office Word form document with data from PostgreSQL
@ 2015-03-30 15:37  Vincenzo Campanella <vinz65@gmail.com>
  parent: Vincent Veyron <vv.lists@wanadoo.fr>
  0 siblings, 1 reply; 11+ messages in thread

From: Vincenzo Campanella @ 2015-03-30 15:37 UTC (permalink / raw)
  To: Vincent Veyron <vv.lists@wanadoo.fr>; avpro avpro <avprowebeden@gmail.com>; +Cc: pgsql-novice@postgresql.org; pgsql-sql; pgsql-general@postgresql.org

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



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Link Office Word form document with data from PostgreSQL
@ 2015-03-30 16:48  Andy Colson <andy@squeakycode.net>
  parent: John R Pierce <pierce@hogranch.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Andy Colson @ 2015-03-30 16:48 UTC (permalink / raw)
  To: pgsql-general@postgresql.org

On 3/30/2015 10:18 AM, John R Pierce wrote:
> On 3/30/2015 1:20 AM, avpro avpro 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.
>>
>> Thank you for your input
>>
>
> Microsoft Office tools like Word should be able to directly access
> Postgres databases via ODBC or OLEDB with the suitable Postgres driver
> (odbc or oledb) installed on the Windows system, and configured to
> access the Postgres database.   I've done this in the past with Excel,
> no reason it wouldn't work in Word.
>
>
>

Agreed.  I too have use PG odbc to link with excel.  If it works in 
excel it should work in word.

-Andy


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



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Re: [GENERAL] Link Office Word form document with data from PostgreSQL
@ 2015-03-30 17:51  Vincent Veyron <vv.lists@wanadoo.fr>
  parent: Vincenzo Campanella <vinz65@gmail.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Vincent Veyron @ 2015-03-30 17:51 UTC (permalink / raw)
  To: Vincenzo Campanella <vinz65@gmail.com>; stirling.newberry@gmail.com; +Cc: avpro avpro <avprowebeden@gmail.com>; pgsql-novice@postgresql.org; pgsql-sql; pgsql-general@postgresql.org

On Mon, 30 Mar 2015 17:37:28 +0200
Vincenzo Campanella <vinz65@gmail.com> wrote:
Stirling Newberry <stirling.newberry@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-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Re: [GENERAL] Link Office Word form document with data from PostgreSQL
@ 2015-03-30 20:51  avpro avpro <avprowebeden@gmail.com>
  parent: Vincent Veyron <vv.lists@wanadoo.fr>
  0 siblings, 1 reply; 11+ messages in thread

From: avpro avpro @ 2015-03-30 20:51 UTC (permalink / raw)
  To: ; +Cc: pgsql-novice@postgresql.org <pgsql-novice@postgresql.org>; pgsql-sql; pgsql-general@postgresql.org

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.lists@wanadoo.fr> wrote:

> On Mon, 30 Mar 2015 17:37:28 +0200
> Vincenzo Campanella <vinz65@gmail.com> wrote:
> Stirling Newberry <stirling.newberry@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
>

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Re: [GENERAL] Link Office Word form document with data from PostgreSQL
@ 2015-03-30 22:18  Ken Tanzer <ken.tanzer@gmail.com>
  parent: avpro avpro <avprowebeden@gmail.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Ken Tanzer @ 2015-03-30 22:18 UTC (permalink / raw)
  To: avpro avpro <avprowebeden@gmail.com>; +Cc: pgsql-novice@postgresql.org <pgsql-novice@postgresql.org>; pgsql-sql@postgresql.org, PG-General Mailing List <pgsql-general@postgresql.org>

On Mon, Mar 30, 2015 at 1:51 PM, avpro avpro <avprowebeden@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.lists@wanadoo.fr> wrote:
>
>> On Mon, 30 Mar 2015 17:37:28 +0200
>> Vincenzo Campanella <vinz65@gmail.com> wrote:
>> Stirling Newberry <stirling.newberry@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.tanzer@agency-software.org
(253) 245-3801

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

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Link Office Word form document with data from PostgreSQL
@ 2015-03-30 23:59  Stephen Davies <sdavies@sdc.com.au>
  parent: Tim Clarke <tim.clarke@manifest.co.uk>
  0 siblings, 0 replies; 11+ messages in thread

From: Stephen Davies @ 2015-03-30 23:59 UTC (permalink / raw)
  To: Tim Clarke <tim.clarke@manifest.co.uk>; PostgreSQL General List <pgsql-general@postgresql.org>

Open Office etc can populate fields via JDBC from any database including 
PostgreSQL.

Cheers,
Stephen

On 30/03/15 19:52, Tim Clarke wrote:
> Two options that I know of:
> 1) Use Java and the Apache POI project
> 2) Write a file containing the data in some other format like HTML then
> open that with Word.
>
> Tim Clarke
>
> On 30/03/15 09:20, avpro avpro wrote:
>>
>> Hi all,
>>
>> 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.
>>
>> Thank you for your input
>>
>
>
>


-- 
=============================================================================
Stephen Davies Consulting P/L                             Phone: 08-8177 1595
Adelaide, South Australia.                                Mobile:040 304 0583
Records & Collections Management.


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



^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2015-03-30 23:59 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-03-30 08:20 Link Office Word form document with data from PostgreSQL avpro avpro <avprowebeden@gmail.com>
2015-03-30 09:22 ` Tim Clarke <tim.clarke@manifest.co.uk>
2015-03-30 23:59   ` Stephen Davies <sdavies@sdc.com.au>
2015-03-30 10:48 ` Hector Vass <hector.vass@metametrics.co.uk>
2015-03-30 13:01 ` Vincent Veyron <vv.lists@wanadoo.fr>
2015-03-30 15:37   ` Vincenzo Campanella <vinz65@gmail.com>
2015-03-30 17:51     ` Vincent Veyron <vv.lists@wanadoo.fr>
2015-03-30 20:51       ` avpro avpro <avprowebeden@gmail.com>
2015-03-30 22:18         ` Ken Tanzer <ken.tanzer@gmail.com>
2015-03-30 15:18 ` John R Pierce <pierce@hogranch.com>
2015-03-30 16:48   ` Andy Colson <andy@squeakycode.net>

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