com.aspose.cells

Class TxtLoadOptions

public class TxtLoadOptions 
extends AbstractTextLoadOptions

Represents the options for loading text file.

Constructor Summary
TxtLoadOptions()
Creates the options for loading text file.
TxtLoadOptions(intloadFormat)
Creates the options for loading text file.
 
Property Getters/Setters Summary
AutoFitterOptionsgetAutoFitterOptions()
void
           Gets and sets the auto fitter options
booleangetCheckDataValid()
void
setCheckDataValid(booleanvalue)
           Check whether data is valid in the template file.
booleangetCheckExcelRestriction()
void
           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 such as by Cell.PutValue(string), if this property is true, you will get an Exception. If this property is false, we will accept your input string value as the cell's value so that later you can output the complete string value for other file formats such as CSV. However, if you have set such kind of value that is invalid for excel file format, you should not save the workbook as excel file format later. Otherwise there may be unexpected error for the generated excel file.
booleangetConvertDateTimeData()
void
           Gets or sets a value that indicates whether the string in text file is converted to date data.
booleangetConvertNumericData()
void
setConvertNumericData(booleanvalue)
           Gets or sets a value that indicates whether the string in text file is converted to numeric data.
com.aspose.cells.EncodinggetEncoding()
void
setEncoding(com.aspose.cells.Encodingvalue)
           Gets and sets the default encoding.Only applies for csv file.
IndividualFontConfigsgetFontConfigs()
void
           Gets and sets individual font configs. Only works for the Workbook which uses this LoadOptions to load.>
booleanhasFormula()
void
setHasFormula(booleanvalue)
           Indicates whether the text is formula if it starts with "=".
booleangetIgnoreNotPrinted()
void
setIgnoreNotPrinted(booleanvalue)
           Ignore the data which are not printed if directly printing the file
InterruptMonitorgetInterruptMonitor()
void
           Gets and sets the interrupt monitor.
booleanisMultiEncoded()
void
setMultiEncoded(booleanvalue)
           True means that the file contains several encoding.
booleangetKeepPrecision()
void
setKeepPrecision(booleanvalue)
           Indicates whether not parsing a string value if the length is 15.
booleangetKeepUnparsedData()
void
setKeepUnparsedData(booleanvalue)
           Whether keep the unparsed data in memory for the Workbook when it is loaded from template file. Default is true.
intgetLanguageCode()
void
setLanguageCode(intvalue)
           Gets or sets the user interface language of the Workbook version based on CountryCode that has saved the file. The value of the property is CountryCode integer constant.
LightCellsDataHandlergetLightCellsDataHandler()
void
           The data handler for processing cells data when reading template file.
LoadFiltergetLoadFilter()
void
           The filter to denote how to load data.
intgetLoadFormat()
Gets the load format. The value of the property is LoadFormat integer constant.
intgetLoadStyleStrategy()
void
           Indicates the strategy to apply style for parsed values when converting string value to number or datetime. The value of the property is TxtLoadStyleStrategy integer constant.
java.util.LocalegetLocale()
void
setLocale(java.util.Localevalue)
           Gets and sets the Locale used for workbook at the time the file was loaded.
intgetMemorySetting()
void
           Gets or sets the memory usage options. The value of the property is MemorySetting integer constant.
booleangetParsingFormulaOnOpen()
void
           Indicates whether parsing the formula when reading the file.
booleangetParsingPivotCachedRecords()
void
           Inidicates whether parsing pivot cached records when loadiing the file. The default value is false.
java.lang.StringgetPassword()
void
setPassword(java.lang.Stringvalue)
           Gets and set the password of the workbook.
com.aspose.cells.ICustomParser[]getPreferredParsers()
void
setPreferredParsers(com.aspose.cells.ICustomParser[]value)
           Gets and sets preferred value parsers for loading text file.
intgetRegion()
void
setRegion(intvalue)
           Gets or sets the system regional settings based on CountryCode at the time the file was loaded. The value of the property is CountryCode integer constant.
chargetSeparator()
void
setSeparator(charvalue)
           Gets and sets character separator of text file.
java.lang.StringgetSeparatorString()
void
setSeparatorString(java.lang.Stringvalue)
           Gets and sets the a string value as separator.
java.lang.StringgetStandardFont()
void
setStandardFont(java.lang.Stringvalue)
           Sets the default standard font name
doublegetStandardFontSize()
void
setStandardFontSize(doublevalue)
           Sets the default standard font size.
booleangetTreatConsecutiveDelimitersAsOne()
void
           Whether consecutive delimiters should be treated as one.
IWarningCallbackgetWarningCallback()
void
           Gets or sets warning callback.
 
Method Summary
voidsetPaperSize(int type)
Sets the default print paper size from default printer's setting.
 

    • Constructor Detail

      • TxtLoadOptions

        public TxtLoadOptions()
        Creates the options for loading text file. The default load file type is CSV .
      • TxtLoadOptions

        public TxtLoadOptions(int loadFormat)
        Creates the options for loading text file.
        Parameters:
        loadFormat - A LoadFormat value. The loading format
    • Property Getters/Setters Detail

      • getSeparator/setSeparator

        public char getSeparator() / public void setSeparator(char value)
        
        Gets and sets character separator of text file.
      • getSeparatorString/setSeparatorString

        public java.lang.String getSeparatorString() / public void setSeparatorString(java.lang.String value)
        
        Gets and sets the a string value as separator.
      • isMultiEncoded/setMultiEncoded

        public boolean isMultiEncoded() / public void setMultiEncoded(boolean value)
        
        True means that the file contains several encoding.
      • getPreferredParsers/setPreferredParsers

        public com.aspose.cells.ICustomParser[] getPreferredParsers() / public void setPreferredParsers(com.aspose.cells.ICustomParser[] value)
        
        Gets and sets preferred value parsers for loading text file. parsers[0] is the parser will be used for the first column in text template file, parsers[1] is the parser will be used for the second column, ...etc. The last one(parsers[parsers.length-1]) will be used for all other columns start from parsers.length-1. If one item is null, the corresponding column will be parsed by the default parser of Aspose.Cells.
      • hasFormula/setHasFormula

        public boolean hasFormula() / public void setHasFormula(boolean value)
        
        Indicates whether the text is formula if it starts with "=".
      • getTreatConsecutiveDelimitersAsOne/setTreatConsecutiveDelimitersAsOne

        public boolean getTreatConsecutiveDelimitersAsOne() / public void setTreatConsecutiveDelimitersAsOne(boolean value)
        
        Whether consecutive delimiters should be treated as one.
      • getEncoding/setEncoding

        public com.aspose.cells.Encoding getEncoding() / public void setEncoding(com.aspose.cells.Encoding value)
        
        Gets and sets the default encoding.Only applies for csv file.
      • getLoadStyleStrategy/setLoadStyleStrategy

        public int getLoadStyleStrategy() / public void setLoadStyleStrategy(int value)
        
        Indicates the strategy to apply style for parsed values when converting string value to number or datetime. The value of the property is TxtLoadStyleStrategy integer constant.
      • getConvertNumericData/setConvertNumericData

        public boolean getConvertNumericData() / public void setConvertNumericData(boolean value)
        
        Gets or sets a value that indicates whether the string in text file is converted to numeric data.
      • getConvertDateTimeData/setConvertDateTimeData

        public boolean getConvertDateTimeData() / public void setConvertDateTimeData(boolean value)
        
        Gets or sets a value that indicates whether the string in text file is converted to date data.
      • getKeepPrecision/setKeepPrecision

        public boolean getKeepPrecision() / public void setKeepPrecision(boolean value)
        
        Indicates whether not parsing a string value if the length is 15.
      • getLoadFormat

        public int getLoadFormat()
        
        Gets the load format. The value of the property is LoadFormat integer constant.
      • getPassword/setPassword

        public java.lang.String getPassword() / public void setPassword(java.lang.String value)
        
        Gets and set the password of the workbook.
      • getParsingFormulaOnOpen/setParsingFormulaOnOpen

        public boolean getParsingFormulaOnOpen() / public void setParsingFormulaOnOpen(boolean value)
        
        Indicates whether parsing the formula when reading the file. Only applies for Excel Xlsx, Xltx, Xltm and Xlsm file because the formulas in the files are stored with a string formula.
      • getParsingPivotCachedRecords/setParsingPivotCachedRecords

        public boolean getParsingPivotCachedRecords() / public void setParsingPivotCachedRecords(boolean value)
        
        Inidicates whether parsing pivot cached records when loadiing the file. The default value is false. Only applies for Excel Xlsx, Xltx, Xltm , Xlsm and xlsb file
      • getLanguageCode/setLanguageCode

        public int getLanguageCode() / public void setLanguageCode(int value)
        
        Gets or sets the user interface language of the Workbook version based on CountryCode that has saved the file. The value of the property is CountryCode integer constant.
      • getRegion/setRegion

        public int getRegion() / public void setRegion(int value)
        
        Gets or sets the system regional settings based on CountryCode at the time the file was loaded. The value of the property is CountryCode integer constant.If you do not want to use the region saved in the file, please reset it after reading the file.
      • getLocale/setLocale

        public java.util.Locale getLocale() / public void setLocale(java.util.Locale value)
        
        Gets and sets the Locale used for workbook at the time the file was loaded.
      • getStandardFont/setStandardFont

        public java.lang.String getStandardFont() / public void setStandardFont(java.lang.String value)
        
        Sets the default standard font name
      • getStandardFontSize/setStandardFontSize

        public double getStandardFontSize() / public void setStandardFontSize(double value)
        
        Sets the default standard font size.
      • getInterruptMonitor/setInterruptMonitor

        public InterruptMonitor getInterruptMonitor() / public void setInterruptMonitor(InterruptMonitor value)
        
        Gets and sets the interrupt monitor.
      • getIgnoreNotPrinted/setIgnoreNotPrinted

        public boolean getIgnoreNotPrinted() / public void setIgnoreNotPrinted(boolean value)
        
        Ignore the data which are not printed if directly printing the file Only for xlsx file.
      • getCheckDataValid/setCheckDataValid

        public boolean getCheckDataValid() / public void setCheckDataValid(boolean value)
        
        Check whether data is valid in the template file.
      • getCheckExcelRestriction/setCheckExcelRestriction

        public boolean getCheckExcelRestriction() / public void setCheckExcelRestriction(boolean value)
        
        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 such as by Cell.PutValue(string), if this property is true, you will get an Exception. If this property is false, we will accept your input string value as the cell's value so that later you can output the complete string value for other file formats such as CSV. However, if you have set such kind of value that is invalid for excel file format, you should not save the workbook as excel file format later. Otherwise there may be unexpected error for the generated excel file.
      • getKeepUnparsedData/setKeepUnparsedData

        public boolean getKeepUnparsedData() / public void setKeepUnparsedData(boolean value)
        
        Whether keep the unparsed data in memory for the Workbook when it is loaded from template file. Default is true. For scenarios that user only needs to read some contents from template file and does not need to save the workbook back, set this property as false may improve performance, especially when using it together with some kind of LoadFilter,
      • getLoadFilter/setLoadFilter

        public LoadFilter getLoadFilter() / public void setLoadFilter(LoadFilter value)
        
        The filter to denote how to load data.
      • getLightCellsDataHandler/setLightCellsDataHandler

        public LightCellsDataHandler getLightCellsDataHandler() / public void setLightCellsDataHandler(LightCellsDataHandler value)
        
        The data handler for processing cells data when reading template file.
      • getMemorySetting/setMemorySetting

        public int getMemorySetting() / public void setMemorySetting(int value)
        
        Gets or sets the memory usage options. The value of the property is MemorySetting integer constant.
      • getWarningCallback/setWarningCallback

        public IWarningCallback getWarningCallback() / public void setWarningCallback(IWarningCallback value)
        
        Gets or sets warning callback.
      • getAutoFitterOptions/setAutoFitterOptions

        public AutoFitterOptions getAutoFitterOptions() / public void setAutoFitterOptions(AutoFitterOptions value)
        
        Gets and sets the auto fitter options Only for xlsx file now.

    setSeparator

    public voidsetSeparator(charvalue)
    
    Gets and sets character separator of text file.

    setSeparatorString

    public voidsetSeparatorString(java.lang.Stringvalue)
    
    Gets and sets the a string value as separator.

    setMultiEncoded

    public voidsetMultiEncoded(booleanvalue)
    
    True means that the file contains several encoding.

    setPreferredParsers

    public voidsetPreferredParsers(com.aspose.cells.ICustomParser[]value)
    
    Gets and sets preferred value parsers for loading text file. parsers[0] is the parser will be used for the first column in text template file, parsers[1] is the parser will be used for the second column, ...etc. The last one(parsers[parsers.length-1]) will be used for all other columns start from parsers.length-1. If one item is null, the corresponding column will be parsed by the default parser of Aspose.Cells.

    setHasFormula

    public voidsetHasFormula(booleanvalue)
    
    Indicates whether the text is formula if it starts with "=".

    setTreatConsecutiveDelimitersAsOne

    public voidsetTreatConsecutiveDelimitersAsOne(booleanvalue)
    
    Whether consecutive delimiters should be treated as one.

    setEncoding

    public voidsetEncoding(com.aspose.cells.Encodingvalue)
    
    Gets and sets the default encoding.Only applies for csv file.

    setLoadStyleStrategy

    public voidsetLoadStyleStrategy(intvalue)
    
    Indicates the strategy to apply style for parsed values when converting string value to number or datetime. The value of the property is TxtLoadStyleStrategy integer constant.

    setConvertNumericData

    public voidsetConvertNumericData(booleanvalue)
    
    Gets or sets a value that indicates whether the string in text file is converted to numeric data.

    setConvertDateTimeData

    public voidsetConvertDateTimeData(booleanvalue)
    
    Gets or sets a value that indicates whether the string in text file is converted to date data.

    setKeepPrecision

    public voidsetKeepPrecision(booleanvalue)
    
    Indicates whether not parsing a string value if the length is 15.

    setPassword

    public voidsetPassword(java.lang.Stringvalue)
    
    Gets and set the password of the workbook.

    setParsingFormulaOnOpen

    public voidsetParsingFormulaOnOpen(booleanvalue)
    
    Indicates whether parsing the formula when reading the file. Only applies for Excel Xlsx, Xltx, Xltm and Xlsm file because the formulas in the files are stored with a string formula.

    setParsingPivotCachedRecords

    public voidsetParsingPivotCachedRecords(booleanvalue)
    
    Inidicates whether parsing pivot cached records when loadiing the file. The default value is false. Only applies for Excel Xlsx, Xltx, Xltm , Xlsm and xlsb file

    setLanguageCode

    public voidsetLanguageCode(intvalue)
    
    Gets or sets the user interface language of the Workbook version based on CountryCode that has saved the file. The value of the property is CountryCode integer constant.

    setRegion

    public voidsetRegion(intvalue)
    
    Gets or sets the system regional settings based on CountryCode at the time the file was loaded. The value of the property is CountryCode integer constant.If you do not want to use the region saved in the file, please reset it after reading the file.

    setLocale

    public voidsetLocale(java.util.Localevalue)
    
    Gets and sets the Locale used for workbook at the time the file was loaded.

    setStandardFont

    public voidsetStandardFont(java.lang.Stringvalue)
    
    Sets the default standard font name

    setStandardFontSize

    public voidsetStandardFontSize(doublevalue)
    
    Sets the default standard font size.

    setInterruptMonitor

    public voidsetInterruptMonitor(InterruptMonitor value)
    
    Gets and sets the interrupt monitor.

    setIgnoreNotPrinted

    public voidsetIgnoreNotPrinted(booleanvalue)
    
    Ignore the data which are not printed if directly printing the file Only for xlsx file.

    setCheckDataValid

    public voidsetCheckDataValid(booleanvalue)
    
    Check whether data is valid in the template file.

    setCheckExcelRestriction

    public voidsetCheckExcelRestriction(booleanvalue)
    
    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 such as by Cell.PutValue(string), if this property is true, you will get an Exception. If this property is false, we will accept your input string value as the cell's value so that later you can output the complete string value for other file formats such as CSV. However, if you have set such kind of value that is invalid for excel file format, you should not save the workbook as excel file format later. Otherwise there may be unexpected error for the generated excel file.

    setKeepUnparsedData

    public voidsetKeepUnparsedData(booleanvalue)
    
    Whether keep the unparsed data in memory for the Workbook when it is loaded from template file. Default is true. For scenarios that user only needs to read some contents from template file and does not need to save the workbook back, set this property as false may improve performance, especially when using it together with some kind of LoadFilter,

    setLoadFilter

    public voidsetLoadFilter(LoadFilter value)
    
    The filter to denote how to load data.

    setLightCellsDataHandler

    public voidsetLightCellsDataHandler(LightCellsDataHandler value)
    
    The data handler for processing cells data when reading template file.

    setMemorySetting

    public voidsetMemorySetting(intvalue)
    
    Gets or sets the memory usage options. The value of the property is MemorySetting integer constant.

    setWarningCallback

    public voidsetWarningCallback(IWarningCallback value)
    
    Gets or sets warning callback.

    setAutoFitterOptions

    public voidsetAutoFitterOptions(AutoFitterOptions value)
    
    Gets and sets the auto fitter options Only for xlsx file now.

    setFontConfigs

    public voidsetFontConfigs(IndividualFontConfigs value)
    
    Gets and sets individual font configs. Only works for the Workbook which uses this LoadOptions to load.>
    • Method Detail

      • setPaperSize

        public void setPaperSize(int type)
        Sets the default print paper size from default printer's setting. If there is no setting about paper size,MS Excel will use default printer's setting.
        Parameters:
        type - A PaperSizeType value. The default paper size.