Thread

  1. Link Office Word form document with data from PostgreSQL

    avpro avpro <avprowebeden@gmail.com> — 2015-03-30T08:20:15Z

    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
    
  2. Re: Link Office Word form document with data from PostgreSQL

    Tim Clarke <tim.clarke@manifest.co.uk> — 2015-03-30T09:22:53Z

    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
    >
    
    
    
    
  3. Re: [SQL] Link Office Word form document with data from PostgreSQL

    Hector Vass <hector.vass@metametrics.co.uk> — 2015-03-30T10:48:07Z

    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
    
  4. Re: [GENERAL] Link Office Word form document with data from PostgreSQL

    Vincent Veyron <vv.lists@wanadoo.fr> — 2015-03-30T13:01:21Z

    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
    
    
    
  5. Re: Link Office Word form document with data from PostgreSQL

    John R Pierce <pierce@hogranch.com> — 2015-03-30T15:18:23Z

    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
    
    
    
    
  6. Re: [SQL] Re: Link Office Word form document with data from PostgreSQL

    Vincenzo Campanella <vinz65@gmail.com> — 2015-03-30T15:37:28Z

    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
    
    
    
  7. Re: Link Office Word form document with data from PostgreSQL

    Andy Colson <andy@squeakycode.net> — 2015-03-30T16:48:21Z

    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
    
    
    
  8. Re: Re: [GENERAL] Link Office Word form document with data from PostgreSQL

    Vincent Veyron <vv.lists@wanadoo.fr> — 2015-03-30T17:51:42Z

    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
    
    
    
  9. Re: Re: [GENERAL] Link Office Word form document with data from PostgreSQL

    avpro avpro <avprowebeden@gmail.com> — 2015-03-30T20:51:16Z

    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
    >
    
  10. Re: Re: [GENERAL] Link Office Word form document with data from PostgreSQL

    Ken Tanzer <ken.tanzer@gmail.com> — 2015-03-30T22:18:18Z

    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.
    
  11. Re: Link Office Word form document with data from PostgreSQL

    Stephen Davies <sdavies@sdc.com.au> — 2015-03-30T23:59:20Z

    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.