The component converts HTML files(strings) into RTF or TXT
files (strings) with images, tables, CSS etc.
This scheme shows all methods and properties of DLL to help
you specify a conversion mode that output RTF will look as you wish.
The HTML-to-RTF Pro DLL has
written on C/C++, it's completely standalone and doesn't require MS Word or
any other word processors.
|
|
||||||||
char
* htmltortf_string(char * html, char * rtf, struct ConvertSettings cs) -
this method takes HTML string and returns RTF string. When this function finished
converting and you got rtf string, launch the function flushlist()
to release memory.
See C++
and Delphi
samples
return values:
pointer (char *) to RTF buffer, memory was allocated by function htmltortstring().
Copy this RTF buffer into some local memory/buffer and next launch the method
int flushlist()
int
htmltortf_file(char *htmlfile, char *outfolder, struct ConvertSettings cs) -
this method converts HTML
file into RTF file. This method supports image conversion.
See C++
and Delphi
samples
return values:
0 - converting successful
2 - not enough
memory
3 - can't create ouput rtf/text file
4 - can't open html file
5 - html file has zerow length
int flushlist() - releases memory (necessary only after function htmltort_string)
PageHeader
- put text in RTF page header (150 symbols max)
Possible values: any string, 150 symbols max
Default value: ""
Example: strcpy(cs.PageHeader,"Page
Header Example");
Example: strcpy(cs.PageHeader,"{\\b
Bold Page Header Example}");
Example: strcpy(cs.PageHeader,"{\\b\\i
Bold Italic Page Header Example}" );
Example: strcpy(cs.PageHeader,
"{\\qc Centered
Page Header Example}");
PageFooter
- put text in RTF page footer (150 symbols max)
Possible values: any string, 150 symbols max
Default value: ""
Example: strcpy(cs.PageFooter,
"Page Footer
Example" );
BorderVisibility
- this property set table border's visibility;
or
Possible values: Hidden, SameAsOriginalHtml, Visible.
Integer values:
|
cs.BorderVisibility
= 1; //visible
cs.BorderVisibility = 1; //invisible
|
OutputTextFormat
- type of output file (RTF or TXT)
Possible values: Rtf, Text.
Integer values:
|
Example:
cs.OutputTextFormat = 0; //Rtf
FontFace
- default font face
Possible values: Arial, Times New Roman, Verdana, Helvetica, Courier, Courier_New,
Times, Georgia, MS Sans Serif, Futura, Arial Narrow, Garamond, Impact,
Lucida_Console, Tahoma, Inform, Symbol, WingDings, Traditional Arabic
Integer values:
|
Example: cs.FontFace = 3; //Helvetica
FontSize
- default font size
Possible values: Any size
Example: cs.FontSize
= 12;
PageAlignment
- default page alignment
Possible values: AlignLeft, AlignRight, AlignCenter, AlignJustify.
Integer values:
|
Example: cs.PageAlignment = 3; //justify
PreserveAlignment
- keep alignment as in HTML
or
Possible values: 1 or 0
Default value: 1
PreserveTables
- convert tables or transform to text
or
Possible values: 1 or 0
Default value: 1
PreserveNestedTables
- preserve nested tables as in HTML or transform it to plain tables
or
Possible values: 1 or 0
Default value: 0
PreserveImages
- convert images or skip them (this feature works only in method ConvertFile)
or
Possible values: 1 or 0
Default value: 0
PreserveHttpImages
- download remote images or skip them (this feature works only in method ConvertFile)
or
Possible values: 1 or 0
Default value: 0
PreserveFontFace
- keep font face as in HTML
or
Possible values: 1 or 0
Default value: 0
PreserveFontSize
- keep font size as in HTML
or
Possible values: 1 or 0
Default value: 0
PreserveFontColor
- keep font color as in HTML
or
Possible values: 1 or 0
Default value: 1
PreserveBackgroundColor - keep background color as in HTML (for table columns and text)
Possible values: 1
or 0
Default value: 1
PreserveHyperlinks
- keep hyperlinks as in HTML
or
Possible values: 1 or 0
Default value: 0
PreserveTableWidth
- keep width of table columns as in HTML
or
Possible values: 1 or 0
Default value: 0
PageSize
- select page size for RTF
Possible values: A4, A3, A5, B5, Letter, Legal, Executive, Monarh
Default value: Letter
Integer values:
|
Example: cs.PageSize = 4; //Letter
PageOrientation
- select page orientation: Portrait or Landscape
Possible values: Portrait or Landscape
Integer values:
|
Example: cs.PageOrientation = 0; //Portrait
PageMarginLeft,
PageMarginRight, PageMarginTop, PageMarginBottom -
set page margins
Possible values: any value
Default values:
PageMarginLeft
= margin_25mm
PageMarginRight = margin_10mm
PageMarginTop = margin_10mm
PageMarginBottom = margin_10mm
|
RtfLanguage
- language which will be used for spelling in Microsoft Word
Possible values: l_Albanian, l_English, l_Belgian, l_Bulgarian, l_Hungarian,
l_Danish, l_Spanish,
l_Italian, l_Latvian, l_Lithuanian, l_German, l_Netherlands, l_Norwegian, l_Portuguese,
l_Romanian, l_Russian,
l_Ukrainian, l_Finnish, l_French, l_Czech, l_Swedish, l_Turkish, l_Arabic.
Integer values:
|
Default value:
l_English
Example: cs.RtfLanguage
= HTML2RTF.l_English
Example: cs.RtfLanguage
= 1033
ImageCompatible
- select image compatible: image_Word or image_WordPad
Possible values: image_Word or image_WordPad
Default value: image_Word
Integer values:
|
When
you selected image_Word the images will be strored
in JPG, PNG and WMF formats:
{\pict...\pngblip....89504e470d0a1a0a000......}
{\pict...\jpegblip....ffd8ffe070d0a1a0a000......}
{\pict...\wmetafile8....010009000003de000......}
When you selected image_WordPad the images will be
strored in BMP format:
{\pict...\dibitmap0....28000000690100......}
Example: cs.PageOrientation
= HTML2RTF.image_WordPad
Example: cs.PageOrientation
= 1
PreservePageBreaks
- preserve page breaks as in HTML
If '1', then converter will create new page in RTF each time when it meet
'page-break-before:' or 'page-break-aftrer:'.
Possible values: 1 or 0
Default value: 0
This is example for page-breaks:
<HTML>
<HEAD>
<TITLE>page-break-after</TITLE>
<STYLE>
P.after {page-break-after: always}
P.before {page-break-before: always}
</STYLE>
</HEAD>
<BODY>
<p class="before">Some text</p>
<p class="after">Some text</p>
<p>Some text</p>
</BODY>
</HTML>
PageNumbers
- put page numbers
Possible values: PageNumDisable, PageNumFirst and PageNumSecond
Default value: PageNumDisable
Integer values:
|
Example: cs.PageNumbers = HTML2RTF.PageNumFirst
PageNumbersAlignH
- horizontal alignment of page numbers
Possible values: AlignLeft, AlignRight, AlignCenter.
Integer values:
|
Default value: AlignCenter
Example: cs.PageNumbersAlignH
= HTML2RTF.AlignLeft
Example:
cs.PageNumbersAlignH = 0
PageNumbersAlignV
- vertical alignment of page numbers
Possible values: AlignTop, AlignBottom
Integer values:
|
Default value: AlignBottom
Example: cs.PageNumbersAlignV
= HTML2RTF.AlignLeft
Example:
cs.PageNumbersAlignV = 0
PreserveHR
- keep horizontal rule <HR> as in HTML
Possible values: 1 or 0
Default value: 1
RtfParts
- allows to create completely RTF or only RTF body which you can insert inside
another RTF file
Possible values: RtfCompletely, RtfBody
Default value: RtfCompletely
|
Example: cs.RtfParts
= 1;
CreateTraceFile
- forces DLL to create tracing text file, this file shows you debug info and
helps find some errors
Possible values: 0 or 1
Default value: 0
Example: cs.CreateTraceFile
= 1;
By default tracing file will be created
on C:\htmltortf-trace.txt, you can also specify path for this file using this
parameter:
TraceFilePath
- path for tracing file
Possible values: any string
Default value: "C:\htmltortf-trace.txt"
Example: strcpy(cs.TraceFilePath,
"D:\\report.txt");
TableCellPadding
- set default cell padding in pix for all tables inside converting file
Possible values: 0 to 10
Default value: 2
Example: cs.TableCellPadding
= 10;