Jump to content

storing output into document


jakebur01

Recommended Posts

I would like to store weekly reports into documents.  I am familiar with storing data to a regular text document, but it does not keep bold text, tables and so forth.  Are there any other documents that would not be to hard to output to such as .pdf, .rtf, .doc, etc.?

 

I've attached the current format we are using in excel.  Now that I have things automated in php, I would like to output to a document with almost identical formatting.  And how can I keep it on 8 1/2" x 11" pages without it splitting data or tables between two pages?

 

Thanks,

 

Jake

 

 

Link to comment
Share on other sites

You are asking a lot of questions. Some have easy glutinous and some have more difficult ones (if any).

 

First though, I think you need to ask your self if you need to create hard-coded reports. For example, if these reports are generated from data in a database then you can probably create a reporting feature to pull reports for any previous week dynamically. Then there is no need to create these reports on a weekly basis in some sort of flat-file format that you need to maintain.

 

But, assuming you have to create the flat-file reports, there are many options.

 

I think the easiest is as MarPlo suggested - create HTML reports. I wouldn't even go the PDF route. HTML documents have the following benefits: utilizes a format that you should be familiar with if you do web development, you can format the content very easily (bold, color, etc.) and it has "pretty good" handling of tabular data (i.e. data in tables) so that the data will try to fit within a page horizontally without being cut off (assuming you don't hard code the width to be too wide). It does have some disadvantages. If you want images yu will need to store them as separate files. HTML is not very "smart" on creating page breaks. You can try to programatically insert page breaks, but it can be a pain. Note, however, if you use HTML as an intermediary to create another file type (e.g. PDF) you will still have this problems.

 

IF you just want PDF, there are libraries within PHP as well as many classes available to allow you to pretty easily create PDF documents. But, depending on how complex the pages need to be this can be easy or difficult.

 

You can also create Excel documents. However, 'true' Excel documents are rather complex and you would have to find/buy a class to do that for you. But, it is rather simple to create either CSV documents (no formatting) or HTML documents (i.e. have formatting) and save them as an xls document. They will then open in Excel, but the user might get a warning when doing so that the format is not an Excel document.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.