Mantieni i separatori per le righe vuote durante l'esportazione dei fogli di calcolo nel formato CSV
Mantieni i separatori per le righe vuote durante l’esportazione dei fogli di calcolo nel formato CSV
Aspose.Cells offre la possibilità di mantenere i separatori di riga durante la conversione dei fogli di calcolo nel formato CSV. Per questo, puoi usare il**KeepSeparatorsForBlankRow**proprietà di**TxtSaveOptions**classe.**KeepSeparatorsForBlankRow**è una proprietà booleana. Per mantenere i separatori per le righe vuote durante la conversione del file Excel in CSV, impostare il**KeepSeparatorsForBlankRow**proprietà a**VERO**.
Il codice di esempio seguente carica il filefile Excel di origine. Tramonta**TxtSaveOptions.KeepSeparatorsForBlankRow**proprietà a**VERO** e lo salva comeKeepSeparatorsForBlankRow.out.csv. Lo screenshot mostra il confronto tra il file Excel sorgente, l’output predefinito generato durante la conversione del foglio di calcolo in CSV e l’output generato impostando**KeepSeparatorsForBlankRow**a**VERO**.
Codice d’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); |