com.aspose.cells

Class CellsHelper

  • java.lang.Object
    • com.aspose.cells.CellsHelper
public class CellsHelper 
extends java.lang.Object

Provides helper functions.

Property Getters/Setters Summary
static java.lang.StringgetAltStartPath()
staticvoid
setAltStartPath(java.lang.Stringvalue)
           Gets or sets the alternate startup path, which is referred to by some external formula references.
static CustomImplementationFactorygetCustomImplementationFactory()
staticvoid
           Gets or sets the factory for creating instances with special implementation.
static doublegetDPI()
staticvoid
setDPI(doublevalue)
           Gets the DPI of the machine.
static java.lang.StringgetFontDir()
staticvoid
setFontDir(java.lang.Stringvalue)
           When generating PDF/XPS, specific font file directory can be set in the property. If it is not set , using %WINDOWS%\fonts by default.
static java.util.ArrayListgetFontDirs()
staticvoid
setFontDirs(java.util.ArrayListvalue)
           When generating PDF/XPS, specific font file directories can be set in the property. If it is not set , using %WINDOWS%\fonts by default.
static java.util.ArrayListgetFontFiles()
staticvoid
setFontFiles(java.util.ArrayListvalue)
           When generating PDF/XPS, specific font files can be set in the property. Such as "d:\myfonts\myArial.ttf"
static java.lang.StringgetLibraryPath()
staticvoid
setLibraryPath(java.lang.Stringvalue)
           Gets or sets the library path which is referred to by some external formula references.
static intgetSignificantDigits()
staticvoid
           Gets and sets the number of significant digits. The default value is 17.
static java.lang.StringgetStartupPath()
staticvoid
setStartupPath(java.lang.Stringvalue)
           Gets or sets the startup path, which is referred to by some external formula references.
 
Method Summary
static voidaddAddInFunction(java.lang.String function, int minCountOfParameters, int maxCountOfParameters, int[] paramersType, int functionValueType)
Add addin function.
static java.lang.StringcellIndexToName(int row, int column)
Gets cell name according to its row and column indexes.
static int[]cellNameToIndex(java.lang.String cellName)
static java.lang.StringcolumnIndexToName(int column)
Gets column name according to column index.
static intcolumnNameToIndex(java.lang.String columnName)
Gets column index according to column name.
static java.lang.StringconvertA1FormulaToR1C1(java.lang.String formula, int row, int column)
Converts A1 formula of the cell to the r1c1 formula.
static java.lang.StringconvertR1C1FormulaToA1(java.lang.String r1c1Formula, int row, int column)
Converts the r1c1 formula of the cell to A1 formula.
static java.lang.StringcreateSafeSheetName(java.lang.String nameProposal)
Checks given sheet name and create a valid one when needed. If given sheet name conforms to the rules of excel sheet name, then return it. Otherwise string will be truncated if length exceeds the limit and invalid characters will be replaced with ' ', then return the rebuilt string value.
static java.lang.StringcreateSafeSheetName(java.lang.String nameProposal, char replaceChar)
Checks given sheet name and create a valid one when needed. If given sheet name conforms to the rules of excel sheet name, then return it. Otherwise string will be truncated if length exceeds the limit and invalid characters will be replaced with given character, then return the rebuilt string value.
static intdetectFileFormat(java.io.InputStream stream)
Detects the format type of the file stored in the stream.
static intdetectFileFormat(java.lang.String fileName)
Detects the file format type.
static intdetectLoadFormat(java.io.InputStream stream)
Detects the file load format.
static intdetectLoadFormat(java.lang.String fileName)
Detects the file load format.
static com.aspose.cells.DateTimegetDateTimeFromDouble(double doubleValue, boolean date1904)
Convert the double value to the date time value.
static doublegetDoubleFromDateTime(com.aspose.cells.DateTime dateTime, boolean date1904)
Convert the date time to double value.
static doublegetTextWidth(java.lang.String text, Font font, double scaling)
Get width of text in unit of points.
static com.aspose.cells.Color[]getUsedColors(Workbook workbook)
Gets all used colors in the workbook.
static java.lang.StringgetVersion()
Get the release version.
static booleanisProtectedByRMS(java.io.InputStream stream)
Gets whether the file is protected by Microsoft Rights Management Server.
static booleanisProtectedByRMS(java.lang.String fileName)
Gets whether the file is protected by Microsoft Rights Management Server.
static voidmergeFiles(java.lang.String[] files, java.lang.String cachedFile, java.lang.String destFile)
Merges some large xls files to a xls file.
static java.lang.StringrowIndexToName(int row)
Gets row name according to row index.
static introwNameToIndex(java.lang.String rowName)
Gets row index according to row name.
 

    • Property Getters/Setters Detail

      • getSignificantDigits/setSignificantDigits

        public static int getSignificantDigits() / public static void setSignificantDigits(int value)
        
        Gets and sets the number of significant digits. The default value is 17. Only could be 15 or 17 now.
      • getDPI/setDPI

        public static double getDPI() / public static void setDPI(double value)
        
        Gets the DPI of the machine.
      • getFontDir/setFontDir

        public static java.lang.String getFontDir() / public static void setFontDir(java.lang.String value)
        
        When generating PDF/XPS, specific font file directory can be set in the property. If it is not set , using %WINDOWS%\fonts by default. This member is now obsolete. Instead, please use FontConfigs.setFontFolder(java.lang.String, boolean) method with folder recursive to false. This property will be removed 12 months later since July 2016. Aspose apologizes for any inconvenience you may have experienced.
      • getFontDirs/setFontDirs

        public static java.util.ArrayList getFontDirs() / public static void setFontDirs(java.util.ArrayList value)
        
        When generating PDF/XPS, specific font file directories can be set in the property. If it is not set , using %WINDOWS%\fonts by default. This member is now obsolete. Instead, please use FontConfigs.setFontFolders(java.lang.String[], boolean) method with folder recursive to false. This property will be removed 12 months later since July 2016. Aspose apologizes for any inconvenience you may have experienced.
      • getFontFiles/setFontFiles

        public static java.util.ArrayList getFontFiles() / public static void setFontFiles(java.util.ArrayList value)
        
        When generating PDF/XPS, specific font files can be set in the property. Such as "d:\myfonts\myArial.ttf" This member is now obsolete. Instead, please use FontConfigs.setFontSources(com.aspose.cells.FontSourceBase[]) method. This property will be removed 12 months later since July 2016. Aspose apologizes for any inconvenience you may have experienced.
      • getStartupPath/setStartupPath

        public static java.lang.String getStartupPath() / public static void setStartupPath(java.lang.String value)
        
        Gets or sets the startup path, which is referred to by some external formula references.
      • getAltStartPath/setAltStartPath

        public static java.lang.String getAltStartPath() / public static void setAltStartPath(java.lang.String value)
        
        Gets or sets the alternate startup path, which is referred to by some external formula references.
      • getLibraryPath/setLibraryPath

        public static java.lang.String getLibraryPath() / public static void setLibraryPath(java.lang.String value)
        
        Gets or sets the library path which is referred to by some external formula references.
      • getCustomImplementationFactory/setCustomImplementationFactory

        public static CustomImplementationFactory getCustomImplementationFactory() / public static void setCustomImplementationFactory(CustomImplementationFactory value)
        
        Gets or sets the factory for creating instances with special implementation.

    setSignificantDigits

    public staticvoidsetSignificantDigits(intvalue)
    
    Gets and sets the number of significant digits. The default value is 17. Only could be 15 or 17 now.

    setDPI

    public staticvoidsetDPI(doublevalue)
    
    Gets the DPI of the machine.

    setFontDir

    public staticvoidsetFontDir(java.lang.Stringvalue)
    
    When generating PDF/XPS, specific font file directory can be set in the property. If it is not set , using %WINDOWS%\fonts by default. This member is now obsolete. Instead, please use FontConfigs.setFontFolder(java.lang.String, boolean) method with folder recursive to false. This property will be removed 12 months later since July 2016. Aspose apologizes for any inconvenience you may have experienced.

    setFontDirs

    public staticvoidsetFontDirs(java.util.ArrayListvalue)
    
    When generating PDF/XPS, specific font file directories can be set in the property. If it is not set , using %WINDOWS%\fonts by default. This member is now obsolete. Instead, please use FontConfigs.setFontFolders(java.lang.String[], boolean) method with folder recursive to false. This property will be removed 12 months later since July 2016. Aspose apologizes for any inconvenience you may have experienced.

    setFontFiles

    public staticvoidsetFontFiles(java.util.ArrayListvalue)
    
    When generating PDF/XPS, specific font files can be set in the property. Such as "d:\myfonts\myArial.ttf" This member is now obsolete. Instead, please use FontConfigs.setFontSources(com.aspose.cells.FontSourceBase[]) method. This property will be removed 12 months later since July 2016. Aspose apologizes for any inconvenience you may have experienced.

    setStartupPath

    public staticvoidsetStartupPath(java.lang.Stringvalue)
    
    Gets or sets the startup path, which is referred to by some external formula references.

    setAltStartPath

    public staticvoidsetAltStartPath(java.lang.Stringvalue)
    
    Gets or sets the alternate startup path, which is referred to by some external formula references.

    setLibraryPath

    public staticvoidsetLibraryPath(java.lang.Stringvalue)
    
    Gets or sets the library path which is referred to by some external formula references.

    setCustomImplementationFactory

    public staticvoidsetCustomImplementationFactory(CustomImplementationFactory value)
    
    Gets or sets the factory for creating instances with special implementation.
    • Method Detail

      • getTextWidth

        public static double getTextWidth(java.lang.String text, Font font, double scaling)
                                       throws java.lang.Exception
        Get width of text in unit of points.
        Parameters:
        text - The text.
        font - The font of the text.
        scaling - The scaling of text.
        Returns:
      • getVersion

        public static java.lang.String getVersion()
        Get the release version.
        Returns:
        The release version.
      • isProtectedByRMS

        public static boolean isProtectedByRMS(java.lang.String fileName)
                                            throws java.lang.Exception
        Gets whether the file is protected by Microsoft Rights Management Server. This member is now obsolete. Instead, please use FileFormatUtil.detectFileFormat(java.lang.String) property. This property will be removed 12 months later since December 2013. Aspose apologizes for any inconvenience you may have experienced.
        Parameters:
        fileName - The file name.
        Returns:
      • isProtectedByRMS

        public static boolean isProtectedByRMS(java.io.InputStream stream)
                                            throws java.lang.Exception
        Gets whether the file is protected by Microsoft Rights Management Server. This member is now obsolete. Instead, please use #Error Cref: M:Aspose.Cells.FileFormatUtil.DetectFileFormat(System.IO.Stream) property. This property will be removed 12 months later since December 2013. Aspose apologizes for any inconvenience you may have experienced.
        Parameters:
        stream - The file stream.
        Returns:
      • cellNameToIndex

        public static int[] cellNameToIndex(java.lang.String cellName)
      • cellIndexToName

        public static java.lang.String cellIndexToName(int row, int column)
        Gets cell name according to its row and column indexes.
        Parameters:
        row - Row index.
        column - Column index.
        Returns:
        Name of cell.
      • columnIndexToName

        public static java.lang.String columnIndexToName(int column)
        Gets column name according to column index.
        Parameters:
        column - Column index.
        Returns:
        Name of column.
      • columnNameToIndex

        public static int columnNameToIndex(java.lang.String columnName)
        Gets column index according to column name.
        Parameters:
        columnName - Column name.
        Returns:
        Column index.
      • rowIndexToName

        public static java.lang.String rowIndexToName(int row)
        Gets row name according to row index.
        Parameters:
        row - Row index.
        Returns:
        Name of row.
      • rowNameToIndex

        public static int rowNameToIndex(java.lang.String rowName)
        Gets row index according to row name.
        Parameters:
        rowName - Row name.
        Returns:
        Row index.
      • convertR1C1FormulaToA1

        public static java.lang.String convertR1C1FormulaToA1(java.lang.String r1c1Formula, int row, int column)
        Converts the r1c1 formula of the cell to A1 formula.
        Parameters:
        r1c1Formula - The r1c1 formula.
        row - The row index of the cell.
        column - The column index of the cell.
        Returns:
        The A1 formula.
      • convertA1FormulaToR1C1

        public static java.lang.String convertA1FormulaToR1C1(java.lang.String formula, int row, int column)
        Converts A1 formula of the cell to the r1c1 formula.
        Parameters:
        formula - The A1 formula.
        row - The row index of the cell.
        column - The column index of the cell.
        Returns:
        The R1C1 formula.
      • getDateTimeFromDouble

        public static com.aspose.cells.DateTime getDateTimeFromDouble(double doubleValue, boolean date1904)
        Convert the double value to the date time value.
        Parameters:
        doubleValue - The double value.
        date1904 - Date 1904 system.
        Returns:
      • getDoubleFromDateTime

        public static double getDoubleFromDateTime(com.aspose.cells.DateTime dateTime, boolean date1904)
        Convert the date time to double value.
        Parameters:
        dateTime - The date time.
        date1904 - Date 1904 system.
        Returns:
      • detectLoadFormat

        public static int detectLoadFormat(java.lang.String fileName)
                                        throws java.lang.Exception
        Detects the file load format. This member is now obsolete. Instead, please use FileFormatUtil.detectFileFormat(java.lang.String) property. This property will be removed 12 months later since December 2013. Aspose apologizes for any inconvenience you may have experienced.
        Parameters:
        fileName - The file name.
        Returns:
        A LoadFormat value. The load format.
      • detectLoadFormat

        public static int detectLoadFormat(java.io.InputStream stream)
                                        throws java.lang.Exception
        Detects the file load format. This member is now obsolete. Instead, please use FileFormatUtil.detectFileFormat(java.lang.String) property. This property will be removed 12 months later since December 2013. Aspose apologizes for any inconvenience you may have experienced.
        Parameters:
        stream - The stream.
        Returns:
        A LoadFormat value.
      • detectFileFormat

        public static int detectFileFormat(java.lang.String fileName)
                                        throws java.lang.Exception
        Detects the file format type. This member is now obsolete. Instead, please use FileFormatUtil.detectFileFormat(java.lang.String) property. This property will be removed 12 months later since December 2013. Aspose apologizes for any inconvenience you may have experienced.
        Parameters:
        fileName - the file name
        Returns:
        A FileFormatType value. The file format type.
      • detectFileFormat

        public static int detectFileFormat(java.io.InputStream stream)
                                        throws java.lang.Exception
        Detects the format type of the file stored in the stream. This member is now obsolete. Instead, please use #Error Cref: M:Aspose.Cells.FileFormatUtil.DetectFileFormat(System.IO.Stream) property. This property will be removed 12 months later since December 2013. Aspose apologizes for any inconvenience you may have experienced.
        Parameters:
        stream - The stream
        Returns:
        A FileFormatType value. The file format type.
      • getUsedColors

        public static com.aspose.cells.Color[] getUsedColors(Workbook workbook)
        Gets all used colors in the workbook.
        Parameters:
        workbook - The workbook object.
        Returns:
        The used colors.
      • addAddInFunction

        public static void addAddInFunction(java.lang.String function, int minCountOfParameters, int maxCountOfParameters, int[] paramersType, int functionValueType)
        Add addin function.
        Parameters:
        function - The function name.
        minCountOfParameters - Minimum number of parameters this function requires
        maxCountOfParameters - Maximum number of parameters this function allows.
        paramersType - The excepted parameters type of the function
        functionValueType - A ParameterType value. The function value type.
      • mergeFiles

        public static void mergeFiles(java.lang.String[] files, java.lang.String cachedFile, java.lang.String destFile)
                                   throws java.lang.Exception
        Merges some large xls files to a xls file. This method only supports merging data, style and formulas to the new file. The cached file is used to store some temporary data.
        Parameters:
        files - The files.
        cachedFile - The cached file.
        destFile - The dest file.
      • createSafeSheetName

        public static java.lang.String createSafeSheetName(java.lang.String nameProposal)
        Checks given sheet name and create a valid one when needed. If given sheet name conforms to the rules of excel sheet name, then return it. Otherwise string will be truncated if length exceeds the limit and invalid characters will be replaced with ' ', then return the rebuilt string value.
        Parameters:
        nameProposal - sheet name to be used
        Returns:
      • createSafeSheetName

        public static java.lang.String createSafeSheetName(java.lang.String nameProposal, char replaceChar)
        Checks given sheet name and create a valid one when needed. If given sheet name conforms to the rules of excel sheet name, then return it. Otherwise string will be truncated if length exceeds the limit and invalid characters will be replaced with given character, then return the rebuilt string value.
        Parameters:
        nameProposal - sheet name to be used
        replaceChar - character which will be used to replace invalid characters in given sheet name
        Returns: