RTF-2-HTML v8 User Guide
Using
RTF-2-HTML in ASP and ASP.NET
Our controls work on all
versions of Windows (Vista/2003/XP/2000/NT4) when used in ASP.
This is
some sample ASP code for using RTF-2-HTML in ASP:
RTF-2-HTML works perfectly in ASP.NET as well, please see the bottom of this page for dotNet (.NET) related code samples.
Classic ASP usage:
<%
Option Explicit
Dim objConverter
dim strHTML
Set objConverter = Server.CreateObject("EasyByte.RTF2HTMLv8")
objConverter.HTML_Title = "Test if control is
loaded"
Response.Write(objConverter.HTML_Title)
objConverter.DoDebug = "no"
objConverter.HTML_Colour = "FFAAFF"
objConverter.RTF_Text = "{\rtf1 <Hello!>
\par }}"
objConverter.Generator = "Demo 1"
objConverter.Links = "yes"
objConverter.ConvertImages = "no"
objConverter.CleanRTF = "yes"
strHTML = objConverter.ConvertRTF
Response.Write(strHTML)
SET objConverter = Nothing
%>
Usage in .NET v2:
For use in .NET v2. RTF-2-HTML
is a PURE .NET v2 assembly.
C# Example Code
1) include in References
to "EasyByte.dll"
Use code similar to
this:
EasyByte. RTF2HTMLv8
RTF2HTML = new
EasyByte.RTF2HTMLv8();
RTF2HTML.HTML_Title = "Some Title";
RTF2HTML.HTML_Colour = "white";
RTF2HTML.RTF_Text = rtf1.Rtf;
RTF2HTML.Generator = "My Own
RTF-2-HTML Convertor";
RTF2HTML.CleanRTF = "yes";
RTF2HTML.CleanHTML = "no";
RTF2HTML.XHTMLOutput = "no";
RTF2HTML.Links = "yes";
RTF2HTML.DoDebug = "no";
RTF2HTML.ConvertImages = "yes";
RTF2HTML.ImageFolder = System.IO.Path.GetTempPath();
RTF2HTML.ImageFormat = "png";
RTF2HTML.ImageName = "image";
RTF2HTML.LicenseKey =
"DEMO";
rtf2.Text = RTF2HTML.ConvertRTF();
RTF2HTML =
null;
VB.NET Example Code
1) include in References
to "EasyByte.dll"
Use code similar to
this:
Dim RTF2HTML As
New
EasyByte.RTF2HTMLv8
RTF2HTML.HTML_Title = "Some Title"
RTF2HTML.HTML_Colour = "white"
RTF2HTML.RTF_Text = rtf1.Rtf
RTF2HTML.Generator = "My Own
RTF-2-HTML Convertor"
RTF2HTML.CleanRTF = "yes"
RTF2HTML.CleanHTML = "no"
RTF2HTML.XHTMLOutput = "no"
RTF2HTML.Links = "yes"
RTF2HTML.DoDebug = "no"
RTF2HTML.ConvertImages = "yes"
RTF2HTML.ImageFolder = System.IO.Path.GetTempPath
RTF2HTML.ImageFormat = "png"
RTF2HTML.ImageName = "image"
RTF2HTML.LicenseKey = "DEMO"
rtf2.Text = RTF2HTML.ConvertRTF
RTF2HTML =
Nothing
Usage in .NET v1.1:
For use in .NET
v1.1
1) include in namespace - "using
RTF2HTMLv8.dll;"
2) Class type is "RTF2HTMLv8Class" usage:
"RTF2HTMLv8Class
objConvertor = new RTF2HTMLv8Class();"
Here is some .Net sample code:
RTF2HTMLv8.dll.RTF2HTMLv8Class
objConvertor = new RTF2HTMLv8.dll.RTF2HTMLv8Class();
objConverter.HTML_Title = "Some
Title";
objConverter.DoDebug = "no";
objConverter.HTML_Colour = "FFAAFF";
objConverter.RTF_Text = "{\rtf1 <Hello!>
\par }}";
objConverter.Generator = "Demo 1";
objConverter.Links = "yes";
objConverter.ConvertImages = "no";
objConverter.CleanRTF = "yes";
txtOutput.Text = objConverter.ConvertRTF();
This is for example some C# code (for .Net 1.1) that works with the
RTF-2-HTML:
using RTF2HTMLv8.dll;
public static string ConvertRTFtoHTML(string strINPUTrtf)
{
try
{
RTF2HTMLv8Class objConverter = new RTF2HTMLv8.dll.RTF2HTMLv8Class();
objConverter.HTML_Title = "Some
Title";
objConverter.DoDebug = "no";
objConverter.HTML_Colour = "FFAAFF";
objConverter.RTF_Text = strINPUTrtf;
objConverter.Generator = "Demo 1";
objConverter.Links = "yes";
objConverter.ConvertImages = "no";
objConverter.CleanRTF = "yes";
strHTML = (string)objConverter.ConvertRTF();
}
catch
{
strHTML = "";
}
return strHTML;
}
For developing with Eclipse in Java.
import org.jawin.COMException;
import org.jawin.DispatchPtr;
import org.jawin.win32.Ole32;
public class RTF2HTMLConverter {
public static String ConvertRTF(String rtfString,String imgDir)
throws COMException {
Ole32.CoInitialize();
DispatchPtr app = new DispatchPtr("EasyByte.RTF2HTMLv8");
System.out.println("app");
app.put("LicenseKey","DEMO");
app.put("HTML_Colour","white");
app.put("HTML_Title","RTF-2-HTML v8");
app.put("RTF_Text", rtfString);
app.put("Generator","RTF-2-HTML v8");
app.put("CleanRTF","yes");
app.put("CleanHTML","no");
app.put("XHTMLOutput","yes");
String html = (String) app.invoke("ConvertRTF");
Ole32.CoUninitialize();
return html;
}
}
Back
to Contents Page
|