On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi,

    A client is trying to cut and paste a large table (some 200 rows) from Excel to TinyMCE.

    The idea being that they can update their offers stocklist on their website each day.

    The problem is that the cut and paste brings with it a load of garbage code.

    Here’s the opening code and a single row.

    <table border="0" cellpadding="0" cellspacing="0" width="1113">
    	<colgroup span="1"><col span="1" width="156"></col><col span="1" width="144"></col><col span="1" width="70"></col><col span="1" width="43"></col><col span="1" width="61"></col><col span="1" width="558"></col><col span="1" width="81"></col></colgroup>
    	<tbody>
    		<tr>
    			<td height="17" width="156">Part Number</td>
    			<td width="144">Manufacturer</td>			<td width="70">Condition</td>
    			<td width="43">Price</td>
    			<td width="61">Quantity</td>
    			<td width="558">Description</td>
    			<td width="81">Comments</td>
    		</tr>

    This is what I need the cut and paste to result in:

    <table>
    		<tr>
    			<td>Part Number</td>
    			<td>Manufacturer</td>
    			<td>Condition</td>
    			<td>Price</td>
    			<td>Quantity</td>
    			<td>Description</td>
    			<td>Comments</td>
    		</tr>

    Also when I try to assign the top row as header cells the resulting code is this:

    <table border="0" cellpadding="0" cellspacing="0" width="1113">
    	<colgroup span="1"><col span="1" width="156"></col><col span="1" width="144"></col><col span="1" width="70"></col><col span="1" width="43"></col><col span="1" width="61"></col><col span="1" width="558"></col><col span="1" width="81"></col></colgroup>
    	<tbody>
    		<tr>
    			<th onclick="null" ondblclick="null" onkeydown="null" onkeypress="null" onkeyup="null" onmousedown="null" onmousemove="null" onmouseout="null" onmouseover="null" onmouseup="null">Part Number</th><th onclick="null" ondblclick="null" onkeydown="null" onkeypress="null" onkeyup="null" onmousedown="null" onmousemove="null" onmouseout="null" onmouseover="null" onmouseup="null">Manufacturer</th><th onclick="null" ondblclick="null" onkeydown="null" onkeypress="null" onkeyup="null" onmousedown="null" onmousemove="null" onmouseout="null" onmouseover="null" onmouseup="null">Condition</th><th onclick="null" ondblclick="null" onkeydown="null" onkeypress="null" onkeyup="null" onmousedown="null" onmousemove="null" onmouseout="null" onmouseover="null" onmouseup="null">Price</th><th onclick="null" ondblclick="null" onkeydown="null" onkeypress="null" onkeyup="null" onmousedown="null" onmousemove="null" onmouseout="null" onmouseover="null" onmouseup="null">Quantity</th><th onclick="null" ondblclick="null" onkeydown="null" onkeypress="null" onkeyup="null" onmousedown="null" onmousemove="null" onmouseout="null" onmouseover="null" onmouseup="null">Description</th><th onclick="null" ondblclick="null" onkeydown="null" onkeypress="null" onkeyup="null" onmousedown="null" onmousemove="null" onmouseout="null" onmouseover="null" onmouseup="null">Comments</th>
    		</tr>

    I have no idea why all those junk onmouseover/out/up/... attributes appear.

    Any ideas? Perhaps someone else has already come across and solved this problem?

    Thanks for looking.
      Enovate Design | Web Design Agency Essex
    • I’ve read that it’s supposed to work if you use the "Paste from Word" button.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
      • Thanks, but the above code is what results from using the Paste from Word button.

        The Plain Text one strips away the table cells so is a little too aggressive.
          Enovate Design | Web Design Agency Essex
        • Pasting just about anything from an MS-Office doc results in headaches and code-junk.

          You could try to export the Excel table to HTML. And then use the "clean Word" tinyMCE button.

          Or try this online tool: http://textism.com/wordcleaner/

          Dreamweaver also does a pretty good job at cleaning out junk.

          Perhaps a more business-like solution would be to have a CVS-import module that takes care of all that "behind the scenes". There’s stuff like that in the repository, iirc.