LowCodeSaveOptionsProviderOfPlaceHolders

LowCodeSaveOptionsProviderOfPlaceHolders class

Implementation to provide save options which save split parts to files and the path of resultant file are defined with placeholders.

class LowCodeSaveOptionsProviderOfPlaceHolders extends AbstractLowCodeSaveOptionsProvider;

Constructors

NameDescription
constructor(AbstractLowCodeSaveOptionsProvider)Constructs from a parent object convertible to this.
constructor(string)Instantiates an instance to provide save options according to specified templates.

Properties

PropertyTypeDescription
sheetIndexOffsetnumberOffset of sheet’s index between what used in file path and its actual value(SplitPartInfo.SheetIndex).
splitPartIndexOffsetnumberOffset of split part’s index between what used in file path and its actual value(SplitPartInfo.PartIndex).
buildPathWithSheetAlwaysbooleanWhether add sheet index or name to file path always. Default value is false, that is, when there is only one sheet, the sheet index and name and corresponding prefix(SheetNamePrefix) will not be added to the file path.
buildPathWithSplitPartAlwaysbooleanWhether add split part index to file path always. Default value is false, that is, when there is only one split part, the split part index and corresponding prefix(SplitPartPrefix) will not be added to the file path.
sheetNamePrefixstringPrefix for the index of worksheet.
sheetIndexPrefixstringPrefix for the index of worksheet.
splitPartPrefixstringPrefix for the index of split part.
saveOptionsTemplateLowCodeSaveOptionsThe template for creating instance of save options in GetSaveOptions(SplitPartInfo).

Methods

MethodDescription
getSaveOptions(SplitPartInfo)Gets the save options from which to get the output settings for currently split part.
finish(LowCodeSaveOptions)Releases resources after processing currently split part.

constructor(AbstractLowCodeSaveOptionsProvider)

Constructs from a parent object convertible to this.

constructor(obj: AbstractLowCodeSaveOptionsProvider);

Parameters:

ParameterTypeDescription
objAbstractLowCodeSaveOptionsProviderThe parent object.

constructor(string)

Instantiates an instance to provide save options according to specified templates.

constructor(pathTemplate: string);

Parameters:

ParameterTypeDescription
pathTemplatestringThe template of the resultant file path.

Remarks

The supported placeholders in file path template:

  • ${SheetIndex}: will be replaced by the sheet index of the split part
  • ${SheetName}: will be replaced by the sheet name of the split part
  • ${SplitPartIndex}: will be replaced by the index of the split part
  • ${SheetIndexPrefix}: will be replaced by SheetIndexPrefix
  • ${SheetNamePrefix}: will be replaced by SheetNamePrefix
  • ${SplitPartPrefix}: will be replaced by SplitPartPrefix
  • </ul

    sheetIndexOffset

    Offset of sheet’s index between what used in file path and its actual value(SplitPartInfo.SheetIndex).

    sheetIndexOffset : number;
    

    splitPartIndexOffset

    Offset of split part’s index between what used in file path and its actual value(SplitPartInfo.PartIndex).

    splitPartIndexOffset : number;
    

    buildPathWithSheetAlways

    Whether add sheet index or name to file path always. Default value is false, that is, when there is only one sheet, the sheet index and name and corresponding prefix(SheetNamePrefix) will not be added to the file path.

    buildPathWithSheetAlways : boolean;
    

    buildPathWithSplitPartAlways

    Whether add split part index to file path always. Default value is false, that is, when there is only one split part, the split part index and corresponding prefix(SplitPartPrefix) will not be added to the file path.

    buildPathWithSplitPartAlways : boolean;
    

    sheetNamePrefix

    Prefix for the index of worksheet.

    sheetNamePrefix : string;
    

    Remarks

    If there is only one worksheet and BuildPathWithSheetAlways is false, then this prefix and the sheet index(or name) will not be added to the resultant file path.

    sheetIndexPrefix

    Prefix for the index of worksheet.

    sheetIndexPrefix : string;
    

    Remarks

    If there is only one worksheet and BuildPathWithSheetAlways is false, then this prefix and the sheet index(or name) will not be added to the resultant file path.

    splitPartPrefix

    Prefix for the index of split part.

    splitPartPrefix : string;
    

    Remarks

    If there is only one split part and BuildPathWithSplitPartAlways is false, then this prefix and the split part index(0) will not be added to the resultant file path.

    saveOptionsTemplate

    The template for creating instance of save options in GetSaveOptions(SplitPartInfo).

    saveOptionsTemplate : LowCodeSaveOptions;
    

    Remarks

    If the template has been specified, then the created instance will copy all setting from it and update the output file accordingly.

    getSaveOptions(SplitPartInfo)

    Gets the save options from which to get the output settings for currently split part.

    getSaveOptions(part: SplitPartInfo) : LowCodeSaveOptions;
    

    Parameters:

    ParameterTypeDescription
    partSplitPartInfo

    Returns

    LowCodeSaveOptions

    finish(LowCodeSaveOptions)

    Releases resources after processing currently split part.

    finish(part: LowCodeSaveOptions) : void;
    

    Parameters:

    ParameterTypeDescription
    partLowCodeSaveOptionsthe save options used for currently split part.

    Remarks

    By default this method just closes the stream specified by the LowCodeSaveOptions.OutputStream directly(if the save options specified a Stream as destination). User may overwrite this method to control how to release resources according to their requirement and the implementation of GetSaveOptions(SplitPartInfo).