Establecer el espacio entre líneas del párrafo en una forma o cuadro de texto con Node.js vía C++
Contents
[
Hide
]
Puedes establecer el espacio entre líneas del párrafo, su espacio antes y espacio después usando las propiedades TextParagraph.getLineSpace(), TextParagraph.getSpaceBefore() y TextParagraph.getSpaceAfter() de la clase TextParagraph.
El siguiente código de ejemplo explica el uso de las propiedades mencionadas.
const AsposeCells = require("aspose.cells.node");
const path = require("path");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sample.xlsx");
// Create a workbook
const wb = new AsposeCells.Workbook();
// Access first worksheet
const ws = wb.getWorksheets().get(0);
// Add text box inside the sheet
ws.getShapes().addTextBox(2, 0, 2, 0, 100, 200);
// Access first shape which is a text box and set its text
const shape = ws.getShapes().get(0);
shape.setText("Sign up for your free phone number.\nCall and text online for free.");
// Access the first paragraph
const p = shape.getTextBody().getTextParagraphs().get(1);
// Set the line space
p.setLineSpaceSizeType(AsposeCells.LineSpaceSizeType.Points);
p.setLineSpace(20);
// Set the space after
p.setSpaceAfterSizeType(AsposeCells.LineSpaceSizeType.Points);
p.setSpaceAfter(10);
// Set the space before
p.setSpaceBeforeSizeType(AsposeCells.LineSpaceSizeType.Points);
p.setSpaceBefore(10);
// Save the workbook in xlsx format
wb.save(path.join(dataDir, "output_out.xlsx"), AsposeCells.SaveFormat.Xlsx);