テキストオプションのフォントの遠隔地およびラテン名を指定する
Contents
[
Hide
]
可能な使用シナリオ
時々、日本語、中国語、タイ語などの遠隔地の言語フォントでテキストを表示したい場合があります。Aspose.CellsはTextOptions.FarEastName プロパティを提供し、遠隔地の言語のフォント名を指定するために使用できます。また、TextOptions.LatinName プロパティを使用してラテンのフォント名を指定できます。
テキストオプションのフォントの遠隔地およびラテン名を指定する
次のサンプルコードでは、テキストボックスを作成し、日本語のテキストを追加します。次に、テキストのラテン文字および遠東のフォント名を指定して、ワークブックを出力エクセルファイルとして保存します。以下のスクリーンショットは、Microsoft Excelでの出力テキストボックスのラテン文字および遠東のフォント名を示しています。
サンプルコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Create empty workbook. | |
Workbook wb = new Workbook(); | |
// Access first worksheet. | |
Worksheet ws = wb.Worksheets[0]; | |
// Add textbox inside the worksheet. | |
int idx = ws.TextBoxes.Add(5, 5, 50, 200); | |
Aspose.Cells.Drawing.TextBox tb = ws.TextBoxes[idx]; | |
// Set the text of the textbox. | |
tb.Text = "こんにちは世界"; | |
// Specify the Far East and Latin name of the font. | |
tb.TextOptions.LatinName = "Comic Sans MS"; | |
tb.TextOptions.FarEastName = "KaiTi"; | |
// Save the output Excel file. | |
wb.Save("outputSpecifyFarEastAndLatinNameOfFontInTextOptionsOfShape.xlsx", SaveFormat.Xlsx); |