HtmlSaveOptions.TableCssId özelliği ile Tablo Öğeleri Stillerini Ön Eklemek
Olası Kullanım Senaryoları
Aspose.Cells, tablo öğeleri stillerini HtmlSaveOptions.table_css_id özelliği ile ön eklemek için izin verir. Varsayalım ki, bu özelliği MyTest_TableCssId gibi bir değerle ayarlarsanız, aşağıdaki gibi tablo öğeleri stilleri bulacaksınız
table#MyTest_TableCssId
#MyTest_TableCssId tr
#MyTest_TableCssId col
#MyTest_TableCssId br
etc.
Aşağıdaki ekran görüntüsü, çıktı HTML’sine HtmlSaveOptions.table_css_id özelliğinin kullanılmasının etkisini gösterir.
HtmlSaveOptions.TableCssId özelliği ile Tablo Öğeleri Stillerini Ön Eklemek
Aşağıdaki örnek kod, HtmlSaveOptions.table_css_id özelliğinin kullanımını gösterir. Referans için kod tarafından oluşturulan çıktı HTML’si‘ni inceleyin.
Örnek Kod
from aspose.cells import HtmlSaveOptions, Workbook | |
from aspose.pydrawing import Color | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# Create workbook object | |
wb = Workbook() | |
# Access first worksheet | |
ws = wb.worksheets[0] | |
# Access cell B5 and put value inside it | |
cell = ws.cells.get("B5") | |
cell.put_value("This is some text.") | |
# Set the style of the cell - font color is Red | |
st = cell.get_style() | |
st.font.color = Color.red | |
cell.set_style(st) | |
# Specify html save options - specify table css id | |
opts = HtmlSaveOptions() | |
opts.table_css_id = "MyTest_TableCssId" | |
# Save the workbook in html | |
wb.save("outputTableCssId.html", opts) |