DocumentBase.TextEncoding 屬性
取得或設定字碼頁 (Code Page) 或字元集 (Character Set),Microsoft Office Word 會針對儲存為編碼文字檔的文件使用這些設定。
命名空間: Microsoft.Office.Tools.Word
組件: Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)
語法
'宣告
Public Property TextEncoding As MsoEncoding
public MsoEncoding TextEncoding { get; set; }
屬性值
型別:Microsoft.Office.Core.MsoEncoding
其中一個 MsoEncoding 值。
備註
此屬性會設定別於 HTML 編碼方式的文字編碼方式,而 HTML 編碼方式則是使用 WebOptions 物件的 Encoding 屬性加以設定。您可以從 WebOptions 屬性取得 WebOptions 物件。若要針對儲存為文字檔的所有文件設定文字編碼方式,請使用 DefaultTextEncoding 屬性。
範例
下列範例顯示當文件儲存為文字檔時,程式碼會將文件編碼方式設定為 Western。若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。
Private Sub DocumentTextEncoding()
Me.TextEncoding = Office.MsoEncoding.msoEncodingWestern
End Sub
private void DocumentTextEncoding()
{
this.TextEncoding = Office.MsoEncoding.msoEncodingWestern;
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。