HtmlSaveOptions.TableCssId プロパティを使用してテーブル要素スタイルをプレフィックスする
Contents
[
Hide
]
考えられる使用シナリオ
Aspose.Cells を使用すると、テーブル要素のスタイルに接頭辞を付けることができますHtmlSaveOptions.TableCssId財産。このプロパティに次のような値を設定するとします。MyTest_TableCssId、次に示すようなテーブル要素スタイルが見つかります
table#MyTest_TableCssId
# MyTest_TableCssId tr
# MyTest_TableCssId col
# MyTest_TableCssId br
etc.
次のスクリーンショットは、使用の効果を示していますHtmlSaveOptions.TableCssId出力 HTML のプロパティ。
HtmlSaveOptions.TableCssId プロパティを使用してテーブル要素スタイルをプレフィックスする
次のサンプル コードは、HtmlSaveOptions.TableCssId財産。を確認してください出力 HTML参照用のコードによって生成されます。
サンプルコード
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-Java | |
//Create workbook object | |
Workbook wb = new Workbook(); | |
//Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Access cell B5 and put value inside it | |
Cell cell = ws.getCells().get("B5"); | |
cell.putValue("This is some text."); | |
//Set the style of the cell - font color is Red | |
Style st = cell.getStyle(); | |
st.getFont().setColor(Color.getRed()); | |
cell.setStyle(st); | |
//Specify html save options - specify table css id | |
HtmlSaveOptions opts = new HtmlSaveOptions(); | |
opts.setTableCssId("MyTest_TableCssId"); | |
//Save the workbook in html | |
wb.save("outputTableCssId.html", opts); |