测试语法高亮的 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);
相关文档:
首先在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. */ ......
在网上搜寻到2中解决方案:
1.其实只要在表格控制中添加一句
<td style="word-break:break-all">就搞定了。
其中可能对英文换行可能会分开一个单词问题:解决如下:
语法:
word-break : normal | break-all | keep-all
参数:
normal : 依照亚洲语言和非亚洲语言的文本规则,允许在字内换行
break-all ......
在Web应用程序特别是Web2.0程序开发中,经常要获取页面中某个元素,然后更新该元素的样式、内容等。如何获取要更新的元素,是首先要解决的问题。令人欣慰的是,使用JavaScript获取节点的方法有很多种,这里简单做一下总结(以下方法在IE7和Firefox2.0.0.11测试通过)。
1. 通过顶层document节点获取:
(1)document. ......
常用替换 JS(trim,ltrim,rtrim)和替换HTML标签
http://hi.baidu.com/sunsonruby/blog/item/e1bd76d5cc0efec751da4bc9.html
http://sxpyrgz.javaeye.com/blog/397470
<html>
<head>
<title>中国站长天空-网页特效-表单特效-只能输入中文的文本框</title>
<meta http-equiv="content-Type" ......
Html中Label标记的作用和使用介绍
Label标识有两个属性,一个是FOR,一个是ACCESSKEY。
FOR的意思是,这个Lable是为哪个控件服务的;
ACCESSKEY则定义了访问这个控件的热键。
比如,有一个名字叫Name的文本框,<INPUT TYPE="TEXT" ID="Name" SIZE=30>,
那么,<label>就可以定义成:<LABEL FOR="Nam ......