DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:xls2wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tips:xls2wiki [2009-10-20 09:17] 194.248.13.254tips:xls2wiki [2024-01-31 20:26] (current) 69.11.54.89
Line 1: Line 1:
 ====== xls2wiki ====== ====== xls2wiki ======
-~~UP~~+
  
 ===== Abstract ===== ===== Abstract =====
  
-This is a simple script that converts copied data from xls to DokuWiki's Table format. The weird UTF-8 code you see is a russian explanation.+This is a simple script that converts copied data from xls to DokuWiki's Table format. The weird UTF-8 code you see is a Russian explanation.
  
 Just copy cells in Excel and paste it, then press 'convert' Just copy cells in Excel and paste it, then press 'convert'
Line 10: Line 10:
 ===== code ===== ===== code =====
  
-<code php>+<code php xls2wiki.php>
 <?php header("Content-type: text/html; charset=UTF-8"); ?> <?php header("Content-type: text/html; charset=UTF-8"); ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Line 92: Line 92:
 <h5>WIKI2EXCEL converter</h5> <h5>WIKI2EXCEL converter</h5>
 Copy and paste your Excel or Wiki table below and press [Convert!]<br/> Copy and paste your Excel or Wiki table below and press [Convert!]<br/>
-Скопируйте и вставьте таблицу из  Excel Ð¸Ð»Ð¸ Wiki Ð¸ нажмите [Convert!] (конвертировать)+Скопируйте и вставьте таблицу из  Excel или Wiki и нажмите [Convert!] (конвертировать)
  <form method=POST action="">  <form method=POST action="">
  <input type="radio" name="fromto" value="E2W" checked>Excel » Wiki<br>  <input type="radio" name="fromto" value="E2W" checked>Excel » Wiki<br>
Line 109: Line 109:
 </body></html> </body></html>
 </code> </code>
- 
- 
- 
- 
- 
- 
  
 ===== Comments Support Wiki header on first Line  ===== ===== Comments Support Wiki header on first Line  =====
  
-I have find this script helpfull\\ +I have find this script helpful\\ 
-I would like just to add this lines to put the first line like an header :\\+I would like just to add this lines to put the first line like an header:\\
  
 <code php> <code php>
Line 143: Line 137:
 </code> </code>
  
-finaly the code with english / french / russian translation\\ +> This converts cell contents like ", " (aka''<comma><space>''into a ''\n''. Couldn't figure out why (code dyslexia)...
-empty cells stay empty (no " . "), first line become header  :+
  
-<code php>+Finally, the code with English / French / Russian translations, \\ 
 +empty cells stay empty (no " . "), first line become header: 
 + 
 +<code php xls2wiki.php>
  
 <?php header("Content-type: text/html; charset=UTF-8"); ?> <?php header("Content-type: text/html; charset=UTF-8"); ?>
Line 200: Line 196:
    
 </head> </head>
- <?+ <?php
  $s = $_POST['s'];  $s = $_POST['s'];
  $fromto = $_POST['fromto'];  $fromto = $_POST['fromto'];
Line 218: Line 214:
  $arrayS = preg_split ("/[\n,]+/", $s);  $arrayS = preg_split ("/[\n,]+/", $s);
  $nb_lines = count ($arrayS)-1;  $nb_lines = count ($arrayS)-1;
- $s = $s . $nb_lignes;+ $s = $s . $nb_lines;
  $s = "";  $s = "";
  foreach ( $arrayS as $key => $lines ){  foreach ( $arrayS as $key => $lines ){
Line 246: Line 242:
 Copy and paste your Excel or Wiki table below and press [Convert!]<br/> Copy and paste your Excel or Wiki table below and press [Convert!]<br/>
 Copier et coller votre Table Excel ou Wiki dans le cadre ci-dessous et cliquez sur [Convert!]<br/> Copier et coller votre Table Excel ou Wiki dans le cadre ci-dessous et cliquez sur [Convert!]<br/>
-Скопируйте и вставьте таблицу из  Excel Ð¸Ð»Ð¸ Wiki Ð¸ нажмите [Convert!] (конвертировать)+Скопируйте и вcтавьте таблицу из Excel или Wiki и нажмите [Convert!] (конвертировать)
  <form method=POST action="">  <form method=POST action="">
- <input type="radio" name="fromto" value="E2W" checked>Excel Â» Wiki<br> + <input type="radio" name="fromto" value="E2W" checked>Excel Wiki<br> 
- <input type="radio" name="fromto" value="W2E">Wiki Â» Excel<br>+ <input type="radio" name="fromto" value="W2E">Wiki Excel<br>
  <INPUT TYPE=SUBMIT VALUE="Convert!"><br/>   <INPUT TYPE=SUBMIT VALUE="Convert!"><br/> 
- <textarea id="txt1" name="s" wrap="off" cols=50 rows=50 style="width:400; height:450"><? echo $s?></textarea>+ <textarea id="txt1" name="s" wrap="off" cols=50 rows=50 style="width:400; height:450"><?=$s ?></textarea>
  </form>  </form>
 <span style="font-size:80%"> <span style="font-size:80%">
Line 265: Line 261:
 </code> </code>
  
 +There is a spell mistake here...
 +<code>
 +$nb_lines = count ($arrayS)-1;
 +$s = $s . $nb_lignes;
 +</code>
 +
 +nb_lignes should be **nb_lines**.
  
  
Line 271: Line 274:
 :?: Please forgive such a n00b question, but how does one install this helpful Trick?  A small installation section would be extremely helpful.  ;-) :?: Please forgive such a n00b question, but how does one install this helpful Trick?  A small installation section would be extremely helpful.  ;-)
  
-My n00b answer :+My n00b answer:
  
 use iframe.... use iframe....
  
-create a php page somewhere into your website dokuwiki root and put the code inside.+create a PHP page somewhere into your website DokuWiki root and put the code inside.
  
-Use iframe to include this php page into a wiki page. +Use iframe to include this PHP page into a wiki page. 
-Look to this plugins if you hate html :/---> [[plugin:iframe]]+Look to this plugins if you hate HTML: [[plugin:iframe]]
  
-you can **not** try to include directly the code in a wiki page either : +You can **not** try to include directly the code in a wiki page either: 
-something like :+something like:
  
 <code> <code>
Line 288: Line 291:
 </php> </php>
 </code> </code>
-Because the page use little javascript tricks.+Because the page use little JavaScript tricks.
  
 ---- ----
  
 +More simple. Save xls2wiki.php to your dokuwiki\www\ folder and click this link: http://localhost/xls2wiki.php. For net security set file attributes 600.
 +
 +----
 +
 +> I integrated the code from the beginning into a simple plugin. I also added a few helping functions for cleaning up markup resulting from pandoc conversion of docx-files into dokuwiki markup. \\ See: https://github.com/practical-solutions/dokuwiki-xlsconv
 ===== Discussion ===== ===== Discussion =====
-I've installed iframe, but I'm kind of stuck how can I add the php file on the page I want to embed an excel spreadsheet. Can anyone help? Thx in adv.+I've installed iframe, but I'm kind of stuck how can I add the PHP file on the page I want to embed an excel spreadsheet. Can anyone help? Thanks in advance.
  
-Resp.: I've found a way creating a wikipage and adding {{url>\\servername\drive\dokuwiki\XLStoWIKI.php}} to it. Is this the best way? Now I have the page but after pasting the spreadsheet content and hitting convert nothing seems to happen. Pls help.+Resp.: I've found a way creating a wikipage and adding {{url>\\servername\drive\dokuwiki\XLStoWIKI.php}} to it. Is this the best way? Now I have the page but after pasting the spreadsheet content and hitting convert nothing seems to happen. Please help.
  
 ===== Remarks ===== ===== Remarks =====
  
-If you like this you probably love this HTML converter as well : [[http://diberri.dyndns.org/wikipedia/html2wiki/index.html]]+If you like this you probably love this HTML converter as well: [[http://diberri.dyndns.org/wikipedia/html2wiki/index.html]]<--Bad link! 
 + 
 +----- 
 + 
 +Does not work for me, keep seeing " <? echo $s; ?> " in the input field, and convert does not do a thing, neither on IE nor on Firefox. 
 + 
 +Perhaps I'm doing something wrong?? 
 + 
 +-Theo 
 + 
 +----- 
 + 
 +@theo: It's a "new" setting in current php versions which disables the php short tags, so you either have to replace the: <code><?</code> with: <code><?php</code> in the php script, **or** in your php.ini set the following parameter: <code>short_open_tag = on</code> 
 + 
 +-Steven
  
-Bad link!+Changing the ini files worked for me - you also need to restart your Apache server before it will work. --- [[user>gymnophoria|gymnophoria]] //2013/01/10 16:58//
tips/xls2wiki.1256023075.txt.gz · Last modified: 2009-10-20 09:17 by 194.248.13.254

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki