Class SpreadsheetUtils


  • public final class SpreadsheetUtils
    extends Object
    Spreadsheet utilities methods
    • Method Detail

      • buildDocument

        public static Pair<SpreadsheetDocument,​BasicTemplate> buildDocument​(String templateName,
                                                                                  org.eclipse.emf.ecore.EObject mdObject,
                                                                                  boolean isReplaceTemplate)
        Make new spreadsheet document
        Parameters:
        templateName - - name
        mdObject - - parent mdobject
        isReplaceTemplate - - replace exist template
        Returns:
        pair with SpreadsheetDocument and BasicTemplate
      • setCellText

        public static void setCellText​(SheetAccessor sheet,
                                       int row,
                                       int column,
                                       String text,
                                       FillType fillType,
                                       boolean isBoold,
                                       int border,
                                       String dataFormat,
                                       int autoIndent,
                                       String detailParameter)
        Set cell text
        Parameters:
        sheet - - sheet accessor
        row - - row
        column - - column
        text - - text
        fillType - - fill type
        isBoold - - is text bold
        border - - borders
        dataFormat - - data format
        autoIndent - - auto indent
        detailParameter - - detail parameter
      • getColumnWidth

        public static int getColumnWidth​(TypeDescription type,
                                         int minWidth)
        Calculate column width for given type
        Parameters:
        type - - type
        minWidth - - minimum width
        Returns:
        width
      • getDataFormat

        public static String getDataFormat​(TypeDescription type,
                                           ScriptVariant scriptVariant)
        Get text format for type
        Parameters:
        type - - type
        scriptVariant - - Script variant
        Returns:
        text format
      • setColumnWidth

        public static void setColumnWidth​(SheetAccessor sheet,
                                          int width,
                                          int columnIndex,
                                          int rowIndex,
                                          int rowsCount)
        Set column width
        Parameters:
        sheet - - sheet accessor
        width - - width
        columnIndex - - column index
        rowIndex - - row index
        rowsCount - - rows count
      • createColumn

        public static Column createColumn​(SheetAccessor sheet,
                                          int width)
        Create column from sheet accessor
        Parameters:
        sheet - - sheet accessor
        width - - width
        Returns:
        column
      • saveDocument

        public static void saveDocument​(SpreadsheetDocument spreadsheetDocument)
        Save document
        Parameters:
        spreadsheetDocument - - spreadsheet document
      • openEditor

        public static void openEditor​(org.eclipse.emf.ecore.EObject object)
        Open editor with object
        Parameters:
        object - - object
      • closeEditor

        public static void closeEditor​(org.eclipse.emf.ecore.EObject object)
        Close opened editor with object
        Parameters:
        object - - object in editor
      • findTemplateWithName

        public static BasicTemplate findTemplateWithName​(org.eclipse.emf.ecore.EObject mdObject,
                                                         org.eclipse.emf.ecore.EReference reference,
                                                         String templateName)
        Find template with name
        Parameters:
        mdObject - - MdObject
        reference - - reference with templates
        templateName - - template name
        Returns:
        template or null
      • getText

        public static String getText​(String text,
                                     String textRu,
                                     ScriptVariant scriptVariant)
        Get text depended from script variant
        Parameters:
        text - - default text
        textRu - - russian text
        scriptVariant - - script variant
        Returns:
        text