473,569 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Report writing in PHP - what tools for making formating nice?

Hi there,

A client of mine wants to start generating some reports from their PHP /
MYSQL database.

They were previously gathering data from the screen and cutting and pasting
it into a Word document template. They now just want to generate it.

My initial thoughts are to just format the information in a table and then
they print it out. But due to the dynamic nature of the reports and what is
included, there might be issues with regard to the width fitting on a piece
of paper, and the general format will not look as good as a Word document
would.

What ways could I approach this problem? Is there anything available which
would make report formatting attractive and easy?

Thanks in advance.

Kind regards

Dave
Nov 3 '05 #1
6 4700
NC
Dave Smithz wrote:

A client of mine wants to start generating some reports from their PHP /
MYSQL database.

They were previously gathering data from the screen and cutting and pasting
it into a Word document template. They now just want to generate it.

My initial thoughts are to just format the information in a table and then
they print it out. But due to the dynamic nature of the reports and what is
included, there might be issues with regard to the width fitting on a piece
of paper, and the general format will not look as good as a Word document
would.

What ways could I approach this problem? Is there anything available which
would make report formatting attractive and easy?


You can generate reports in either PDF or RTF.

The exact approach to generating PDF would depend on what PDF
generation tool(s) you use. There are at least two PDF generation
extensions bundled with PHP; there are also "pure PHP" tools such as
FPDF that are somewhat slower, but do not require any particular PHP
extension to be available (helpful for hosted applications).

If you want to use RTF (which is readable by most word processors)
instead, take a look here:

http://groups.google.com/group/alt.p...914bd0d0a120fc

This is my old post to alt.php where I show how to build a simple
"report" (actually, a set of mailing labels) without having to learn a
lot about RTF.

Cheers,
NC

Nov 3 '05 #2
Dave Smithz wrote:

<snip>

My initial thoughts are to just format the information in a table and then
they print it out. But due to the dynamic nature of the reports and what
is included, there might be issues with regard to the width fitting on a
piece of paper, and the general format will not look as good as a Word
document would.

Three letters: CSS
What ways could I approach this problem? Is there anything available which
would make report formatting attractive and easy?


You could do all sorts of things to make it look fancy in print.....but why?
Yes, we all know people for whom an Email isn't real unless its in black
and white on A4 - even if its spam. But choosing this as your starting
point reinforces this kind of behaviour instead of solving it.

PDF is better, but instead of dead tree - it's dead data. An HTML table
(yes, I do mean table - I know you can create fancy layouts with CSS and
don't need tables to do it but....) can be imported back into a
spreadshseet or a PHP array.

Don't kill your data - give it a nice new home!

C.

Nov 3 '05 #3
Dave Smithz wrote:
My initial thoughts are to just format the information in a table and then
they print it out. But due to the dynamic nature of the reports and what is
included, there might be issues with regard to the width fitting on a piece
of paper, and the general format will not look as good as a Word document
would.


Try using point sizes to specify the dimensions of the table cells. A
point is 1/72 of an inch. If you specify the width of a table to be
468pt, then in theory, the browser would print it out at exactly 6.5
inches. CSS gives you a lot of control over the appearance, but there's
no guarantee of WYSIWYG.

Nov 4 '05 #4
Thanks for the comments. I have been reading more and at first I thought the
RTF file generation would be perfect.

The reason why CSS is not suitable is because I need to generate these
reports into a format that is sent back to clients. They need them in a
particualr format and I could not really mess around with CSS trying to get
it write. Plus they want to be sent a file via email or hard copy so RTF or
PDF would be easier.

On reading up I thought RTF would be great because of the dynamic nature of
the required reports. I could create an RTF document template with a table
in it. Look how a new table row is created. And for each table row I want to
add to the report, just add the necessary RTF commands and fill it with
data.

However looking at an RTF document in raw text and working out how to add a
new table line with data does not seem stright forward. I do not really
fancy spending a lot of time learning about RTF.
I did try and save Word document in XML format. This might be easier to
figure out how to add new lines to a table and populate the table with
report data. I can assume my clients are using Word 2003 so they would be
able to read these document (worse case I could print them out as PDF before
sending).

I think I am going the right way about this but any other suggestions or
ways to make adding a line to the XML or RTF would be welcome.

Kind regards

Dave
Nov 7 '05 #5
Hmmm,
Even playing around with the XML strucutre although I managed to create
another row by editing the raw text, when I think about it, I Also have
dynamic anount of columns in the report depedning on what is needed to be
generated. Having to learn and create functions that handle the dynamic
generation of the correct XML (therefore the correct amount of columns and
the amount of rows) might make things a bit tricky.

Opoen to other easier ways of approaching this. Maybe for now it will just
be printer HTML tables but I just do not think my clients will be happy with
this.

Kind regards

Dave
Nov 7 '05 #6
Can you just make a file in Word and then just export the data to a
file that Word will read? Kind of like when you are doing envelopes
and labels setup? This way you can layout the whole thing the way you
have been in word and the text document will import the exported file
and look exactly how it has in the past...

Just a suggestion.

-Rick

--------------------------
Looking for a place to go to happy hour tonight? Check out
HappyHourHotSpo ts.com!

Nov 7 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1680
by: Peter Simpson | last post by:
Hello everybody. I'm trying to set up a simple web interface to maintain the rules configuration for Shorewall. This entails writing to at least one of several root-owned files in /etc/shorewall. Can anyone, please explain how I allow a script to write to one of these files when apache is running as www-run.nobody (on debian stable) ?
1
1381
by: Sean Pau | last post by:
I would like my user to retrieve SQL data through intranet website: 1. Go to intranet link and enter parameters for report (for example Order From and To date) 2. Click on "Run" button and the data come back in Excel screen. The data are retrieved using SQL Select statements. The return data are all in simple table row and column, there...
3
9181
by: FeveZ | last post by:
I've been stuck on a problem now for ages and i'm about ready to pack my project in because of it lol. OK here is my scenario. I have an existing Crystal Report, which I have added to my solution and published it as a webservice. This report takes it data from an SQL server on another machine. The user will have a windows form in a...
4
12163
by: jaYPee | last post by:
I have a report created in crystal report. My problem is on how can I remove the decimal point without converting the value. say for example if I have this data: Unit 2 1.5 2 3
6
3659
by: Bob Alston | last post by:
I am looking for Access reporting add-in that would be easy to use by end users. My key focus is on selection criteria. I am very happy with the Access report writer capabilities. As far as development of reports, it is certainly fine in my book. But for end-users, with little experience or training, it would be nice to have an easy way...
2
2181
by: jmar | last post by:
I am updating a VB4.0 quote generation program to VB.net. The old program takes user inputs, performs calculations, saves the data to Access databases and uses Crystal Reports 5.0 to generate a quote. A while back users obviously wanted to be able to edit/e-mail the quote (these ancient Cyrstal 5.0 reports don't allow PDF creation) so I...
10
1154
by: John Dann | last post by:
I'm writing a VB2005 program that needs to generate some printed output, including a main table. At present I'm doing this output simply as a text file, which works well enough to allow printing via eg NotePad, but there are a couple of important refinements that I'd like to add: one or more images per page and, ideally, some slightly better...
2
1735
by: sitko | last post by:
Hi, I'm in the process of converting a VB.net program into a C program so it can run on a unix like machine. I've been moving along at a nice pace, but this conversion has stumped me. I need a function to take two arguments:(a double number which may or may not be an integer, and an integer which will be the number of digits to store...
1
5578
by: Doug | last post by:
What is the simplest way to make a report where only the records where a field matches a certain date are included, and the user first selects that date (from form or popup)? (I can write the SQL to select the records I want...)
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.