delphi HTML代碼

來源:互聯網
上載者:User

標籤:style   http   color   使用   strong   io   檔案   for   

################################屬性 設定################################################

字型設定{
//---------------------------------------------------------------------------------------
字型名稱  <FONT face=微軟雅黑>This A Text</FONT>
字型大小  <FONT size=1><SPAN style="FONT-SIZE: 100pt"><P>This A Text</P></SPAN></FONT>
//---------------------------------------------------------------------------------------
粗體      <STRONG>This A Text</STRONG>
斜體      <EM>This A Text</EM>
底線    <U>This A Text</U>
刪除線    <S>This A Text</S>  
//---------------------------------------------------------------------------------------
字型顏色   <FONT color=#ff0000>This A Text</FONT>
字型背景色 <FONT style="BACKGROUND-COLOR: #0000ff">This A Text</FONT>  
//---------------------------------------------------------------------------------------
}

//--------------------------------------------------------------------------------------- 
字型樣式{
HTML 程式碼  - 樣式   設定 PasteHTML
//如何擷取

普通             <p>This Is a Text</p>
已編排格式       <pre>This Is a Text</pre>
地址             <address>This Is a Text</address>
標題1            <h1>This Is a Text</h1>
標題2            <h2>This Is a Text</h2>
標題3            <h3>This Is a Text</h3>
標題4            <h4>This Is a Text</h4>
標題5            <h5>This Is a Text</h5>
標題6            <h6>This Is a Text</h6>
帶編號的列表     <ol><li><p>This Is a Text</p></li></ol>
帶項目符號的列表 <ul><li><p>This Is a Text</p></li></ul>
目錄列表         <dir><li><p>This Is a Text</p></li></dir>
菜單列表         <menu><li><p>This Is a Text</p></li></menu>
定義條目         <dl><dt><h2>This Is a Text</h2></dt></dl>
定義             <dl><dd><h2>This Is a Text</h2></dd></dl>
段落             <dl><dd><p>This Is a Text</p></dd></dl>
}
//--------------------------------------------------------------------------------------- 

//--------------------------------------------------------------------------------------- 
對齊{
左    <P align=left>This Is A Text</P>
中    <P align=center>This Is A Text</P>
右    <P align=right>This Is A Text</P>
兩端  <p align="justify">This Is A Text</p>
}
//---------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------- 
序列{  
數字序列    <OL><LI> This Is A Text</LI></OL>
原點序列    <UL><LI> This Is A Text</LI></UL>
}
//--------------------------------------------------------------------------------------- 

//--------------------------------------------------------------------------------------- 
縮排{
向右前進
向左前進
//--------------------------------------------------------------------------------------- 
//向右縮排2次
  <BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr>
  <BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr>
    <P style="MARGIN-RIGHT: 0px" dir=ltr>This Is A Text</P></BLOCKQUOTE></BLOCKQUOTE>
//文字已經到最左邊了    
    <P style="MARGIN-RIGHT: 0px" dir=ltr>This Is A Text</P>

//---------------------------------------------------------------------------------------     

設定TAB大小   This Is A Text    //注 有幾個   就表示TAB是幾現在表示tab為2格
}

//--------------------------------------------------------------------------------------- 
上標/下標{
上標     <sup>aaaaaaaaa</sup>
下標    <sub>aaaaaaaaa</sub>
正常    清除樣式 
}
//--------------------------------------------------------------------------------------- 

WEB{
WEB背景色         <BODY bgColor=#000080>
WEB背景圖片     <BODY background=C:\1.jpg >


}
//--------------------------------------------------------------------------------------- 

插入圖片{
<IMG border=0 hspace=0 align=baseline src="C:\1.jpg">    


}
//--------------------------------------------------------------------------------------- 

插入超連結{
插入
刪除
//title是提示資訊
//HTTPS https://
<a href="https://www.baidu.com" title="提示資訊">Hello</a>
//FILE file://
<a href="file://C:/1.avi" title="提示資訊">Hello</a>
//FTP ftp:///
<a href="ftp:///C:/1.avi" title="提示資訊">Hello</a>
//HTTP  http:///
<a href="http:///C:/1.avi" title="提示資訊">Hello</a>
//郵件 收件者  mailto:  MainTO OutLook Express
<a href="mailto:[email protected]" title="提示資訊">Hello</a>
//新聞 news:/
<a href="news:/C:/1.avi" title="提示資訊">Hello</a>
//Telnet  telnet:/
<a href="telnet:/C:/1.avi" title="提示資訊">Hello</a>
//其他 /
<a href="/C:/1.avi" title="Hint ">Hello</a>
}
//--------------------------------------------------------------------------------------- 

插入書籤{

}
//--------------------------------------------------------------------------------------- 

插入多媒體{
media
real
flash
}

//--------------------------------------------------------------------------------------- 

插入表格{


}
//--------------------------------------------------------------------------------------- 

//--------------------------------------------------------------------------------------- 
HTML組件的插入{

}

//--------------------------------------------------------------------------------------- 
//建立1個空的文檔

//--------------------------------------------------------------------------------------- 
檔案{
建立文檔
儲存文檔
另存文檔
開啟文檔
列印
預覽列印
版面設定
查看文檔源檔案
寫入源檔案
}


編輯{
撤銷
重做
複製
粘貼
刪除
全選
剪下
尋找
替換
}
//--------------------------------------------------------------------------------------- 
狀態{
文檔標題
文檔是否被修改
文檔大小
選中的文本
設定選中的文本


}
//--------------------------------------------------------------------------------------- 

################################屬性 獲得################################################











//--------------------------------------------------------------------------------------- 
//--------------------------------------------------------------------------------------- 
使用方法
1 獲得當前選中文本的位置
2 使用粘貼HTML代碼的方式實現功能
3 完成命令後再次選中原來選中的文本



//--------------------------------------------------------------------------------------- 
//獲得當前選中的文本
function GetSelText():string;
begin
  Result:=( (Form1.WebBrowser1.Document as IHTMLDocument2).selection.createRange as IHtmlTxtRange).text;
end;
//--------------------------------------------------------------------------------------- 
//粘貼HTML代碼
procedure SetSelHtmlText(s:string);
begin
  ( (Form1.WebBrowser1.Document as IHTMLDocument2).selection.createRange as IHtmlTxtRange).pasteHTML(s);
end;
//--------------------------------------------------------------------------------------- 
//設定文本被選中 
procedure SetSelection(Start,Length:integer);
var
  TextRange:IHtmlTxtRange;
  Doc: IHtmlDocument2;
begin
  (Form1.WebBrowser1.Document as IHTMLDocument2).selection.empty;
  TextRange:=(Form1.WebBrowser1.Document as IHTMLDocument2).selection.createRange as IHtmlTxtRange;
  TextRange.collapse(true);
  TextRange.moveEnd(‘character‘,Start+Length);
  TextRange.moveStart(‘character‘,Start);
  TextRange.select;
end;
//--------------------------------------------------------------------------------------- 
//獲得文本被選中位置



//--------------------------------------------------------------------------------------- 
//設定HTML為正常
這個用獲得屬性來實現


//---------------------------------------------------------------------------------------


來自為知筆記(Wiz)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.