HTMLリンクのターゲットタイプを変更する
Contents
[
Hide
]
Aspose.Cellsを使用すると、HTMLリンクのターゲットタイプを変更できます。HTMLリンクは以下のようになります。
<a href="http://www.aspose.com/" target="_self">
上記のHTMLリンクで、target属性が**_self**になっています。このtarget属性をHtmlSaveOptions.LinkTargetTypeプロパティを使用して制御できます。このプロパティは以下の値を持つHtmlLinkTargetType列挙型を受け入れます。
- HtmlLinkTargetType.Blank
- HtmlLinkTargetType.Parent
- HtmlLinkTargetType.Self
- HtmlLinkTargetType.Top
次のコードは、HtmlSaveOptions.LinkTargetTypeプロパティの使用方法を示しています。リンクのターゲットタイプをblankに変更します。デフォルトではparentが設定されます。
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 | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
string inputPath = dataDir + "Sample1.xlsx"; | |
string outputPath = dataDir + "Output.out.html"; | |
Workbook workbook = new Workbook(dataDir + "Sample1.xlsx"); | |
HtmlSaveOptions opts = new HtmlSaveOptions(); | |
opts.LinkTargetType = HtmlLinkTargetType.Self; | |
workbook.Save(outputPath, opts); | |
Console.WriteLine("File saved: {0}", outputPath); |