|
Cookbook /
ExcelPasteSummary: Copy and paste spreadsheet tables (e.g., from Excel) into pages
Version:
Prerequisites: pmwiki-2.0.0
Status: Stable
Maintainer: Pm
Votes:
Questions answered by this recipe
DescriptionThe tabtable.zipΔ (or patched tabtable-2007-08-15.zipΔ) script converts spreadsheet data into simple PmWiki tables. (This script requires PmWiki 2.0.beta22 or later.) With this recipe installed, an author can simply
PmWiki will then convert the pasted data into a simple PmWiki table, ready for editing. Numeric cells are automatically right aligned, while other cells are left aligned. InstallationTo install this script, download and unpack the tabtable.zipΔ (or patched tabtable-2007-08-15.zipΔ) . The tabtable.php script should go in the cookbook/ directory, and the excel.gif file should go in pub/guiedit/. Then add the following line to a local configuration file (e.g., local/config.php) before the final " include_once('cookbook/tabtable.php');
Notes and CommentsProblem with Archive tabtable.zip seems to be a corrupt or damaged archive. Is there somewhere else to get this? fixed original tabtable.zipΔ and patched tabtable-2007-08-15.zipΔ file. -- (jtankers) Great! Works also with tables out of Word. Very supportive to help the 'naïve' users overcome the fear of working with tables in PmWiki. Thanks Pm for this one. (DirkBlaas) Excellent! This recipe, along with BibtexRef and PmWikiDraw, proves that text isn't the only thing you can share. [RickL] Could you please add the line with the th css background in the cookbook ? SDV(
Does this recipe work with linux/oppen-office? GC Yes. Tested with SUSE10 Desktop and OpenOffice 2.02 Does this work on a Mac with Microsoft Office 2004? Yes, worked fine with Excel 2004 for Macintosh and Safari browser. (April 25, 2006) This plugin also works to copy and paste from Google Spreadsheets. Good plugin, but just wanted to mention that with the Beeblebrox-Gila Skin the Button is placed slightly higher for some reason. Don't know if it is due to the skin or this plugin. (July 4, 2006)^ Can I manually enter tab stop characters in the edit window to use this recipe to quickly generate tables in the browser? Yes, if you know which key yields tab stop characters in your browser. Which key yields tab stop characters in the Microsoft Internet Explorer on an XP machine? I tried the tab key along with most modifer keys and combinations of them without luck. --Henning October 24, 2006, at 01:07 PM Tab is reserved for web page navigation, however you can type tab in Notepad or other text editor and copy/paste. -- (jtankers) August 6, 2007 Patch: make first row a heading (RussFink) The following is a diff-style patch for making tabtable add the '!' to the first row of the tables, thus causing them to appear as heading rows. If you don't want that, you can always manually edit and remove them, but I think for general purposes you might want this. Note, Patrick, if you disagree, please augment this with a variable that lets you deselect the behavior from config.php. I'm not that good of a PHP hack. Here's the patch. --- tabtable.php 2005-02-25 10:30:23.000000000 -0700
+++ tabtable-raf.php 2007-01-23 10:21:41.000000000 -0700
@@ -50,15 +50,17 @@
while ($row && count(end($row))==0) { array_pop($row); $x = "\n".$x; }
if ($row) {
$y[] = "||class='tabtable'";
+ $_first = '!'; /* RAF * first pass use heading formats */
while ($row) {
$col = array_shift($row);
$r = '||';
for($i=0; $i<count($wid); $i++) {
$m = preg_match('/^\\s*\\(?-?[\\d,]+\\.?\\d*\\)?\\s*$/', @$col[$i])
- ? " %{$wid[$i]}s||" : "%-{$wid[$i]}s ||";
+ ? "$_first %{$wid[$i]}s||" : "$_first%-{$wid[$i]}s ||"; /* RAF */
$r .= sprintf($m,@$col[$i]);
}
$y[] = $r;
+ $_first = ''; /* RAF */
}
$row = array(); $wid = array();
}
Nice recipe, but first shot revealed a serious bug: when you already have tables on your page, it repeats them all over the resulting page. So if you convert with this recipe, you should do it in an empty page and then copy-paste it to your target. (June 2007) Awesome! This can be a huge first step in integrating a table into a wiki page leaving only minor formatting changes. Works great for me. I do have a feature request: i would like for the recipe to have the ability to convert to the advanced table markup instead of the " That would be a powerful feature. I do like the standard mark up also, as it favors editor accessibility over display format. Patch: Special characters and concise output (jtankers) This patch tabtable-jt (or patched tabtable-2007-08-15.zipΔ) converts embedded line feeds and pipes, trims extra spaces and conditionally makes first row a heading. Suggestion for improvement: Use advanced table markupLet the recipe generate advance table markup instead. This, combined with the recipe Cookbook:TableEdit, allows one to easier edit the pasted table. Contributors
See Also
SandboxThis recipe has been enabled on this page, so you can experiment with it below. Follow the directions given in the description above.
|