Uso degli Stili Incorporati

Come utilizzare gli stili incorporati

Il metodo Workbook.createBuiltinStyle(BuiltinStyleType) e l’enumerazione BuiltinStyleType rendono comodo l’uso degli stili incorporati. Ecco un elenco di tutti gli stili incorporati possibili:

  • TwentyPercentAccent1
  • TwentyPercentAccent2
  • TwentyPercentAccent3
  • QuindiciPercentAccent4
  • QuindiciPercentAccent5
  • QuindiciPercentAccent6
  • QuarantaPercentAccent1
  • QuarantaPercentAccent2
  • QuarantaPercentAccent3
  • QuarantaPercentAccent4
  • QuarantaPercentAccent5
  • QuarantaPercentAccent6
  • SessantaPercentAccent1
  • SessantaPercentAccent2
  • SessantaPercentAccent3
  • SessantaPercentAccent4
  • SessantaPercentAccent5
  • SessantaPercentAccent6
  • Accent1
  • Accent2
  • Accent3
  • Accent4
  • Accent5
  • Accent6
  • Cattivo
  • Calcolo
  • VerificaCella
  • Virgola
  • Virgola1
  • Valuta
  • Valuta1
  • TestoEsplicativo
  • Buono
  • Intestazione1
  • Intestazione2
  • Intestazione3
  • Intestazione4
  • Collegamento ipertestuale
  • CollegamentoIpertestuale
  • Input
  • CellaaCollegata
  • Neutrale
  • Normale
  • Nota
  • Output
  • Percentuale
  • Titolo
  • Totale
  • TestoAvviso
  • LivelloRiga
  • LivelloColonna

Codice Node.js per utilizzare stili incorporati

const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const output1Path = path.join(dataDir, "Output.xlsx");
const output2Path = path.join(dataDir, "Output.out.ods");
const workbook = new AsposeCells.Workbook();
const style = workbook.createBuiltinStyle(AsposeCells.BuiltinStyleType.Title);
const cell = workbook.getWorksheets().get(0).getCells().get("A1");
cell.putValue("Aspose");
cell.setStyle(style);
const worksheet = workbook.getWorksheets().get(0);
worksheet.autoFitColumn(0);
worksheet.autoFitRow(0);
workbook.save(output1Path);
console.log(`File saved ${output1Path}`);
workbook.save(output2Path);
console.log(`File saved ${output2Path}`);