2

I'm using tinyMCE, below you can see the implementation. Now the problem: when I copy some records from EXCEL and paste them in my tinymce field. It's displayed good enough for me (with plugin: paste, he will actually show the fields) When i ask the value from my field I get a return with a table struct depeding what you paste. But I don't want any html, see below what I want.

Implementation code:

tinyMCE.init({ 
mode : "exact", 
elements: "id", 
theme : "advanced", 
plugins : "bbcode, inlinepopups", 
content_css : "tinymce.css", 
entity_encoding : "raw", 
remove_linebreaks : false, 
forced_root_block: false, 
force_br_newlines: true, 
invalid_elements : "p, div, span", 
force_p_newlines: false, t
heme_advanced_buttons1 : $cur_buttons, 
theme_advanced_buttons2: "", 
theme_advanced_buttons3: "", 
init_instance_callback : "tiny_mce_callback"});

Return from tinyMCE object:

<table style="border-collapse: collapse;" width="216" border="0"
       cellspacing="0" cellpadding="0">
<!--StartFragment-->
<colgroup>
  <col style="mso-width-source: userset; mso-width-alt: 1152;" width="27"/>
  <col width="55" />
  <col style="mso-width-source: userset; mso-width-alt: 2858;"
       span="2" width="67"/>
</colgroup>
<tbody>
<tr style="mso-height-source: userset;">
<td class="xl24" width="27" height="12">1</td>
<td class="xl26" width="55">26/05/12</td>
<td class="xl24" width="67">Amsterdam</td>
<td class="xl24" width="67">Casablanca</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">2</td>
<td class="xl25">27/05/12</td>
<td class="xl24">Casablanca</td>
<td class="xl24">Rabat</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">3</td>
<td class="xl25">28/05/12</td>
<td class="xl24">Rabat</td>
<td class="xl24">Fes</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">4</td>
<td class="xl25">29/05/12</td>
<td class="xl24">Fes</td>
<td class="xl24"> </td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">5</td>
<td class="xl25">30/05/12</td>
<td class="xl24">Fes</td>
<td class="xl24">Erg Chebbi</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">6</td>
<td class="xl25">31/05/12</td>
<td class="xl24">Erg Chebbi</td>
<td class="xl24">Dades Vallei</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">7</td>
<td class="xl25">01/06/12</td>
<td class="xl24">Dades Vallei</td>
<td class="xl24">Ouarzazate</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">8</td>
<td class="xl25">02/06/12</td>
<td class="xl24">Ouarzazate</td>
<td class="xl24">Marrakesh</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">9</td>
<td class="xl25">03/06/12</td>
<td class="xl24">Marrakesh</td>
<td class="xl24"> </td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">10</td>
<td class="xl25">04/06/12</td>
<td class="xl24">Marrakesh</td>
<td class="xl24"> </td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">11</td>
<td class="xl25">05/06/12</td>
<td class="xl24">Marrakesh</td>
<td class="xl24">Amsterdam</td>
</tr>
<!--EndFragment--></tbody>
</table>

Expected return:

1   26/05/12    Amsterdam   Casablanca
2   27/05/12    Casablanca  Rabat
3   28/05/12    Rabat   Fes
4   29/05/12    Fes 
5   30/05/12    Fes Erg Chebbi
6   31/05/12    Erg Chebbi  Dades Vallei
7   01/06/12    Dades Vallei    Ouarzazate
8   02/06/12    Ouarzazate  Marrakesh
9   03/06/12    Marrakesh   
10  04/06/12    Marrakesh   
11  05/06/12    Marrakesh   Amsterdam
vyegorov
  • 21,787
  • 7
  • 59
  • 73
Ziggiej
  • 119
  • 1
  • 1
  • 7

1 Answers1

0

You should have a look at the tinymce configuration options concerning the paste plugin.

Another option is to strip out all unwanted html tags and just use plain text: TinyMCE Paste As Plain Text

Community
  • 1
  • 1
Thariama
  • 50,002
  • 13
  • 138
  • 166