Class SqlScriptSaveOptions

SqlScriptSaveOptions class

Represents the options of saving sql.

public class SqlScriptSaveOptions : SaveOptions

Constructors

NameDescription
SqlScriptSaveOptions()Creates options for saving sql file.

Properties

NameDescription
AddBlankLineBetweenRows { get; set; }Insert blank line between each data.
CachedFileFolder { get; set; }The cached file folder is used to store some large data.(Inherited from SaveOptions.)
CheckAllDataForColumnType { get; set; }Check all data to find columns’ data type.
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.(Inherited from SaveOptions.)
CheckIfTableExists { get; set; }Check if the table name exists before creating
ClearData { get; set; }Make the workbook empty after saving the file.(Inherited from SaveOptions.)
ColumnTypeMap { get; set; }Gets and sets the map of column type for different database.
CreateDirectory { get; set; }If true and the directory does not exist, the directory will be automatically created before saving the file.(Inherited from SaveOptions.)
CreateTable { get; set; }Indicates whether exporting sql of creating table.
EncryptDocumentProperties { get; set; }Indicates whether encrypt document properties when saving as .xls file. The default value is true.(Inherited from SaveOptions.)
ExportArea { get; set; }Gets or sets the exporting range.
ExportAsString { get; set; }Indicates whether exporting all data as string value.
HasHeaderRow { get; set; }Indicates whether the range contains header row.
IdName { get; set; }Gets and sets the name of id column.
MergeAreas { get; set; }Indicates whether merge the areas of conditional formatting and validation before saving the file.(Inherited from SaveOptions.)
OperatorType { get; set; }Gets and sets the operator type of sql.
PrimaryKey { get; set; }Represents which column is primary key of the data table.
RefreshChartCache { get; set; }Indicates whether refreshing chart cache data(Inherited from SaveOptions.)
SaveFormat { get; }Gets the save file format.(Inherited from SaveOptions.)
Separator { get; set; }Gets and sets character separator of sql script.
SheetIndexes { get; set; }Represents the indexes of exported sheets.
SortExternalNames { get; set; }Indicates whether sorting external defined names before saving file.(Inherited from SaveOptions.)
SortNames { get; set; }Indicates whether sorting defined names before saving file.(Inherited from SaveOptions.)
StartId { get; set; }Gets and sets the start id.
TableName { get; set; }Gets and sets the table name.
UpdateSmartArt { get; set; }Indicates whether updating smart art setting. The default value is false.(Inherited from SaveOptions.)
ValidateMergedAreas { get; set; }Indicates whether validate merged cells before saving the file.(Inherited from SaveOptions.)
WarningCallback { get; set; }Gets or sets warning callback.(Inherited from SaveOptions.)

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using Aspose.Cells.Saving;
    using System;

    public class SqlScriptSaveOptionsDemo
    {
        public static void SqlScriptSaveOptionsExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Fill worksheet with some data
            worksheet.Cells[0, 0].PutValue("ID");
            worksheet.Cells[0, 1].PutValue("Name");
            worksheet.Cells[1, 0].PutValue(1);
            worksheet.Cells[1, 1].PutValue("John Doe");
            worksheet.Cells[2, 0].PutValue(2);
            worksheet.Cells[2, 1].PutValue("Jane Doe");

            // Create an instance of SqlScriptSaveOptions
            SqlScriptSaveOptions saveOptions = new SqlScriptSaveOptions
            {
                CheckIfTableExists = true,
                ColumnTypeMap = new SqlScriptColumnTypeMap(),
                CheckAllDataForColumnType = true,
                AddBlankLineBetweenRows = false,
                Separator = ';',
                OperatorType = SqlScriptOperatorType.Insert,
                PrimaryKey = 0,
                CreateTable = true,
                IdName = "ID",
                StartId = 1,
                TableName = "MyTable",
                ExportAsString = false,
                ExportArea = new CellArea { StartRow = 0, EndRow = 2, StartColumn = 0, EndColumn = 1 },
                HasHeaderRow = true,
                ClearData = false,
                CachedFileFolder = "C:\\Temp",
                ValidateMergedAreas = true,
                MergeAreas = false,
                SortNames = false,
                SortExternalNames = false,
                RefreshChartCache = false,
                WarningCallback = null,
                UpdateSmartArt = false
            };

            // Save the workbook as SQL script
            workbook.Save("MyTable.sql", saveOptions);

            return;
        }
    }
}

See Also