Prefisso degli stili degli elementi della tabella con la proprietà HtmlSaveOptions.TableCssId
Possibili Scenari di Utilizzo
Aspose.Cells ti consente di prefissare gli stili degli elementi della tabella con la proprietà HtmlSaveOptions.TableCssId. Supponi di impostare questa proprietà con un valore come MyTest_TableCssId, allora troverai gli stili degli elementi della tabella come mostrato di seguito
table#MyTest_TableCssId
#MyTest_TableCssId tr
#MyTest_TableCssId col
#MyTest_TableCssId br
etc.
La seguente schermata mostra l’effetto dell’utilizzo della proprietà HtmlSaveOptions.TableCssId sull’HTML di output.
Prefisso degli stili degli elementi della tabella con la proprietà HtmlSaveOptions.TableCssId
Il codice di esempio seguente dimostra come utilizzare la proprietà HtmlSaveOptions.TableCssId. Si prega di controllare l'output HTML generato dal codice per avere un riferimento.
Codice di Esempio
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
//Create workbook object | |
Workbook wb = new Workbook(); | |
//Access first worksheet | |
Worksheet ws = wb.Worksheets[0]; | |
//Access cell B5 and put value inside it | |
Cell cell = ws.Cells["B5"]; | |
cell.PutValue("This is some text."); | |
//Set the style of the cell - font color is Red | |
Style st = cell.GetStyle(); | |
st.Font.Color = Color.Red; | |
cell.SetStyle(st); | |
//Specify html save options - specify table css id | |
HtmlSaveOptions opts = new HtmlSaveOptions(); | |
opts.TableCssId = "MyTest_TableCssId"; | |
//Save the workbook in html | |
wb.Save("outputTableCssId.html", opts); |