VXPLib Documentation: COM
|
IVXPQuickHTML::TextToHTML
-
Converts a simple text string into HTML-compatible format.
-
HRESULT TextToHTML(BSTR source, long LimitText, BSTR * dest);
|
Parameters
-
source [in] - Source text string to be converted
LimitText [in, defaultvalue(0)] - Preferred number of characters on a single line of text (read remarks)
dest [out, retval] - Returned text string that complies with HTML format
Remarks-
This function comes handy when you need to format a QHTML document using some text parameters. For instance, you might load
a QHTML resource like this:
<BODY BGCOLOR=Red gfc=Yellow><FONT COLOR=Blue><B>%S</B></FONT>
where %S is used as a placeholder to be changed with a real text value. If your text parameter is a plain
text you can insert such text into QHTML without any problem (for instance, by using CString::Format or wsprintf in VC++). But what if the text-parameter
contains such symbols as <, >, &, NextLine, Return? The resulting QHTML document won't have
correct syntax after such formatting. And this is when function TextToHTML comes into service. It does the following replacement
of symbols:
in "source" | in "dest" |
< | < |
> | > |
& | & |
NextLine, \n, 0AH | <BR> Note: If followed by Return <BR> is added only once |
Return, \r, 0DH | <BR> Note: If followed by NextLine <BR> is added only once |
Additionally, the function can split one line of text into a few lines of preferred width. Parameter LimitText must be set
to a number of symbols we would like to have on each line. By default LimitText is 0, which means the function won't
do any splitting.
When LimitText is not 0, and the number of symbols on the current line exceeds LimitText
the function will split the text on the first following occurrence of one of the symbols: Space, NextLine or Return.
See Also
- IVXPQuickHTML Overview
|
This document was last updated on 10/04/2003
Copyright © 2003 Tooltips.NET
|