6 Replies Latest reply on Dec 2, 2014 4:35 AM by andrewblackwell

    Generate numbered list in Word from FileMaker data?

    andrewblackwell

      My client is hoping that I can create a module that would allow them to generate contracts in Word based on data entered in FileMaker.

       

      The sting in the tail is that the contracts should be editable, and that they should be strictly formatted as a numbered list, to enumerate all the contract items. It should basically look as follows:

       

      1. Duration of Contract

       

      1.1. Start and End of Contract

       

      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sollicitudin iaculis nibh, ac posuere lacus eleifend dictum. Fusce turpis leo, luctus in neque eget, consectetur consequat velit. Maecenas vel pretium massa. Aenean lectus nibh, rutrum at sapien vitae, vestibulum euismod quam. Phasellus tincidunt, sapien a volutpat ultrices, mi enim feugiat orci, sit amet bibendum turpis odio a mi. Aenean vitae magna nulla. In gravida mi vitae mauris ornare, id faucibus ex facilisis.

       

      1.2. Termination Option

       

      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sollicitudin iaculis nibh, ac posuere lacus eleifend dictum. Fusce turpis leo, luctus in neque eget, consectetur consequat velit. Maecenas vel pretium massa. Aenean lectus nibh, rutrum at sapien vitae, vestibulum euismod quam. Phasellus tincidunt, sapien a volutpat ultrices, mi enim feugiat orci, sit amet bibendum turpis odio a mi. Aenean vitae magna nulla. In gravida mi vitae mauris ornare, id faucibus ex facilisis.

       

      2. Content of Contract

       

      2.1. Contract Clause A

       

      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sollicitudin iaculis nibh, ac posuere lacus eleifend dictum. Fusce turpis leo, luctus in neque eget, consectetur consequat velit. Maecenas vel pretium massa. Aenean lectus nibh, rutrum at sapien vitae, vestibulum euismod quam. Phasellus tincidunt, sapien a volutpat ultrices, mi enim feugiat orci, sit amet bibendum turpis odio a mi. Aenean vitae magna nulla. In gravida mi vitae mauris ornare, id faucibus ex facilisis.

       

      2.2. Contract Clause B

       

      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sollicitudin iaculis nibh, ac posuere lacus eleifend dictum. Fusce turpis leo, luctus in neque eget, consectetur consequat velit. Maecenas vel pretium massa. Aenean lectus nibh, rutrum at sapien vitae, vestibulum euismod quam. Phasellus tincidunt, sapien a volutpat ultrices, mi enim feugiat orci, sit amet bibendum turpis odio a mi. Aenean vitae magna nulla. In gravida mi vitae mauris ornare, id faucibus ex facilisis.

       

       

      etc. etc.

       

      What I'm hoping to achieve is have a simple database table, which basically has three fields: title, text and parent_id, the latter to indicate which contract item a sub-item belongs to.

       

      Generating an output as a pdf in FileMaker would be a piece of cake, but as a Word document it seems next to impossible, as there seems to be no way to tell word that a) the items pasted into the document are list items, and b) what hierarchical level the numbering should be at (1., 1.1. or 1.1.1. etc.) so this is where I'm asking for help.

       

      Has anybody worked on a similar solution and found a way to generate something similar in a clean way in Word? Is there a fairly easy way to accomplish this, say, with or via XML, without having to learn Microsoft Word's entire XML syntax and programming logic.

       

      Thanks in advance for your help!

      Andrew

        • 1. Re: Generate numbered list in Word from FileMaker data?
          keywords

          My question would be, why use Word? Why not produce the contracts directly in FM? (OK, that's two questions.) If your DB is currently seen as just toring the standard contract text you can still do this in a master/global table, then generate individual contracts in a separate table into which you copy the master text so that it can be edited and customised as needed on a contract by contract basis. FM's ability to handle text formatting to produce reports of this sort is pretty good—not perfect, but pretty good.

          • 2. Re: Generate numbered list in Word from FileMaker data?
            andrewblackwell

            The answer here lies in the business requirements: the client needs to export the contract to a word document, so that the legal departments of the client's counterparties can type amendment suggestions straight into the document. Getting the counterparties onto FileMaker is obviously not an option, but I have thought about possibly offering a web interface where said legal departments can browse through the contract and enter amendments in form fields. But for now I'm trying to stick to client specs and solve it via Word.

            • 3. Re: Generate numbered list in Word from FileMaker data?
              fmp

              One venerable method is to export from FMP to an RTF document. This scenario is similar to exporting HTML, only with different tagging.

              • 4. Re: Generate numbered list in Word from FileMaker data?
                LyndsayHowarth

                Hi Andrew,

                 

                I have 2 suggestions...

                IF you are working in Windoze... you can use OLE to update a word template. (We used to have publish and subscribe on a Mac but alas no more)

                I also have a methodology for exporting as HTML which will give you all your styles. I'm not going to describe that here because it is a complex matter but happy to consult privately.

                 

                Sent from my iPad

                Lyndsay Howarth

                11th Hour Group Pty Ltd

                • 5. Re: Generate numbered list in Word from FileMaker data?
                  itraining

                  Hi Andrew

                   

                  The method outlined below can create long Microsoft Word documents (text only).

                  I am yet to resolve the issue of exporting images from FileMaker Pro and inserting them into the final Microsoft Word document.

                   

                  Using Microsoft Word:

                  (1) create a Microsoft Word document.

                  (2) format placeholder text with all of the paragraph styles required.

                  (3) create a macro to find-and-replace hard coded Tag text with each paragraph style required. For example: find <h1> replace with nothing and apply the Heading 1 paragraph style to the paragraph (the style can include automatic numbering).

                  (4) finally delete the dummy placeholder text and save the document.

                   

                  Using FileMaker Pro:

                  (1) create a Template table with a Container field. Populate one record with the Microsoft Word document created above.

                  (2) create a Tag table. Create a record for each paragraph style tag. For example: <h1>, <h2>, <p1>, <p2>.

                  (4) in the Contract table create a Tag field and a relationship join to the Tag table.

                  (5) in the Contract table identify each record (paragraph) as a specific paragraph style by populating the new Tag field.

                  (6) in the Contract table, create an unstored WordExport calculation field that concatenates the contract record text with the style Tag appended. Example result = Lorem ipsum blah blah blah.<h1>

                  (7) create a script to export the found set of Contract records, export the WordExport calculation field as a uniquely named text file from the Contract table and export the Microsoft Word document from the template table as a uniquely named file. Alternatively use the 360Works Scribe plug-in to create a populated Microsoft Word document in one step.

                  (8) open the new Microsoft Word document, insert the new text file and run the macro to remove the style tags. The document will be formatted beautifully and the user has an editable Microsoft Word document.

                   

                  Hope this helps.

                   

                   

                   

                  Michael Richards

                  Brisbane (Australia)

                  1 of 1 people found this helpful
                  • 6. Re: Generate numbered list in Word from FileMaker data?
                    andrewblackwell

                    Hi Michael

                     

                    Thanks a lot for taking your time to explain the steps, and sorry for taking ages to respond - I had no idea that there were any more answers in here, as I didn't get the mails from FM...

                     

                    I will test your method and let you know how I get along, but by the looks of it, it looks like this could work!

                     

                    Thanks again!
                    Andrew