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 comeuscita.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**.

cose da fare:immagine_alt_testo

Codice d’esempio

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
string filePath = dataDir + "Book1.xlsx";
// Create a Workbook object and opening the file from its path
Workbook wb = new Workbook(filePath);
// Instantiate Text File's Save Options
TxtSaveOptions options = new TxtSaveOptions();
// Set KeepSeparatorsForBlankRow to true show separators in blank rows
options.KeepSeparatorsForBlankRow = true;
// Save the file with the options
wb.Save(dataDir + "output.csv", options);