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
Name | Description |
---|---|
constructor(AbstractLowCodeSaveOptionsProvider) | Constructs from a parent object convertible to this. |
constructor(string) | Instantiates an instance to provide save options according to specified templates. |
Properties
Property | Type | Description |
---|---|---|
sheetIndexOffset | number | Offset of sheet’s index between what used in file path and its actual value(SplitPartInfo.SheetIndex). |
splitPartIndexOffset | number | Offset of split part’s index between what used in file path and its actual value(SplitPartInfo.PartIndex). |
buildPathWithSheetAlways | boolean | 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. |
buildPathWithSplitPartAlways | boolean | 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. |
sheetNamePrefix | string | Prefix for the index of worksheet. |
sheetIndexPrefix | string | Prefix for the index of worksheet. |
splitPartPrefix | string | Prefix for the index of split part. |
saveOptionsTemplate | LowCodeSaveOptions | The template for creating instance of save options in GetSaveOptions(SplitPartInfo). |
Methods
Method | Description |
---|---|
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:
Parameter | Type | Description |
---|---|---|
obj | AbstractLowCodeSaveOptionsProvider | The parent object. |
constructor(string)
Instantiates an instance to provide save options according to specified templates.
constructor(pathTemplate: string);
Parameters:
Parameter | Type | Description |
---|---|---|
pathTemplate | string | The 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:
Parameter | Type | Description |
---|---|---|
part | SplitPartInfo |
Returns
finish(LowCodeSaveOptions)
Releases resources after processing currently split part.
finish(part: LowCodeSaveOptions) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
part | LowCodeSaveOptions | the 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).