jakebur01 Posted October 10, 2011 Share Posted October 10, 2011 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 Quote Link to comment Share on other sites More sharing options...
MarPlo Posted October 10, 2011 Share Posted October 10, 2011 Hi, You can output the reports in html format, than you can use the "html to pdf dompdf" to convert it in pdf. It's a free php class, easy to find on the net. Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 10, 2011 Share Posted October 10, 2011 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.