PHP-General - Generate Word doc from php
Posted: Mon Jan 07, 2008 2:29 pm
Hi, I'm doing a college project which involves automatically generating student transcripts from a MySQL database. I want to be able to create a system whereby the user enters the student no, and a Word document is automatically generated which displays the student's results in a a letter format. I am able to create the Word document no problem; it's the formatting that I'm having trouble with. If, say, the student is in fourth year, then the Word document must display four sets of results, like below:
This is to certify that Daffy Duck obtained the following results in bla bla bla:
First year: Second Year:
Subject 1 78 Subject 1 78 (Note in the actual document, there'd be proper spacing between the subjects and marks)
Subject 2 64 Subject 2 64
Subject 3 12 Subject 3 12
Subject 4 58 Subject 4 58
Subject 5 86 Subject 5 86
Subject 6 7 Subject 6 7
Overall: 99 Overall 99
Third Year: Fourth Year:
Subject 1 42 Subject 1 42
Subject 2 75 Subject 2 75
Subject 3 64 Subject 3 64
Subject 4 45 Subject 4 45
Subject 5 67 Subject 5 67
Subject 6 15 Subject 6 15
Subject 7 42
Overall 99 Overall 99
So my question is this: What's the best way to generate a Word document like above where four year's results will neatly fit on one page? Should I do a HTML template within PHP or have some mechanism to paste the data into a Word template? Or is there a better way to do it?
I'd really appreciate your suggestions!
sabatier
This is to certify that Daffy Duck obtained the following results in bla bla bla:
First year: Second Year:
Subject 1 78 Subject 1 78 (Note in the actual document, there'd be proper spacing between the subjects and marks)
Subject 2 64 Subject 2 64
Subject 3 12 Subject 3 12
Subject 4 58 Subject 4 58
Subject 5 86 Subject 5 86
Subject 6 7 Subject 6 7
Overall: 99 Overall 99
Third Year: Fourth Year:
Subject 1 42 Subject 1 42
Subject 2 75 Subject 2 75
Subject 3 64 Subject 3 64
Subject 4 45 Subject 4 45
Subject 5 67 Subject 5 67
Subject 6 15 Subject 6 15
Subject 7 42
Overall 99 Overall 99
So my question is this: What's the best way to generate a Word document like above where four year's results will neatly fit on one page? Should I do a HTML template within PHP or have some mechanism to paste the data into a Word template? Or is there a better way to do it?
I'd really appreciate your suggestions!
sabatier