Fontlarda Üstsimge ve Altsimge Efektleri Uygulama

Üstsimge ve Altsimge ile Çalışma

Font nesnesinin setIsSuperscript yöntemini doğru olarak ayarlayarak üst simge etkisini uygulayın. Alt simgeyi uygulamak için, Font nesnesinin setIsSubscript yöntemini doğru olarak ayarlayın.

Aşağıdaki kod örnekleri, metne üst simge ve altsimge uygulamanın nasıl yapılacağını göstermektedir.

Node.js kodu ile Metne Üst Simge etkisi Uygulama

const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Create directory if it is not already present.
const fs = require("fs");
if (!fs.existsSync(dataDir)) {
fs.mkdirSync(dataDir);
}
// Instantiating a Workbook object
const workbook = new AsposeCells.Workbook();
// Adding a new worksheet to the Excel object
workbook.getWorksheets().add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
const worksheet = workbook.getWorksheets().get(0);
// Accessing the "A1" cell from the worksheet
const cell = worksheet.getCells().get("A1");
// Adding some value to the "A1" cell
cell.putValue("Hello");
// Setting the font Superscript
const style = cell.getStyle();
style.getFont().setIsSuperscript(true);
cell.setStyle(style);
// Saving the Excel file
workbook.save(path.join(dataDir, "Superscript.out.xls"), AsposeCells.SaveFormat.Auto);

Node.js kodu ile Metne Alt Simge etkisi Uygulama

const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Create directory if it is not already present.
const fs = require('fs');
if (!fs.existsSync(dataDir)) {
fs.mkdirSync(dataDir);
}
// Instantiating a Workbook object
const workbook = new AsposeCells.Workbook();
// Adding a new worksheet to the Excel object
workbook.getWorksheets().add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
const worksheet = workbook.getWorksheets().get(0);
// Accessing the "A1" cell from the worksheet
const cell = worksheet.getCells().get("A1");
// Adding some value to the "A1" cell
cell.putValue("Hello");
// Setting the font Subscript
const style = cell.getStyle();
style.getFont().setIsSubscript(true);
cell.setStyle(style);
// Saving the Excel file
workbook.save(path.join(dataDir, "Subscript.out.xls"), AsposeCells.SaveFormat.Auto);