====== xls2wiki ====== ===== 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. Just copy cells in Excel and paste it, then press 'convert' ===== code =====
WIKI2EXCEL converter
Copy and paste your Excel or Wiki table below and press [Convert!]
Скопируйте и вставьте таблицу из Excel или Wiki и нажмите [Convert!] (конвертировать)
Excel » Wiki
Wiki » Excel

Version 0.1 :
  • Headers from wiki2excel will not be converted properly
  • Links with alternative text (like [[link|alt.text]] ) will not convert properly
===== Comments Support Wiki header on first Line ===== I have find this script helpful\\ I would like just to add this lines to put the first line like an header:\\ //explode the source by line with the use of regular expressions $arrayS = preg_split ("/[\n,]+/", $s); $nb_lines = count ($arrayS)-1; $s = $s . $nb_lignes; $s = ""; // we clean the text foreach ( $arrayS as $key => $lines ){ if ($key == 0) { //we put the header here on the first line $lines = str_replace("|", "^", $lines); }//end if $s = $s . $lines . "\n"; }//end for $s = substr($s,0,-2); //get rid of last newline conversion > This converts cell contents like ", " (aka. '''') into a ''\n''. Couldn't figure out why (code dyslexia)... Finally, the code with English / French / Russian translations, \\ empty cells stay empty (no " . "), first line become header: $lines ){ if ($key == 0) { $lines = str_replace("|", "^", $lines); }//end if $s = $s . $lines . "\n"; }//end for $s = substr($s,0,-2); //get rid of last newline conversion }else{ $s = str_replace("^", "|", $s); $s = str_replace("|\r\n|", "\r\n", $s); $s = str_replace("\r\n ", "\r\n", $s); $s = str_replace(" |", "|", $s); $s = str_replace("| ", "|", $s); $s = str_replace("|", "\t", $s); $s = substr($s,1); // get rid of first | without /r/n } ?>
WIKI2EXCEL converter
Copy and paste your Excel or Wiki table below and press [Convert!]
Copier et coller votre Table Excel ou Wiki dans le cadre ci-dessous et cliquez sur [Convert!]
Скопируйте и вcтавьте таблицу из Excel или Wiki и нажмите [Convert!] (конвертировать)
Excel - Wiki
Wiki - Excel

Version 0.1 :
  • Headers from wiki2excel will not be converted properly
  • Links with alternative text (like [[link|alt.text]] ) will not convert properly
There is a spell mistake here... $nb_lines = count ($arrayS)-1; $s = $s . $nb_lignes; nb_lignes should be **nb_lines**. ===== Installation ===== :?: 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: use iframe.... 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. Look to this plugins if you hate HTML: [[plugin:iframe]] You can **not** try to include directly the code in a wiki page either: something like: Put the code here//§ 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 ===== 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. Please help. ===== Remarks ===== 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 " " 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: with: in the php script, **or** in your php.ini set the following parameter: short_open_tag = on -Steven 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//