SqlScriptSaveOptions

SqlScriptSaveOptions class

Represents the options of saving sql.

class SqlScriptSaveOptions extends SaveOptions;

Constructors

NameDescription
constructor()Creates options for saving sql file.
constructor(SaveOptions)Constructs from a parent object convertible to this.

Properties

PropertyTypeDescription
checkIfTableExistsbooleanCheck if the table name exists before creating
columnTypeMapSqlScriptColumnTypeMapGets and sets the map of column type for different database.
checkAllDataForColumnTypebooleanCheck all data to find columns’ data type.
addBlankLineBetweenRowsbooleanInsert blank line between each data.
separatorstringGets and sets character separator of sql script.
operatorTypeSqlScriptOperatorTypeGets and sets the operator type of sql.
primaryKeynumberRepresents which column is primary key of the data table.
createTablebooleanIndicates whether exporting sql of creating table.
idNamestringGets and sets the name of id column.
startIdnumberGets and sets the start id.
tableNamestringGets and sets the table name.
exportAsStringbooleanIndicates whether exporting all data as string value.
sheetIndexesnumber[]Represents the indexes of exported sheets.
exportAreaCellAreaGets or sets the exporting range.
hasHeaderRowbooleanIndicates whether the range contains header row.
saveFormatSaveFormatReadonly. Gets the save file format.
clearDatabooleanMake the workbook empty after saving the file.
cachedFileFolderstringThe folder for temporary files that may be used as data cache.
validateMergedAreasbooleanIndicates whether validate merged cells before saving the file.
mergeAreasbooleanIndicates whether merge the areas of conditional formatting and validation before saving the file.
createDirectorybooleanIf true and the directory does not exist, the directory will be automatically created before saving the file.
sortNamesbooleanIndicates whether sorting defined names before saving file.
sortExternalNamesbooleanIndicates whether sorting external defined names before saving file.
refreshChartCachebooleanIndicates whether refreshing chart cache data
warningCallbackIWarningCallbackGets or sets warning callback.
checkExcelRestrictionbooleanWhether 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.
updateSmartArtbooleanIndicates whether updating smart art setting. The default value is false.
encryptDocumentPropertiesbooleanIndicates whether encrypt document properties when saving as .xls file. The default value is true.

constructor()

Creates options for saving sql file.

constructor();

constructor(SaveOptions)

Constructs from a parent object convertible to this.

constructor(obj: SaveOptions);

Parameters:

ParameterTypeDescription
objSaveOptionsThe parent object.

checkIfTableExists

Check if the table name exists before creating

checkIfTableExists : boolean;

columnTypeMap

Gets and sets the map of column type for different database.

columnTypeMap : SqlScriptColumnTypeMap;

checkAllDataForColumnType

Check all data to find columns’ data type.

checkAllDataForColumnType : boolean;

Remarks

The default value is false, we only check the first row for performance. If this property is true and the columns contains mixed value type, the columns’ type will be text.

addBlankLineBetweenRows

Insert blank line between each data.

addBlankLineBetweenRows : boolean;

Remarks

If Separator is ‘\n’ , it’s better to set this property as true to increase readability.

separator

Gets and sets character separator of sql script.

separator : string;

Remarks

Only can be ’ ’ or ‘\n’. If the

operatorType

Gets and sets the operator type of sql.

operatorType : SqlScriptOperatorType;

primaryKey

Represents which column is primary key of the data table.

primaryKey : number;

createTable

Indicates whether exporting sql of creating table.

createTable : boolean;

idName

Gets and sets the name of id column.

idName : string;

Remarks

If this property is set , a column will be inserted with automatical increment int value.

startId

Gets and sets the start id.

startId : number;

Remarks

Only works when IdName is set.

tableName

Gets and sets the table name.

tableName : string;

exportAsString

Indicates whether exporting all data as string value.

exportAsString : boolean;

sheetIndexes

Represents the indexes of exported sheets.

sheetIndexes : number[];

exportArea

Gets or sets the exporting range.

exportArea : CellArea;

hasHeaderRow

Indicates whether the range contains header row.

hasHeaderRow : boolean;

saveFormat

Readonly. Gets the save file format.

saveFormat : SaveFormat;

clearData

Make the workbook empty after saving the file.

clearData : boolean;

cachedFileFolder

The folder for temporary files that may be used as data cache.

cachedFileFolder : string;

Remarks

If the folder has not been specified, the default value for it is CellsHelper.GetCacheFolder(). If its default value is null or empty, or has been specified as null or empty, then no cache file will be used when saving the workbook.

validateMergedAreas

Indicates whether validate merged cells before saving the file.

validateMergedAreas : boolean;

Remarks

The default value is false.

mergeAreas

Indicates whether merge the areas of conditional formatting and validation before saving the file.

mergeAreas : boolean;

Remarks

The default value is false.

createDirectory

If true and the directory does not exist, the directory will be automatically created before saving the file.

createDirectory : boolean;

Remarks

The default value is false.

sortNames

Indicates whether sorting defined names before saving file.

sortNames : boolean;

sortExternalNames

Indicates whether sorting external defined names before saving file.

sortExternalNames : boolean;

refreshChartCache

Indicates whether refreshing chart cache data

refreshChartCache : boolean;

warningCallback

Gets or sets warning callback.

warningCallback : IWarningCallback;

checkExcelRestriction

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.

checkExcelRestriction : boolean;

updateSmartArt

Indicates whether updating smart art setting. The default value is false.

updateSmartArt : boolean;

Remarks

Only effects after calling Shape.GetResultOfSmartArt() method and the cached shapes exist in the template file.

encryptDocumentProperties

Indicates whether encrypt document properties when saving as .xls file. The default value is true.

encryptDocumentProperties : boolean;

Remarks

Only for .xls,xlsx,xlsb and xlsm file.