Apache POI: Show HTML text in Excel - java

Need a help. Honestly I don't have a clue now how to start on this.
<p>This is a test. Will this text be <b>bold</b> or <i>italic</i></p>
So in my excel, it should be
This is a test. Will this text be bold or italic
Again, I do have example which write this as plain text. Could anyone please help me in making this text as Rich Text in excel. Note: this is just an example. In realtime, it could be any html with styles.

Related

reading text along with formatting from excel cell using apache poi

I am trying to read ms-excel sheet cell value which contains RichText. Example below.
Welcome to apache-poi world.
Please use latest version of poi.
As you can see the word contains bold and italic word and new paragraph. I want to read this text along with style format, So that i can display in UI the way i have entered.

Creating a professional changelog using an AlertDialog (on Android in Java)

I am new to the Android app development (in Java) and I am also new to stackoverflow, so this is my first post/question. :)
Anyway, what I want, is, to create a more or less professional changelog using an AlertDialog. I wanted to set the message of it unsing strings. Ok, this worked well. But then it looked like this:
Text Text Text Text Text Text Text Text
But I want that it looks like this:
Text Text Text Text
Text Text
Text Text Text Text Text
For this I tried to add HTML tags to the string.xml file:<string name="About"><html><head>Text Text Text</head><body><b><p>Text Text Text Text Text Text </p></b></body></html></string>
(Just trying out what possibly could work)
And this worked for me only with bold-tags and stuff but I just couldn't figure out, how I can do it that my changelog looks like about the second example.
Can you help me, pls?
I'm looking forward to your suggestions!
PS: Sorry for the bad examples but I can't add images yet! :( and Sorry for my not so good English but I hope you could understand me! ;)
Either use \n in your String for a newline. Or use the paragraph tag, but I don't know if it is recognized. Like
<p>Texttext</p><p>second line</p>
u can use HTML as source eg. on .setText(String) / .append(String) via:
String fromHtml = Html.fromHtml("<u>html code</u>"))
for new line use escape char \n or in html < br />

Java apply HTML to a selected text

I wanted to know if there is a way that I can apply basic HTML to a text pane or text editor using a Highlighter. My objective is to basically do a text editor using basic HTML. For example a user highlights a part of some text and clicks on a button and I want that to become bold for example, using html but without showing tags or anything, just the selected text in bold. Also I wanted to know if it is better to use a textpane for this or a editorpane and why. Thank you.
anyway, you have to set a HTMLDocument to your JTextPane. Then, you can use the features of HTMLEditorKit and HTMLDocument to achieve what you want. For instance you can use :
insertHTML(jtp.getDocument(), jtp.getSelectionStart(), "<b>"+getSelectedText()+"</b>", 0, 0, HTML.Tag.B);
From the HTMLEditorKit. Something like that (I have not try the code)

Convert html code into plain text

I am developing android application in which i want to convert html code in to plain text and display it in the editText. I use Jsoup.jar for that but it shrink the data. Like it just remove the tag.I will not got to the next line. Does any one has the solution to display html code in the plain text? Any help or suggestions are accepted. Thank you.
Use Html.fromHtml(htmltext).

Java JTextPane Save

i was trying to do some simple text formatting using JEditorPane but then as knowledge grew i found JTextPane easier to implement and more robust.
my query is how do i save the formatted text in JTextPane to file? it should be RTF or HTML or other.. as this file is not opened by the application again.
it is a chat history text file with formatted text.
thank you.
You have write method for HTML and RTF from StyledEditorKit. See HTMLEditorKit.write and RTFEditorKit

Categories

Resources