Hücreleri Html Dizesi Yönetme
Olası Kullanım Senaryoları
Belirli bir hücreye stil verilmiş veri koymanız gerektiğinde, hücreye HTML dizgesi atayabilirsiniz. Elbette, hücrenin HTML dizgesini de alabilirsiniz. Aspose.Cells for Node.js via C++ bu özelliği sunar. Aspose.Cells, amaçlarınıza ulaşmanız için aşağıdaki özellikler ve yöntemleri sağlar.
Aspose.Cells for Node.js via C++ kullanarak HTML dizgesiyle alın ve ayarlayın
Bu örnek aşağıdakileri göstermektedir:
- Bir çalışma kitabı oluşturun ve bazı verileri ekleyin.
- İlk çalışma sayfasındaki belirli hücreyi alın.
- Hücreye HTML dizgesi ayarla.
- Hücrenin HTML dizgesini alın.
const AsposeCells = require("aspose.cells.node"); | |
const path = require("path"); | |
// The path to the documents directory. | |
const dataDir = path.join(__dirname, "data"); | |
// Instantiating a Workbook object | |
let workbook = new AsposeCells.Workbook(); | |
// Obtaining the reference of the newly added worksheet | |
let ws = workbook.getWorksheets().get(0); | |
let cells = ws.getCells(); | |
// Setting the value to the cells | |
let cell = cells.get("A1"); | |
cell.putValue("Fruit"); | |
cell = cells.get("B1"); | |
cell.putValue("Count"); | |
cell = cells.get("C1"); | |
cell.putValue("Price"); | |
cell = cells.get("A2"); | |
cell.putValue("Apple"); | |
cell = cells.get("A3"); | |
cell.putValue("Mango"); | |
cell = cells.get("A4"); | |
cell.putValue("Blackberry"); | |
cell = cells.get("A5"); | |
cell.putValue("Cherry"); | |
let c3 = cells.get("C3"); | |
// set html string for C3 cell. | |
c3.setHtmlString("<b>test bold</b>"); | |
let c4 = cells.get("C4"); | |
// set html string for C4 cell. | |
c4.setHtmlString("<i>test italic</i>"); | |
// get the html string of specific cell. | |
console.log(c3.getHtmlString()); | |
console.log(c4.getHtmlString()); |
Örneğin ürettiği çıktı
Yukarıdaki örnek kodun çıktısını aşağıdaki ekran görüntüsünde görebilirsiniz.