Search code examples
htmltext-formatting

Displaying paragraphs in HTML


I'm writing a web application which needs to bring the stored paragraphs into the front web. The text come from excel work sheet and contains control characters like indent. I want to show the text in the exactly manner as it was in excel. How can I do that then? Thanks in advance.


Solution

  • Without seeing your text to begin with, my initial suggestion would be to wrap it in pre-formatted tags. Note that this won't work for formatting like italics, underlines, etc. Merely white-space:

    <pre>
    Anything within these tags will
    
    maintain  its    original formatting. Spaces, new lines, and all.
    </pre>