Convert string of html to html

Examples

Convert different values to strings:

String(new Date());
String("12345");
String(12345);

Try it Yourself »


Definition and Usage

The String() method converts a value to a string.

Note

The String() method returns the same as the toString() method for any value.


Syntax

Parameters

ParameterDescriptionvalueRequired.
A JavaScript value.

Return Value

TypeDescriptionA string.The value converted to a string.

Browser Support

String() is an ECMAScript1 (ES1) feature.

ES1 (JavaScript 1997) is fully supported in all browsers:

ChromeEdgeFirefoxSafariOperaIEYesYesYesYesYesYes

More Examples

Examples

Convert different values to strings:

String(Boolean(0));
String(Boolean(1));
String([1,2,3,4]);

Try it Yourself »

ConvertToHTML (RichTextItem - Java)

Call this method to convert a RichTextItem to an HTML string. The form of the HTML created is similar to what is produced by the Domino® web server and sent to the client. Parameters that guide how the conversion is done can be supplied by a Vector of Strings (Java) or an array of strings (LS). After this method is called, the getHTMLReferences (RichTextItem class) method can be called. This call returns a Vector (Java) or array (LS) of HTMLReference objects. Each reference object has a Type property, which may be queried to determine how to interpret the data contained within the reference. The HTMLReference class was created to represent the data contained within an HTML reference.

Defined in

NotesRichTextItem

Syntax

public Strings ConvertToHTML(Vector Options)
		throws NotesException;

Parameters

ParameterDescriptionOptionsVector. A vector which includes the parameters list for converting.

Return Values

Return valueDescriptionVectorVector. The strings of HTML converted from the RTF field content.

Possible Exceptions

Possible exceptionsDescriptionHTML conversion error (4835)The operation failed to convert RTF content to HTML.

Language cross-reference

Converttohtml in LotusScript® NotesRichTextItem class

ConvertToHTML in JavaScript NotesRichTextItem class

Example

This example shows how to use this method to convert a RichTextItem to an HTML string:

import java.util.Date;
import java.util.Vector;

import lotus.domino.*;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

      try {
          Session session = getSession();
          AgentContext agentContext = session.getAgentContext(); 
          
          Database db = session.getCurrentDatabase();
          DocumentCollection col = db.getAllDocuments();
          Document doc = col.getFirstDocument();
          RichTextItem rt = (RichTextItem) doc.getFirstItem("RTF");
          
          String ret = "Convert RTF to HTML on"+(new Date()).toString()+"\r\n";
          ret = ret +  rt.ConvertToHTML(null);
          
          Vector refs = rt.getHTMLReferences();
          if(!refs.isEmpty()){
        	  for(int i =0; i< refs.capacity();i++){
        		  HTMLReference ref = (HTMLReference) refs.get(i);
        		  ret = ret + "\r\n";
        		  ret = ret + "Refrence Number:" + i +"\r\n";
        		  ret = ret + "Type ID:"+ ref.getType() +"\r\n";
        		  ret = ret + "Command ID:"+ ref.getCommandID() +"\r\n";
        		  ret = ret + "URL:"+ ref.getURL() + "\r\n";
        		  ret = ret + "FileName:"+ ref.getFileName() + "\r\n";
        		  ref.extractFile("C:\\kkk.gif",true);
        	  }
         } 
         System.out.print(ret);

      } catch(Exception e) {
          e.printStackTrace();
       }
   }
}

Call this method to convert a RichTextItem to an HTML string. The form of the HTML created is similar to what is produced by the Domino® web server and sent to the client. Parameters that guide how the conversion is done can be supplied by a Vector of Strings (Java) or an array of strings (LS). After this method is called, the getHTMLReferences (RichTextItem class) method can be called. This call returns a Vector (Java) or array (LS) of HTMLReference objects. Each reference object has a Type property, which may be queried to determine how to interpret the data contained within the reference. The HTMLReference class was created to represent the data contained within an HTML reference.

Defined in

NotesRichTextItem

Syntax

public Strings ConvertToHTML(Vector Options)
		throws NotesException;

Parameters

ParameterDescriptionOptionsVector. A vector which includes the parameters list for converting.

Return Values

Return valueDescriptionVectorVector. The strings of HTML converted from the RTF field content.

Possible Exceptions

Possible exceptionsDescriptionHTML conversion error (4835)The operation failed to convert RTF content to HTML.

Language cross-reference

Converttohtml in LotusScript® NotesRichTextItem class

ConvertToHTML in JavaScript NotesRichTextItem class

Example

This example shows how to use this method to convert a RichTextItem to an HTML string:

import java.util.Date;
import java.util.Vector;

import lotus.domino.*;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

      try {
          Session session = getSession();
          AgentContext agentContext = session.getAgentContext(); 
          
          Database db = session.getCurrentDatabase();
          DocumentCollection col = db.getAllDocuments();
          Document doc = col.getFirstDocument();
          RichTextItem rt = (RichTextItem) doc.getFirstItem("RTF");
          
          String ret = "Convert RTF to HTML on"+(new Date()).toString()+"\r\n";
          ret = ret +  rt.ConvertToHTML(null);
          
          Vector refs = rt.getHTMLReferences();
          if(!refs.isEmpty()){
        	  for(int i =0; i< refs.capacity();i++){
        		  HTMLReference ref = (HTMLReference) refs.get(i);
        		  ret = ret + "\r\n";
        		  ret = ret + "Refrence Number:" + i +"\r\n";
        		  ret = ret + "Type ID:"+ ref.getType() +"\r\n";
        		  ret = ret + "Command ID:"+ ref.getCommandID() +"\r\n";
        		  ret = ret + "URL:"+ ref.getURL() + "\r\n";
        		  ret = ret + "FileName:"+ ref.getFileName() + "\r\n";
        		  ref.extractFile("C:\\kkk.gif",true);
        	  }
         } 
         System.out.print(ret);

      } catch(Exception e) {
          e.printStackTrace();
       }
   }
}

How to convert string to HTML in HTML?

The simplest way to do this is to create an element, insert the string into with innerHTML , then return the element. /** * Convert a template string into HTML DOM nodes * @param {String} str The template string * @return {Node} The template HTML */ var stringToHTML = function (str) { var dom = document.

How to convert HTML string to HTML object in JavaScript?

// html string const htmlStr = "<h1>Hello World! </h1>"; // make a new parser const parser = new DOMParser(); // convert html string into DOM const document = parser. parseFromString(htmlStr, "text/html"); Now the HTML string is converted to an HTML DOM node.

How to convert text to HTML?

Upload and convert Word, PDF and other files to HTML. Even OCR text from PDF files..
Paste content from Microsoft Word or Excel or write your text in the Visual Editor..
Your text will be instantly converted to clean HTML. You can keep or remove formatting..
Your converted HTML will appear in the HTML Editor..

How to convert HTML string to HTML in Python?

This can be achieved with the help of html. escape() method(for Python 3.4+), we can convert the ASCII string into HTML script by replacing ASCII characters with special characters by using html. escape() method. By this method we can decode the HTML entities into text.