Node.js kullanarak C++ ile HtmlSaveOptions.TableCssId özelliği ile tablo elementlerinin stillerine önek ekleme
Olası Kullanım Senaryoları
Aspose.Cells, tablo ögeleri stillerine HtmlSaveOptions.getTableCssId() özelliği ile önek eklemenize izin verir. Diyelim ki bu özelliği MyTest_TableCssId gibi bir değere ayarlarsanız, aşağıdaki gibi tablo elementleri stillerini 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.getTableCssId() ö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.getTableCssId() özelliğinin kullanımını gösterir. Referans için kod tarafından oluşturulan çıktı HTML’si‘ni inceleyin.
Örnek Kod
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sample.xlsx");
// Create workbook object
const wb = new AsposeCells.Workbook();
// Access first worksheet
const ws = wb.getWorksheets().get(0);
// Access cell B5 and put value inside it
const cell = ws.getCells().get("B5");
cell.putValue("This is some text.");
// Set the style of the cell - font color is Red
const st = cell.getStyle();
st.getFont().setColor(AsposeCells.Color.Red);
cell.setStyle(st);
// Specify html save options - specify table css id
const opts = new AsposeCells.HtmlSaveOptions();
opts.setTableCssId("MyTest_TableCssId");
// Save the workbook in html
wb.save("outputTableCssId.html", opts);