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

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

Aspose.Cells fornisce la possibilità di mantenere i separatori di linea durante la conversione di fogli di calcolo in formato CSV. Per fare ciò, è possibile utilizzare la proprietà KeepSeparatorsForBlankRow della classe TxtSaveOptions. KeepSeparatorsForBlankRow è una proprietà booleana. Per mantenere i separatori per le righe vuote durante la conversione del file Excel in CSV, impostare la proprietà KeepSeparatorsForBlankRow su true.

Il seguente codice di esempio carica il file Excel di origine. Imposta la proprietà TxtSaveOptions.KeepSeparatorsForBlankRow a true e lo salva come KeepSeparatorsForBlankRow.out.csv. La schermata mostra il confronto tra il file Excel di origine, l’output predefinito generato durante la conversione del foglio elettronico in CSV e l’output generato impostando KeepSeparatorsForBlankRow a true.

todo:image_alt_text

Codice di Esempio

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(ConvertTableToRangeWithOptions.class) + "LoadingSavingConvertingAndManaging/";
// Open an existing file that contains a table/list object in it
Workbook workbook = new Workbook(dataDir + "KeepSeparatorsForBlankRow.xlsx");
// Instantiate Text File's Save Options
TxtSaveOptions options = new TxtSaveOptions();
// Set KeepSeparatorsForBlankRow to true show separators in blank rows
options.setKeepSeparatorsForBlankRow(true);
// Save the file with the options
workbook.save(dataDir + "KeepSeparatorsForBlankRow.out.csv", options);