Class SaveOptions
Contents
[
Hide
]SaveOptions class
Represents all save options
public class SaveOptions
Properties
Name | Description |
---|---|
CachedFileFolder { get; set; } | The folder for temporary files that may be used as data cache. |
CheckExcelRestriction { get; set; } | Whether check restriction of excel file when user modify cells related objects. For example, excel does not allow inputting string value longer than 32K. When you input a value longer than 32K, it will be truncated. |
ClearData { get; set; } | Make the workbook empty after saving the file. |
CreateDirectory { get; set; } | If true and the directory does not exist, the directory will be automatically created before saving the file. |
EncryptDocumentProperties { get; set; } | Indicates whether encrypt document properties when saving as .xls file. The default value is true. |
MergeAreas { get; set; } | Indicates whether merge the areas of conditional formatting and validation before saving the file. |
RefreshChartCache { get; set; } | Indicates whether refreshing chart cache data |
SaveFormat { get; } | Gets the save file format. |
SortExternalNames { get; set; } | Indicates whether sorting external defined names before saving file. |
SortNames { get; set; } | Indicates whether sorting defined names before saving file. |
UpdateSmartArt { get; set; } | Indicates whether updating smart art setting. The default value is false. |
ValidateMergedAreas { get; set; } | Indicates whether validate merged cells before saving the file. |
WarningCallback { get; set; } | Gets or sets warning callback. |
Examples
using System;
using System.IO;
using Aspose.Cells;
namespace AsposeCellsExamples
{
public class CellsClassSaveOptionsDemo
{
public static void Run()
{
// Create a new workbook
Workbook workbook = new Workbook();
// Access first worksheet and add sample data
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells["A1"].PutValue("Hello");
worksheet.Cells["B1"].PutValue("World");
// Create save options - save as CSV
TxtSaveOptions saveOptions = new TxtSaveOptions();
saveOptions.Separator = ',';
// Create load options for CSV
LoadOptions loadOptions = new LoadOptions(LoadFormat.Csv);
// Re-save the workbook using the options
Workbook resavedWorkbook = Cells_Type_SaveOptions(workbook, saveOptions, loadOptions);
// Save the result to file
resavedWorkbook.Save("output.csv", SaveFormat.Csv);
}
public static Workbook Cells_Type_SaveOptions(Workbook wb, SaveOptions optsSave, LoadOptions optsLoad)
{
using (MemoryStream ms = new MemoryStream(1048576))
{
wb.Save(ms, optsSave);
ms.Position = 0;
return new Workbook(ms, optsLoad);
}
}
}
}
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells