Jump to content

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/274672-php-convert-html-table-to-xml/
Share on other sites

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...

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 by Barand

@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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.