How to convert plain text into html?

Hi
I'm looking for a nice method which converts any plain text to html. For example, text: "Me and you\nand a dog named boo."Conversion result should be:
<html>
<body>
Me and you<br>
and a dog named boo.
</body>
</html>I know, I could write such a code myself using regex. But I just wonder whether something like this already exists in the java api?
Greetings from Switzerland
Mickey

Use a StringReader to read the lines and add the lines between <html><pre> ... </pre></html>

Similar Messages

  • How to convert table content into html format?

    Hi,
    Experts,
    How to convert internal data into HTML format is there any function module or piece of code to download content into HTML.
    Thank u,
    Shabeer Ahmed.

    Then use this code....
    REPORT  ytest_table_html1.
    *        D A T A   D E C L A R A T I O N
    *-HTML Table
    DATA:
      t_html TYPE STANDARD TABLE OF w3html WITH HEADER LINE,
                                           " Html Table
    *- Declare Internal table and Fieldcatalog
      it_flight TYPE STANDARD TABLE OF sflight WITH HEADER LINE,
                                           " Flights Details
      it_fcat TYPE lvc_t_fcat WITH HEADER LINE.
                                           " Fieldcatalog
    *-Variables
    DATA:
      v_lines TYPE i,
      v_field(40).
    *-Fieldsymbols
    FIELD-SYMBOLS: <fs> TYPE ANY.
    *        S T A R T - O F - S E L E C T I O N
    START-OF-SELECTION.
      SELECT *
        FROM sflight
        INTO TABLE it_flight
        UP TO 20 ROWS.
    *        E N D - O F - S E L E C T I O N
    END-OF-SELECTION.
    *-Fill the Column headings and Properties
    * Field catalog is used to populate the Headings and Values of
    * The table cells dynamically
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'SFLIGHT'
        CHANGING
          ct_fieldcat            = it_fcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2.
      DELETE it_fcat WHERE fieldname = 'MANDT'.
      t_html-line = '<html>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<thead>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<tr>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<td><h1>Flights Details</h1></td>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '</tr>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '</thead>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<table border = "1">'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<tr>'.
      APPEND t_html.
      CLEAR t_html.
    *-Populate HTML columns from Filedcatalog
      LOOP AT it_fcat.
        CONCATENATE '<th bgcolor = "green" fgcolor = "black">'
            it_fcat-scrtext_l
            '</th>' INTO t_html-line.
        APPEND t_html.
        CLEAR t_html.
      ENDLOOP.
      t_html-line = '</tr>'.
      APPEND t_html.
      CLEAR t_html.
      DESCRIBE TABLE it_fcat LINES v_lines.
    *-Populate HTML table from Internal table data
      LOOP AT it_flight.
        t_html-line = '<tr>'.
        APPEND t_html.
        CLEAR t_html.
    *-Populate entire row of HTML table Dynamically
    *-With the Help of Fieldcatalog.
        DO v_lines TIMES.
          READ TABLE it_fcat INDEX sy-index.
          CONCATENATE 'IT_FLIGHT-' it_fcat-fieldname INTO v_field.
          ASSIGN (v_field) TO <fs>.
          t_html-line = '<td>'.
          APPEND t_html.
          CLEAR t_html.
          t_html-line = <fs>.
          APPEND t_html.
          CLEAR t_html.
          t_html-line = '</td>'.
          APPEND t_html.
          CLEAR t_html.
          CLEAR v_field.
          UNASSIGN <fs>.
        ENDDO.
        t_html-line = '</tr>'.
        APPEND t_html.
        CLEAR t_html.
      ENDLOOP.
      t_html-line = '</table>'.
      APPEND t_html.
      CLEAR t_html.
    *-Download  the HTML into frontend
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = 'C:\Flights.htm'
        TABLES
          data_tab                = t_html
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *-Display the HTML file
      CALL METHOD cl_gui_frontend_services=>execute
        EXPORTING
          document               = 'C:\Flights.htm'
          operation              = 'OPEN'
        EXCEPTIONS
          cntl_error             = 1
          error_no_gui           = 2
          bad_parameter          = 3
          file_not_found         = 4
          path_not_found         = 5
          file_extension_unknown = 6
          error_execute_failed   = 7
          synchronous_failed     = 8
          not_supported_by_gui   = 9
          OTHERS                 = 10.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    none of the above function modules r obsolete...

  • How to convert xml data into html format in bpel

    Hi ,
    Can any one tel me how to conevrt xml into html in oracle bpel.
    Does bpel support this functionality or not.
    Regards,
    Ana
    Edited by: user10181991 on Apr 5, 2009 11:16 PM

    Ana,
    We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
    Let me know if this helps.

  • How to convert given .text to .html

    I need to convert a textfile content to a html output.
    supppose if i gave Hello in a text file it should give me html file saying hello in browser

    Just put the necessary html-tags around:            try {
                    PrintWriter lv_out = new PrintWriter(new BufferedWriter(new FileWriter("filename.html")));
                    lv_out.write("<html><body>\n");
                    /* insert text-file */
                    BufferedReader lv_in = new BufferedReader(new FileReader("filename.text"));
                    String line;
                    while ((line = lv_in.readLine()) != null)
                        lv_out.write(line + "\n");
                    lv_in.close();
                    lv_out.write("</body></html>");
                    lv_out.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }make a > out of every "?gt?" (this forum doesnt display correctly it sometimes).
    koem

  • Converting SPool information into HTML Format

    Hi Friends,
    How to Converting SPool information into HTML Format
    and send this HTML INFORMATION INTO MAIL..
    can anyone send program for this issue pls.
    it is an urgent issue
    regards,

    Hi Rich,
    once again thanks for your kindly reply.
    but i am developing below Code.. that HTMAL AATCHMENTS ARE NOT COMING IN MAIL.
    PLS can you you verify the below code.
                           DATA DECLARATIONS                             *
    DATA: I_LIST   LIKE ABAPLIST OCCURS 0  WITH HEADER LINE,
          VARIANT  LIKE RSVAR-VARIANT,
          DOC_CHNG  LIKE SODOCCHGI1,
           RECLIST LIKE SOMLRECI1  OCCURS 5  WITH HEADER LINE,
    data:  spoolid    type tsp01-rqident.
    DATA IT_MAIL LIKE TSP01 OCCURS 0 WITH HEADER LINE.
    data  report_html like W3HTML  OCCURS 0 WITH HEADER LINE.
    DATA: G_ICONS(32) OCCURS 10 WITH HEADER LINE.
    DATA LISTOBJECT LIKE ABAPLIST OCCURS 0 WITH HEADER LINE.
    DATA  sent_to_all like sonv-flag.
    data : RECEIVER(30),
          spoolid    type tsp01-rqident,
           it_buffer like SOLI occurs 10 with header line.
    data: list type table of  abaplist with header line.
    data: htmllines type table of w3html with header line.
    data: maildata   like sodocchgi1.
    data: mailtxt    like solisti1 occurs 10 with header line.
    data: mailrec    like somlrec90 occurs 0  with header line.
                           TABLE DECLARATIONS                            *
    TABLES : TSP01.
                               SELECTION-SCREEN                          *
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN: SKIP.
    PARAMETERS : RQ2NAME LIKE TSP01-RQ2NAME .
                RQIDENT like TSP01-RQIDENT.
    SELECT-OPTIONS :  S_RECVR FOR RECEIVER  NO INTERVALS.
    SELECTION-SCREEN: SKIP.
    SELECTION-SCREEN: END OF BLOCK B1.
                               START-OF-SELECTION                        *
    START-OF-SELECTION.
    PERFORM SEND_TO_SPOOL.
      PERFORM GET_SPOOL_ID.
      loop at it_mail.
        PERFORM CONVERT_SPOOL_TO_PDF.
        PERFORM SEND_MAIL.
      endloop.
    Save the list
      call function 'SAVE_LIST'
           tables
                listobject         = list
           exceptions
                list_index_invalid = 1
                others             = 2.
    *&      Form  GET_SPOOL_ID
          Getting the Latest Spool Request Number
    FORM GET_SPOOL_ID.
      SELECT *
            FROM TSP01 INTO TABLE  IT_MAIL
           and   RQIDENT    = RQIDENT.
              WHERE  RQ2NAME   =  RQ2NAME .
    ENDFORM.                    " GET_SPOOL_ID
    *&      Form  CONVERT_SPOOL_TO_PDF
          Converting the Spool to PDF Document
    FORM CONVERT_SPOOL_TO_PDF.
    *--Assigning the Spool number
    WRITE :/ IT_MAIL-RQIDENT.
    spoolid = IT_MAIL-RQIDENT.
    *--Converting the Spool to PDF
    CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
      EXPORTING
        RQIDENT                    =  spoolid
      FIRST_LINE                 = 1
      LAST_LINE                  =
      TABLES
        BUFFER                     = it_buffer
    EXCEPTIONS
      NO_SUCH_JOB                = 1
      NOT_ABAP_LIST              = 2
      JOB_CONTAINS_NO_DATA       = 3
      SELECTION_EMPTY            = 4
      NO_PERMISSION              = 5
      CAN_NOT_ACCESS             = 6
      READ_ERROR                 = 7
      OTHERS                     = 8
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LISTOBJECT = IT_BUFFER.
    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
    EXPORTING
      REPORT_NAME         =
       TEMPLATE_NAME       = 'WEBREPORTING_REPORT'
      TABLES
        HTML                = report_html
        LISTOBJECT          = LISTOBJECT
       LISTICONS           = G_ICONS.
    ENDFORM.                    " CONVERT_SPOOL_TO_PDF
    FORM SEND_MAIL.
    call function 'WWW_LIST_TO_HTML'
           tables
                html = htmllines.
    maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test Subject'.
      loop at htmllines.
        mailtxt = htmllines.
        append mailtxt.
      endloop.
    LOOP AT S_RECVR.
    reclist-receiver = S_RECVR-LOW.
    reclist-rec_type = 'U'.
    append reclist.
    call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_data              = maildata
                document_type              = 'HTM'
                put_in_outbox              = 'X'
           tables
                object_header              = report_html "mailtxt
                object_content             = mailtxt
                receivers                  = reclist "mailrec
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                others                     = 8.
      if sy-subrc = 0.
    write 'mail sent'.
      endif.
    ENDLOOP.
    regards,
    venu.

  • How to convert a shape into text

    After searching for a while, I could only find the opposite, how to convert from text to shape. I this case I have a shape that I would like to conver to text so that I can use it as a bullet. Any suggestions on how to do this in photoshop CS5?
    Thank you

    Depending on your needs, an alternative solution could be to use a program like inDesign that can do inline graphics. Inline graphics are image objects that you can place at the insertion point of the text tool while typing text and they will flow with the text like when you place images here in the messages of this forum or word processors like Microsoft Word but inDesign has the capabilities to have text on paths, shapes, etc with all bells and whistles of a layout program.

  • How do I put text into an Edge File that clients can edit easily afterwards

    Hi
    Can anyone explain how I can put text into an edge file (styled with google fonts) and make it so that clients can access the text and update the text as they require?
    Previous suggestion was dynamically loading a .txt file - any instructions would be most appreciated.
    Thanks.

    Hi Resdesign!
    Your code is very useful to learn how to use Json in Adobe Edge Animate!
    But I have a question: why you use ( i ) as argument of the function UpdateInfo and when you recall it you use ( index )?
    $.getJSON('slides.json', function(data){
              //for(var i=0; i<data.length; i++){
    function updateInfo(i){
                        sym.$("photo").css({"background-image": "url('"+data[i].image+"')"});
                        sym.$("pillar").html(data[i].pillar);
                        sym.$("what").html(data[i].what);
                        // position
              index = -1;
              sym.$("btn").click(function(){
              index++;
                        if (index>=5){
                                  index = 0;
              updateInfo(index);
    Many thanks for your attention!
    Davide

  • Is it possible to convert PDF file into HTML

    Dear friends
    Is it possible to convert PDF file into HTML. I have few hundread PDF files i like to convert this files into HTML. I hope it can be done through Java but i don't know how to start this coding. anybody can give me a brief idea to go ahead.

    Why do you want to do this yourself? I quick search on Google showed several utilities to do this, some freeware, some commercial.

  • How to convert a optionset into multi selection picklist in crm 2011 using javasacript??

    hi,
    where user want to select not only one but multiple value
    from a pick list. I tried  examples but it shows some errors.
    How  to do it??

    Hey I meet a problème on my development see my result :
    link : https://social.microsoft.com/Forums/getfile/652331
    a multiple select list on my crm 2013 I do this process on this forum :
    link : https://social.microsoft.com/Forums/en-US/2db47a59-165d-40c9-b995-6b3262b949eb/how-to-convert-a-optionset-into-multi-selection-picklist-in-crm-2011-using-javasacript?forum=crmdevelopment
    my development :
    // var_sc_optionset >> Provide schema-name for Option Set field
    // var_sc_optionsetvalue >> Provide schema-name for field which will store the multi selected values for Option Set
    // OS >> Provide Option Set field object
    // OSV >> Provide text field object which will store the multi selected values for Option Set
    //Method to convert an optionset to multi select Option Set
    function ConvertToMultiSelect(var_sc_optionset, var_sc_optionsetvalue, OS, OSV)
    if( OS != null && OSV != null )
    OS.style.display = "none";
    Xrm.Page.getControl(var_sc_optionsetvalue).setVisible(false);
    // Create a DIV container
    // var addDiv = document.createElement("<div style='overflow-y:auto; color:#000000; height:160px; border:1px #6699cc solid; background-color:#ffffff;' />");
    var addDiv = document.createElement("div");
    addDiv.style.overflowY = "auto";
    addDiv.style.height = "160px";
    addDiv.style.border = "1px #6699cc solid";
    addDiv.style.background = "#ffffff";
    addDiv.style.color = "#000000";
    OS.parentNode.appendChild(addDiv);
    // Initialise checkbox controls
    for( var i = 1; i < OS.options.length; i++ )
    var pOption = OS.options[i];
    if( !IsChecked( pOption.text , OS, OSV) ){
    // var addInput = document.createElement("<input type='checkbox' style='border:none; width:25px; align:left;' />" );
    var addInput = document.createElement("input" );
    addInput.setAttribute("type","checkbox");
    addInput.setAttribute("style","border:none; width:25px; align:left;");
    else {
    // var addInput = document.createElement("<input type='checkbox' checked='checked' style='border:none; width:25px; align:left;' />" );
    var addInput = document.createElement("input" );
    addInput.setAttribute("type","checkbox");
    addInput.setAttribute("checked","checked");
    addInput.setAttribute("style","border:none; width:25px; align:left;");
    // var addLabel = document.createElement( "<label />");
    var addLabel = document.createElement( "label");
    addLabel.innerText = pOption.text;
    // var addBr = document.createElement( "<br />"); //it's a 'br' flag
    var addBr = document.createElement( "br"); //it's a 'br' flag
    OS.nextSibling.appendChild(addInput);
    OS.nextSibling.appendChild(addLabel);
    OS.nextSibling.appendChild(addBr);
    ///////Supported functions
    // Check if it is selected
    function IsChecked( pText , OS, OSV)
    if(OSV.value != "")
    var OSVT = OSV.value.split(";");
    for( var i = 0; i < OSVT.length; i++ )
    if( OSVT[i] == pText )
    return true;
    return false;
    // var_sc_optionsetvalue >> Provide schema-name for field which will store the multi selected values for Option Set
    // OS >> Provide Option Set field object
    // Save the selected text, this field can also be used in Advanced Find
    function OnSave(OS, var_sc_optionsetvalue)
    var getInput = OS.nextSibling.getElementsByTagName("input");
    var result = '';
    for( var i = 0; i < getInput.length; i++ )
    if( getInput[i].checked)
    result += getInput[i].nextSibling.innerText + ";";
    //save value
    control = Xrm.Page.getControl(var_sc_optionsetvalue);
    attribute = control.getAttribute();
    attribute.setValue(result);
    I have to do 2 field one is option list field and the second is textfield, 
    option list field : new_books
    textfiled          : new_picklistvalue
    my js is on onload event see : 
    link : https://social.microsoft.com/Forums/getfile/652333
    thanks you for you'r help 

  • How to convert database table into xml file

    Hi.
    How to convert database table into XML file in Oracle HTML DB.
    Please let me know.
    Thanks.

    This not really a specific APEX question... but I search the database forum and found this thread which I think will help
    Exporting Oracle table to XML
    If it does not I suggest looking at the database forum or have a look at this document on using the XML toolkit
    http://download-east.oracle.com/docs/html/B12146_01/c_xml.htm
    Hope this helps
    Chris

  • How to convert word doc into pdf - which product of adobe i need to use- what upgrades - am a newbie

    How to convert word doc into pdf - which product of adobe i need to use- what upgrades - am a newbie -  simple answers please - Thanks in advance.

    @Pipeline2007 - which version of Microsoft Office have you got? Older versions of Acrobat aren't compatible with the latest versions of Office, see this link for info:
    http://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html

  • How to convert jpeg files into word

    How to convert jpeg files into Word

    Hi Eugene,
    I don't think you can convert an image to a Word document, but you could place the JPEG into a Word document using the Insert > Object command in Word.
    For other questions relating to Word, you will probably have more luck getting an answer if you post on the Microsoft forums (we can help if you're using Acrobat, or another Adobe product, but you'll find the Word experts on the Microsoft forums.)
    Best,
    Sara

  • How to convert Date format into day in ssrs reports?

    Hi
    How to convert date format into day?
    10/01/2010 as like Monday like that?

    =weekdayname(datepart("w",Fields!mydate.Value))
    -Vaibhav Chaudhari

  • How do I mix text and Html format in a java mail?

    How do I mix text and Html format in a java mail? some part I want to keep the text format, the other part I want to use Html functions(like fond, color, etc)

    You don't mix them. Pick one or the other.
    However if you want to have a text version and an HTML version, so that mail readers that don't handle HTML can see regular text instead, then you could produce a "multipart/alternative" message. There's an explanation of how to do that in this article:
    http://www-128.ibm.com/developerworks/java/library/x-xmlist2/

  • How to convert Doc file into image

    hello frnds
                     Can any body guide me how to convert doc file into image and show into swf loader.
    actually i have to convert doc files into swf files in runtime so that i have to use this flow.
    is it possible to convert doc file into byte array and than convert into image.
    Thanks And Regards
        Vineet Osho

    You can convert any DisplayObject to byeArray using this function ImageSnapshot.captureBitmapData().getPixels()

Maybe you are looking for

  • Customer service knolwedge is critical in order for me to consider giving you my money

    Dear Verizon, There's no substitution for a knowledgeable person. I have been experiencing sub standard internet service from my current provider, not Verizon. Being that I live in an area with very few choices for brand band service, one of them not

  • Path and file name to long

    Hi I have a schema with a deep hierarchy that I am running xmlbeans on. Initially it failed to build because it couldn't find some of the class files it had generated. It turned out that the path and filename was too long for Windows XP to handle and

  • Blob filename

    i've a table with a blob-column i use webutil to save the object to the client. but how can i get the original filename of the object? a.e the name of the presentation (when it was uploaded) stored in the db (document.ppt). another question is: how c

  • ALV hierarchy header

    hi .. Abaper~ I have a question. I'd like to use the hierarchy header in ALV. For example. --no | name -| - part-- | | - |   position |  subpart---- |    1|- jake---|-senier -|accounting--|     2|miky|-junier---|recruting-----| isn't it possible? ple

  • Automator to scan images using Twain into Photoshop CS

    Hi, I Need to scan about 500 certificates to my hard drive. I have Photoshop CS and Epson 1650 scanner. What I would like to do it to be able to run an automate task from Photoshop that scans, imports and opens the certificate. To import at the momen