Package Proposal (CSS Parser)

From: Date: Wed, 10 Dec 2008 10:28:04 +0000
Subject: Package Proposal (CSS Parser)
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-51246@lists.php.net to get a copy of this message
Hello PEAR Community, I need not to say that I'm a developer and been using PHP for quite some time now. I thought I should email you first before I try to create a new account. Please bear my explanation for the 'CSS parser/emulator' that I created. Our site has this report which presents a table of some data. We added an option for the user to export the said report to excel. So what we did was to create a separate code for the exporting. Now what we need to do next is to format the contents of the exported excel file to be a close as possible to the formatting used in the HTML version. But before we can do that of course we need to know how it looks like in the HTML. That is whether the content of the cell is bold, italic, so on... As I've told that the exporting of the excel file and rendering of the HTML report are different. This poses problems because if we need to add a column to the HTML version then we have to edit the code for the exporting of the excel file. So as a simple solution, what we did was to use a package that would convert HTML tables to excel. As for the formatting of the excel cells, there is no problem if the style in inline. All I need to do is just parse the content of the style attribute of td and apply the corresponding formatting for the excel cell. (No problem again with the formatting of the excel cell 'coz I know there's another PEAR package that does exactly that). The real problem is if the td uses a class to apply the formatting for a particular cell. You will have to reference the CSS file which stores those information. So this is where the CSS parser/emulator comes in. Take for example the code below: <td style="font-weight:bold">someText</td> I would be easy to format this correctly in the excel file 'coz I can easily see that I need to format it as bold. But not for the code below: <td class="someClass">someText</td> I still need to parse some CSS codes which declares the someClass class. So that is basically the problem, I needed to create a CSS parser. Now I was thinking if a package which does exactly this was already done and I just missed out in finding it or I could upload my code :) I hope you got my explanation and be granted an account into your community. Thank You.

« previous php.pear.dev (#51246) next »