Anteporre agli stili degli elementi di tabella la proprietà HtmlSaveOptions.TableCssId
Contents
[
Hide
]
Possibili scenari di utilizzo
Aspose.Cells consente di prefissare gli stili degli elementi della tabella conHtmlSaveOptions.TableCssIdproprietà. Supponiamo di impostare questa proprietà con un valore comeMyTest_TableCssId, quindi troverai gli stili degli elementi della tabella come mostrato di seguito
table#MyTest_TableCssId
# MyTest_TableCssId tr
# MyTest_TableCssId col
# MyTest_TableCssId br
etc.
Lo screenshot seguente mostra l’effetto dell’utilizzoHtmlSaveOptions.TableCssIdimmobile in uscita HTML.
Anteporre agli stili degli elementi di tabella la proprietà HtmlSaveOptions.TableCssId
Il seguente codice di esempio spiega come utilizzareHtmlSaveOptions.TableCssIdproprietà. Si prega di controllareuscita HTMLgenerato dal codice per un riferimento.
Codice d’esempio
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); |