lilmer Posted February 19, 2013 Share Posted February 19, 2013 I have a table that has a row and column with different style and colspan etc. Does anyone know how to convert it HTML to XML file with the designated style Using PHP. Cause I going to convert it the xml to xls also. <table> <tbody> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> </tr> <tr> <td>1</td> <td>2</td> <td colspan='2'>34</td> <td>5</td> </tr> <tr> <td stye='font-weight:bold'>BOLD</td> <td stye='font-style:underline'>underline</td> <td stye='font-stye:arial'>Italic</td> <td stye='font-familty:aria'>Arial</td> <td stye='background-color:Blue'>Arial</td> </tr> </tbody> </table> Quote Link to comment https://forums.phpfreaks.com/topic/274672-php-convert-html-table-to-xml/ Share on other sites More sharing options...
requinix Posted February 19, 2013 Share Posted February 19, 2013 XML does not contain styles. Embed the data in the XML any way you see fit, then write the XSLT so that it uses the right styles. Consider all the information the XSLT will need to use to output the right HTML: the raw text, colspans, CSS attributes and values... Quote Link to comment https://forums.phpfreaks.com/topic/274672-php-convert-html-table-to-xml/#findComment-1413305 Share on other sites More sharing options...
Barand Posted February 19, 2013 Share Posted February 19, 2013 (edited) You mentioned xls. If your goal is to create a file to be used in Excel then all you need is to open the html file with the table in Excel. edit: Of course, you would have to spell "style" correctly Edited February 19, 2013 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/274672-php-convert-html-table-to-xml/#findComment-1413306 Share on other sites More sharing options...
lilmer Posted February 20, 2013 Author Share Posted February 20, 2013 @Barand Yes, my goal is to create a excel file and can be edit also on html web page, like google spreadsheet. I can already generate a .xls file to my web page and its content using phpexcelreader. My problem now is to save the existing file as I change some content on the html page. Do you think its a good idea to save the html to xml and to .xls?? do you think it will work? Quote Link to comment https://forums.phpfreaks.com/topic/274672-php-convert-html-table-to-xml/#findComment-1413542 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.