Mantieni i separatori per le righe vuote durante l esportazione di fogli di calcolo in formato CSV con Node.js tramite C++

Mantieni i separatori per le righe vuote durante l’esportazione di fogli di calcolo in formato CSV

Aspose.Cells offre la possibilità di mantenere i separatori di linea durante la conversione dei fogli di calcolo in formato CSV. Per questo, puoi usare la proprietà TxtSaveOptions.getKeepSeparatorsForBlankRow() di TxtSaveOptions. TxtSaveOptions.getKeepSeparatorsForBlankRow() è una proprietà booleana. Per mantenere i separatori per le righe vuote durante la conversione del file Excel in CSV, imposta la proprietà TxtSaveOptions.getKeepSeparatorsForBlankRow() su true.

Il seguente esempio di codice carica il file Excel di origine. Imposta la proprietà TxtSaveOptions.getKeepSeparatorsForBlankRow() su true e lo salva come output.csv. Lo screenshot mostra il confronto tra il file Excel sorgente, l’output predefinito generato durante la conversione in CSV e l’output generato impostando TxtSaveOptions.getKeepSeparatorsForBlankRow() su true.

todo:image_alt_text

Codice di Esempio

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, "Book1.xlsx");

// Create a Workbook object and opening the file from its path
const wb = new AsposeCells.Workbook(filePath);

// Instantiate Text File's Save Options
const options = new AsposeCells.TxtSaveOptions();

// Set KeepSeparatorsForBlankRow to true to show separators in blank rows
options.setKeepSeparatorsForBlankRow(true);

// Save the file with the options
wb.save(path.join(dataDir, "output.csv"), options);