This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

ExcelToHTMLPlugin is a WikiPlugin that reads an MS Excel file, and displays it as an HTML table.

I haven't added CSS support yet, though I probably will soon. Right now, you just get a plain-vanilla html table with border='0'.

Feel free to make suggestions, criticize, or contribute changes.

The usage description is also available in German, see ExcelToHTMLPlugin Benutzung.
Eine deutsche Benutzungsbeschreibung siehe auf ExcelToHTMLPlugin Benutzung.

There is a dependency on the jexcelapi library, jxl.jar from http://www.andykhan.com/jexcelapi/

There is one parameter, named "src", which is the path to the excel file to be read.

I have only tested this with local and UNC paths on Windows 2000. Let me know if it works for you on *nix.

Note that the package name is com.xcurrent.wiki So, you'll have to add the package name to the plugin search path.

Sample usage is: [{INSERT ExcelToHTMLPlugin src='c:\somesheet.xls'}] or [{INSERT ExcelToHTMLPlugin border='1' src='\\the_server\somesheet.xls'}]

For use with an attached file, src is simply the filename:

[{INSERT ExcelToHTMLPlugin border='1' headerbackgroundcolor='#CC40CC' 
    headercolor='white' evenrowbackgroundcolor='#EEEEEE' src='ExcelToHTMLPlugin.xls'}]

--RichFreedman Plugin insertion failed: Could not find plugin ExcelToHTMLPluginPlugin insertion failed: Could not find plugin ExcelToHTMLPlugin

Daggerbox: Nice idea. To be really useful you should allow the Excel file to be an attachment, like the built-in Image plugin. Also borrowing from the Image plugin, consider changing the name and syntax to [{ExcelTable src='...' border='...' style='...' etc}]. As far as the implemenation goes, you might try using cellpadding rather than faking it with a nbsp.

RichFreedman: All good ideas - I'll work on them, and upload again when done. I was also considering making it usable with CSS - is there a "standard" way to do this? Perhaps the CSS Stylesheet could also be an attachment?

JanneJalkanen: We usually reserve the parameters "style" and "class" for CSS styles. For example, many plugins insert a <div style="xxx"> or <div class="xxx"> before the actual code, if you specify a style or class. For 2.2, this does not matter so much, since there you can use the style directive (double-% -signs) directly.

JerryAndrews: fixed a bug retrieving Excel files attached to the "current page". Documented the available properties; see ExcelToHTMLPlugin.xls(info). Updated sample usage (above). CSS is now available despite documentation above; see the attached .xls file. Deployed and working on Linux w/ Tomcat 5.5.12, Java 1.5.0_04.

Rajiv: The plugin has been behaving much better with the following changes:

  1. Start server with the system property -Djxl.nogc=true
  2. getInputStream used to open a URL connection to the localhost even if the excel sheet was attached to the same page. Changed the method like so:
    private final java.io.InputStream getInputStream(WikiContext wcontext, String src) throws Exception
    {

        //<New>
        WikiEngine engine = wcontext.getEngine();
        AttachmentManager mgr = engine.getAttachmentManager();
        Attachment att = mgr.getAttachmentInfo(wcontext, src);

        if (att != null) {
            //If it is an attachment do not open url stream
            return mgr.getAttachmentStream(att);
        }
        //</New>
        //Rest of the code to open a URL connection here
    }



Great plugin! Thanks a bunch

--Rajiv, 19-Jul-2006


The pages with the excel2html plugin seem to be loading slower. I am suspecting that the page is not being cached. Is this possible? Does having a plugin prevent the page from being cached?

--Rajiv, 20-Jul-2006


Plugin insertion failed: Failed to convert Excel to HTML: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

--Candid Dauth, 11-Aug-2006


Okay, I figured out the problem, the plugin tried to access my Excel file via URL and there were problems concerning HTTPS. Seems that Rajiv’s patch doesn’t work correctly yet, at least not with my version 2.4.33. I hope I’ll find the problem to submit a patch.

--Candid Dauth, 14-Aug-2006


Think I found the problem, I didn’t see that resolveWikiAttachmentURL() was still performed on the src attribute, fixed that now. Thanks for listening to my monologue. ;-)

--Candid Dauth, 14-Aug-2006


I just played with jxl, and it is pretty cool. I think the formula support could add a lot of power to wiki-based tables, not just to attached .xls files. So here are two suggestions:

1) Support a table defined the plugin body using Wiki markup. The "catch" is that this table could have embedded formulas using the familiar Excel syntax. The plugin would parse the table (pretty easy), create in memory a representation of the corresponding spreadsheet (supported by the jxl API) and output the result with the formulas replaced by their calculated values. 1.1) Support embedded plugins as ImageGen does - this would allow other plugins to generate tables with embedded formulas.

2) Add an option to generate "raw" output - just the wiki markup, without the HTML convertion. This would allow the output of the plugin to be consumed by other plugins that can handle embedded plugins that generate tables - for example, you would be able to generate charts from your spreadsheet (something jxl does not support today).

--Nascif Abousalh-Neto, 25-Aug-2006


Rich, could you possibly make an installation section to this document to show where to copy the attachments and whether any other tasks are needed. Cheers,

Paul T, 1 Sep 06.


Same question as above: I'd appreciate some more help on how to install the ExcelToHTMLPlugin and get it to run. Could you pls add an ExcelToHTML.jar? Thanx. Eva.

--Els, 07-Sep-2006


All great suggestions above - I apologize - I haven't checked in here in quite a while.
I'll incorporate the changes above, add some docs, and create a jar file.
I should be able to get to it in the next week or so - stay tuned.

Thanks!

--RichFreedman, 18-Sep-2006


Hi Rich,

You might want to check the code in the ImageGen family of plugins. It has two features that I believe would greatly benefit your plugin:

  • Support for checking the attachment version before generating a new transformation (usually an image in my plugins, in your case a new table derived from a spreadsheet);
  • Processing of the plugin body, including the evaluation of nested plugins.

I have been considering doing this myself, i.e. the creation of a new plugin to the ImageGen "family" based on the Excel processing library that you are using, but I don't like the idea of having two plugins doing basically the same thing.

Drop me a note if you would like to work together on this. I can send you some pointers.

Regards,

--NascifAbousalhNeto, 19-Sep-2006


Hi, Rich.

I'd like to try out this plugin, but I just can't find any installation instructions. I am probably missing something quite obvious, but would you please list some installation instructions here, or provide a link to some more generic installation steps?

--KarlHansen, 12-Apr-2007


Hello,

Thanks for this useful plugin. I modified it to add two new parameters :

  1. srcsheet to be able to specify a specific Excel sheet (and not display all sheets as successive table)
  2. keepformat to be able to keep Original Excel Format. This means that cell background color is recreated, text color is kept, bold and italic are also kept. In addition, to allow more flexibility to display or not empty cell, a cell will have border on the page (even if empty) only if it has borders in Excel. This is also a way to keep cells on the page with no borders.

For the last parameter, to be able to manage the color correctly, I used jxl.jar version 2.6.4 to get access to RGB class.

--Marc Pelissier, 01-Jun-2007


Trying to use the keepformat facility.
For the benefit of anyone else please note that the acceptable values appear to be 'yes' or 'no' - I tried 1 and 0 to being with.
On Firefox 2.0.0.4 cell background colours get lost. It's okay on IE.
Cell background colours do work on this Firefox if you set them as a paramater of the plugin as in some of the examples.

--Neville Hobson, 07-Jun-2007


Hello,

Indeed, I saw afterwards that cell background colors get lost in Firefox (OK in IE). This was due to the use of a deprecated html array command bgcolor. The new plugin version (java file attached was updated) now use style which is fine with Firefox and IE.

I also updated the Excel Attachement to indicate that keepformat is using yes or no values.

--Marc Pelissier, 11-Jun-2007

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
xls
Active Branch_Dec_11 Website u... 93.7 kB 2 15-Feb-2012 21:55 120.62.163.103
class
ExcelToHTMLPlugin.class 7.7 kB 6 14-Aug-2006 15:34 Candid Dauth
java
ExcelToHTMLPlugin.java 11.4 kB 7 14-Aug-2006 15:34 Candid Dauth
xls
ExcelToHTMLPlugin.xls 15.4 kB 2 20-Dec-2007 12:50 122.164.21.148
class
MPE_ExcelToHTMLPlugin.class 11.2 kB 1 02-Aug-2007 23:54 KarlHansen compiled from MPE_ExcelToHTMLPlugin.java
java
MPE_ExcelToHTMLPlugin.java 14.0 kB 2 11-Jun-2007 17:33 83.145.93.242 Use style instead of bgcolor which is deprecated for Firefox compatibility
xls
MPE_ExcelToHTMLPlugin.xls 26.6 kB 3 10-Jun-2010 19:02 193.247.180.4
jar
jxl.jar 438.2 kB 2 06-Sep-2004 19:35 200.48.230.16
« This particular version was published on 11-Jun-2007 17:36 by Marc Pelissier.