Dear Dave, Thanks for your response, Yes, the requirement was to put the whole html file in a single cell, but now that understand it is almost impossible to do, I have to decide on limiting the features/syntax of html used. I will look at your suggested solutions, thanks much for the help.
Regards, Satish HS On Thu, Mar 12, 2009 at 1:22 PM, Dave Fisher <[email protected]> wrote: > Satish, > > If your requirements are set by someone else to put a whole html markup in > a cell, then you are being asked to do the impossible - a square peg into a > round hole. > > If you only have a short richtext run that involves applying style to parts > of a paragraph then your idea makes sense. I mean that your markup is > <SPAN></SPAN> and other font changes, you have a chance using a technique > like Mark's. > > If you want more complex markup - like a table then really a cell in a > worksheet has an exact logical correspondence to <TD></TD> markup as in > Mark's example. > > If your complex markup includes images and graphics then you will need to > learn how to use the Escher drawing layer. > > The real question you need to ask your client is if there are limitations > in what these "complete html pages" really are. > > I hope this helps you. > > Regards, > Dave > > > On Mar 12, 2009, at 9:50 AM, Satish HS wrote: > > Dear MSB, >> Thanks again. Yes, My requirement is to write a complete html page to one >> single cell. However, if that is not possible, I would like to know if >> there >> is any way to write a complete .doc file or any RTF file to a single cell? >> >> Or any other swing component that I can use for rich text editing whose >> content can be exported to a single cell retaining all the format? >> >> Thanks for your help. I hope you don't mind me asking further. >> >> Thanks, >> Satish HS >> >> >> On Thu, Mar 12, 2009 at 3:23 AM, MSB <[email protected]> wrote: >> >> >>> Have you changed the requirement or are you saying that you want to open >>> an >>> html file, parse the markup, render a complete page so that it resembles >>> the >>> sort of display you would see in a browser,and then write that page into >>> a >>> single cell of an Excel spreadhseet? If so, then the answer is no, sorry. >>> I >>> do not have the ability, skills or time to create what amounts to a >>> browser. >>> >>> >>> Satish HS wrote: >>> >>>> >>>> Thanks for the response. I truly appreciate it. Regarding your question >>>> about the font and size, it will be specified in the html code.My actual >>>> need is to populate each cell with separate html-files. So, each cell >>>> corresponds to a html-file. >>>> I already have the java code which stores the html code in text file(s), >>>> how >>>> can I populate each cell with separate file. >>>> Can I do this with your solution of using Desktop class? Can you send me >>>> >>> a >>> >>>> small code snippet of it, if its not too much to ask. >>>> >>>> Thanks, >>>> Satish HS >>>> >>>> >>>> On Wed, Mar 11, 2009 at 2:19 PM, MSB <[email protected]> wrote: >>>> >>>> >>>>> Right, now I understand. You want HSSF to parse html markup for you. >>>>> >>>>> The short answer to your question then is no, it cannot do this. You >>>>> >>>> will >>> >>>> have to create a tool to parse the html and extract the information from >>>>> the >>>>> markup to create the cells. As an example of what I mean, what font and >>>>> what >>>>> size should HSSF use to render the example you gave? >>>>> >>>>> Just a simple question, why do you want to use HSSF to populate an >>>>> Excel >>>>> spreadsheet in this manner? Did you know that you can use Excel to open >>>>> an >>>>> html file and that it - Excel that is - can parse the markup and render >>>>> the >>>>> page for you? A short way around your problem would be to use Java to >>>>> create >>>>> a text file containing the html code and then ask it to start Excel for >>>>> you >>>>> using the Desktop class. >>>>> >>>>> >>>>> Satish HS wrote: >>>>> >>>>>> >>>>>> Alright, here is my need, My input is a html String as below: >>>>>> String str = "<html>Some word</html>"; >>>>>> >>>>>> How do I pass this on using the API to Excel Cell, I want the excel >>>>>> >>>>> cell >>>>> >>>>>> to >>>>>> display "Some word" in italic. >>>>>> The actual need is not just to display the italic but to support all >>>>>> >>>>> types >>>>> >>>>>> of html (rtf, background color, font, including images etc..) >>>>>> I hope it is clear now, please let me know if you any doubts. >>>>>> >>>>>> Regards, >>>>>> Satish HS >>>>>> >>>>>> >>>>>> On Wed, Mar 11, 2009 at 3:56 AM, MSB <[email protected]> >>>>>> >>>>> wrote: >>> >>>> >>>>>> cell >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> -- >>>>> View this message in context: >>>>> >>>>> >>> http://www.nabble.com/Writing-html-code-to-xls-cell-tp22441551p22461389.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] >>>>> >>>>> >>>>> >>>> >>>> >>> -- >>> View this message in context: >>> >>> http://www.nabble.com/Writing-html-code-to-xls-cell-tp22441551p22471025.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] >>> >>> >>> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
