Quote:
Originally Posted by Ultimatum
How do I add the objects Page etc.. to the class WordDocument. Now I have a method addParagraph and then I pass the object paragraph to that method or should I extend Page class with WordDocument class?
|
Don't extend, no. The class Page is not a container of WordDocument.
You add pages like this:
In your "WordDocument" class, you have a addPage() method:
PHP Code:
<?php
private Array pages;
public function addPage(Page &page)
{
this->pages[] = page;
}
?>
You create the instance outsite and you add it, passing it by reference. The method had it into the class collection (pages).
Quote:
Originally Posted by Ultimatum
And it is possible to put images and text in header/footer as well
|
Header and Footer are 'Paragraph' instances. Paragraph can contains images, no problem.
Quote:
Originally Posted by Ultimatum
and it is also possible to add pagenumbers to those so it's a little more then only paragraphs.
|
No problem, when you add a paragraph, it's a method "addParagraph" in the 'Page class' when you add, you take the Page instance id and put it into a 'Paragraph' 'pageId' attribute.
But i don't advise you to do that. Indeed, when you add some text before a paragraph, you push the following ones to bottom and a paragraph could go to the following page. It could be hard to check.
I advise more to insert an attribute 'position' to the 'Paragraph' class which is incremented at each inserted paragraph.
Quote:
Originally Posted by Ultimatum
In the class Text I know have all the properties like fontsize, fontfamily, fontcolor, bold, italic, underline. And with the Text class I can give every line other properties. That's why I have a Text class.
I love more comments from anybody to help me solve this problem :)
|
You don't need a class for that. Why don't you keep dob codes inside the text ? You just have to transform dob codes into html tags (or others depending on the api you use to create your Word documents) with regular expressions.
Have a nice day