Yes you can, but not directly, there is no htmlToXSL() method in the api for example. The task should however be a quite straigtforward one depending on the complexity of the HTML because all you would need to do is decide what tag triggered the insertion of a new sheet/row/cell, decode any style information that may be a part of the html markup - and that is assuming that the html includes font/coloour and formatting information. Once you have this 'mapping' established, a simple parser such as SAX can be used to work through the HTML markup and 'pass' the information onto a class that would create matching occurrences of the relevant classes within POI and allow you to assemble a document.
There are limitations unfortunately - currently it is not possible to handle charts as well or easilly as Excel does and smaller things such as changing Excels column headings - A, B, C, D, etc - for text the user specifies is not supported. But aside from this it should be possible to use POI to accomplish almost anything you want to do with the Excel workbook. Finally, there are two different file formats - the older binary and newer OOXML based one. Poi supports both and it would be wiser of you - I think - to write code that addresses the classes in the so called SS usermodel. These support both file types and will allow you to offer support to your clients if they decide to move from anolder to a newer version of Excel. Should you require any further help, just drop a message to the list and I am confident that someone will reply. Yours Mark B PS If you do tackle this task, I am sure it would also be greatly appreciated if you could contribute just a little of the work - not the complete application of course just the basics of the SAX parser and transformation of tags to classes - as an example for inclusion on the POI website. fachhoch wrote: > > we have a web service were we convert html generated by my servlet > to pdf using flying saucer. > Now the clients are asking for transformation to excel. I am wondering if > I can create excel out of html on fly using apache poi ?, if not what > can help me ? > > -- View this message in context: http://old.nabble.com/generate-excel-from-html---on-fly-tp28439104p28443718.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
