²âÊÔÓï·¨¸ßÁÁµÄ C# ´úÂëµÄ html fragment Éú³É
²âÊÔÓï·¨¸ßÁÁµÄ C# ´úÂëµÄ html fragment Éú³É:
ÓÃcsdn blog API ·¢²¼.
ÏÂÃæÊÇ:
public class HtmlWriter
{
static Dictionary _colors;
static int _colorNum;
static StringBuilder _colorString;
///
///
///
///
///
public static string GenerateRtf(TextArea textArea)
{
_colors = new Dictionary();
_colorNum = 0;
_colorString = new StringBuilder();
StringBuilder htmlBuilder = new StringBuilder();
htmlBuilder.AppendLine("");
string fileContent = BuildFileContent(textArea);
//htmlBuilder.Append(@"\viewkind4\uc1\pard");
htmlBuilder.Append(fileContent);
htmlBuilder.AppendLine("");
return htmlBuilder.ToString();
}
static string BuildFileContent(TextArea textArea)
{
StringBuilder htmlBuilder = new StringBuilder();
foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) {
int selectionOffset = textArea.Document.PositionToOffset(selection.StartPosition);
int selectionEndOffset = textArea.Document.PositionToOffset(selection.EndPosition);
Ïà¹ØÎĵµ£º
_blank : ÔÚÒ»¸öеģ¬Ã»ÓÐÃüÃûµÄ´°¿ÚÖдò¿ªÖ¸¶¨Îĵµ
_self : ÔÚµ±Ç°´°¿ÚÖдò¿ªÎĵµ
_parent : ÔÚ¸¸´°¿ÚÖдò¿ªÎĵµ£¬µ±Ã»Óи¸´°¿Úʱ£¬_parentÓë_selfÊÇÒ»ÑùµÄ
_top £º ÔÚµ±Ç°´°¿ÚÖдò¿ªÎĵµ£¬²¢ÇÒ´ò¿ªµÄÎ ......
Ê×ÏÈÔÚlayoutÎļþ¼ÐϵÄxmlÖÐ ¼ÓÈëWebView¿Ø¼þ
<WebView
android:id="@+id/wv1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
ÔÙÔÚÖ÷ÎļþÖÐÊäÈëÈçÏ´úÂë
public class TestDemo extends Activity {
/** Called when the activity is first created. */ ......
ÔÚWebÓ¦ÓóÌÐòÌرðÊÇWeb2.0³ÌÐò¿ª·¢ÖУ¬¾³£Òª»ñÈ¡Ò³ÃæÖÐij¸öÔªËØ£¬È»ºó¸üиÃÔªËصÄÑùʽ¡¢ÄÚÈݵȡ£ÈçºÎ»ñÈ¡Òª¸üеÄÔªËØ£¬ÊÇÊ×ÏÈÒª½â¾öµÄÎÊÌâ¡£ÁîÈËÐÀοµÄÊÇ£¬Ê¹ÓÃJavaScript»ñÈ¡½ÚµãµÄ·½·¨ÓкܶàÖÖ£¬ÕâÀï¼òµ¥×öÒ»ÏÂ×ܽᣨÒÔÏ·½·¨ÔÚIE7ºÍFirefox2.0.0.11²âÊÔͨ¹ý£©¡£
1. ͨ¹ý¶¥²ãdocument½Úµã»ñÈ¡£º
(1)document. ......
ÔÚÍøÉÏËÑÑ°µ½2Öнâ¾ö·½°¸£º
1.ÆäʵֻҪÔÚ±í¸ñ¿ØÖÆÖÐÌí¼ÓÒ»¾ä
<td style="word-break:break-all">¾Í¸ã¶¨ÁË¡£
ÆäÖпÉÄܶÔÓ¢ÎÄ»»ÐпÉÄÜ»á·Ö¿ªÒ»¸öµ¥´ÊÎÊÌ⣺½â¾öÈçÏ£º
Óï·¨£º
word-break : normal | break-all | keep-all
²ÎÊý£º
normal : ¡¡ÒÀÕÕÑÇÖÞÓïÑԺͷÇÑÇÖÞÓïÑÔµÄÎı¾¹æÔò£¬ÔÊÐíÔÚ×ÖÄÚ»»ÐÐ
break-all ......
HtmlÖÐLabel±ê¼ÇµÄ×÷ÓúÍʹÓýéÉÜ
Label±êʶÓÐÁ½¸öÊôÐÔ£¬Ò»¸öÊÇFOR£¬Ò»¸öÊÇACCESSKEY¡£
FORµÄÒâ˼ÊÇ£¬Õâ¸öLableÊÇΪÄĸö¿Ø¼þ·þÎñµÄ£»
ACCESSKEYÔò¶¨ÒåÁË·ÃÎÊÕâ¸ö¿Ø¼þµÄÈȼü¡£
±ÈÈ磬ÓÐÒ»¸öÃû×Ö½ÐNameµÄÎı¾¿ò£¬<INPUT TYPE="TEXT" ID="Name" SIZE=30>£¬
ÄÇô£¬<label>¾Í¿ÉÒÔ¶¨Òå³É£º<LABEL FOR="Nam ......