Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Create a word document from a search

  1. #1
    Join Date
    Aug 2006
    Posts
    65
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Create a word document from a search

    I need to create a word document from the results of a search... I have created the search Here... once on the results page of the search I need to be able to get the data that I want to put in the report and then be able to generate a word doc from that (there is a button called 'Create Report' that takes you to another page that should generate the word doc)..... I have created a word doc template to use to input the data into but this is where I get lost. (This is just a junk template.. mine will be different but this will at least show me what to do)

    Here are the things I know:
    I am using a linux server so I cant use COM.
    I want to be able to create a new section for each 'WorkedTask' that is selected
    The Highlight must be under the correct Task heading


    Basically the only thing that anyone will select when creating a report is the task and highlight fields and this is all we care about when doing the weekly report. I have the other data in there to pull out for other reasons....


    so say you search by Name and Date-- Ray Fossil and 12/31/08

    You will get 2 different task and 3 different highlights... and say you check Training, Hello World, HHHWWWW1, TTTTT1, TTTTT2

    so in the word doc... it needs to have two different sections
    Hello World and Training

    and under Hello World it needs to have the one highlight---- HHHWWWW1

    and under Training it needs to have the two highlights---- TTTTT1, TTTTT2


    can someone help me in figuring out how to accomplish this?

    I have attached my code and the word doc
    Last edited by Humper; 12-18-2008 at 09:04 PM. Reason: added zip file

  2. #2
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    Suggestion: Combine the two search pages (Search.php and Search_WDR.php) into one. This makes a new search easy and allows the user to refer to the old criteria - both without using the Back button. (According to usability best-practices, you should assume the Back button doesn't exist.)

    Now for your question... I'm trying to get it straight; do you want to dynamically generate a Microsoft Word document? That will require some sort of library (as you obviously know); the only one I know of, and it works on Linux, is OpenOffice.org. I don't know if they have exposed an API for external applications, but I don't doubt it considering that OOo's a FOSS project.
    -- Chris
    informal JavaScript student of Douglas Crockford
    I like wikis - a lot.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I have to wonder why you're doing this. The Microsoft DOC format, secret and proprietary as it is, is not well-supported, and changes markedly between even different versions of Office, let alone third-party products. If you want something to distribute files on the Web, where clients may be using any platform or software, it's not a good idea to restrict yourself so. If you really must use a word-processing document, ODF, an open standard supported by many office suites, is probably your best bet.

    If you really must use Word, the best way of attacking the problem is most likely to write it in something like LaTeX and then convert (you can also offer a variety of formats, including the original LaTeX and the pretty-much-universal PDF, for those who can't easily work with Word documents for whatever reason [like yourself]).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Aug 2006
    Posts
    65
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    I will try an answer both your questions here....

    Jesdisciple
    Suggestion: Combine the two search pages (Search.php and Search_WDR.php) into one. This makes a new search easy and allows the user to refer to the old criteria - both without using the Back button. (According to usability best-practices, you should assume the Back button doesn't exist.)
    How do you suggest I combine the two pages? iframe?

    Now for your question... I'm trying to get it straight; do you want to dynamically generate a Microsoft Word document? That will require some sort of library (as you obviously know); the only one I know of, and it works on Linux, is OpenOffice.org. I don't know if they have exposed an API for external applications, but I don't doubt it considering that OOo's a FOSS project.
    I need to create a dynamically generated document that can be edited if need be after it is created or I would try an create a PDF.... The server I am hosting this on is not my own and I don't know if they have OpenOffice installed...and I wont be able to install it.... I think I read yesterday that OpenOffice does expose an API for external applications though...



    Twey
    I have to wonder why you're doing this. The Microsoft DOC format, secret and proprietary as it is, is not well-supported, and changes markedly between even different versions of Office, let alone third-party products. If you want something to distribute files on the Web, where clients may be using any platform or software, it's not a good idea to restrict yourself so. If you really must use a word-processing document, ODF, an open standard supported by many office suites, is probably your best bet.
    The document that they create the weekly reports in now is a Word document so thats what I was trying to stay with since they are use to useing a word document... When the user downloads the report I need the report to be formatted correctly and have the data that the searched inserted into the document...they also need to be able to edit the report if need be.... I will have to look into ODF as I have never used it before...

    If you really must use Word, the best way of attacking the problem is most likely to write it in something like LaTeX and then convert (you can also offer a variety of formats, including the original LaTeX and the pretty-much-universal PDF, for those who can't easily work with Word documents for whatever reason [like yourself]).
    As I have never used LaTex.. I would have to look into how I would accomplish this....




    I was hoping there was an easy solution for creating a document that had some basic formatting and could be edited. Any other tip or suggestions are appreciated!!

  5. #5
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    I just found this, which is apparently written in PHP. If so, you should be able to install it.

    EDIT: Oh, and you can combine the pages by setting the single page as its own form's action and using an if statement to decide whether to show the results (depending on whether the form was submitted).
    -- Chris
    informal JavaScript student of Douglas Crockford
    I like wikis - a lot.

  6. #6
    Join Date
    Aug 2006
    Posts
    65
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    As the server I have the page on is paid hosting... I dont think I can install anything... I will look into this though.

  7. #7
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    It's not an install per se... It's just uploading the PHP files to the server and including them (if it's pure PHP).
    -- Chris
    informal JavaScript student of Douglas Crockford
    I like wikis - a lot.

  8. #8
    Join Date
    Aug 2006
    Posts
    65
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    I just downloaded and its just a php file.... I am going through it now to see if this is going to work for me...

    Thanks

  9. #9
    Join Date
    Aug 2006
    Posts
    65
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    I guess this is a start but it really has no function but to pull all data from a table and write it in a doc file.....

    I need something that will allow me to have a template that it pushes data too... and that can dynamically create sections/pages... This just keeps getting more complicated.... lol

  10. #10
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    You're right; that actually gets us no closer to the goal. I didn't pay enough attention to the summary.

    Let's try this again: http://www.phpclasses.org/browse/package/2631.html
    -- Chris
    informal JavaScript student of Douglas Crockford
    I like wikis - a lot.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •