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'}]}}}

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

__[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].  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:

# Start server with the system property -Djxl.nogc=true
# 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

        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);
        //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&rsquo;s patch doesn&rsquo;t work correctly yet, at least not with my version 2.4.33. I hope I&rsquo;ll find the problem to submit a patch.

--[Candid Dauth|mailto:cdauth.work@gmx.net], 14-Aug-2006


Think I found the problem, I didn&rsquo;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.

--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.


--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