Éditeur de feuille de calcul - Travailler avec Cells

Table des matières

Sélection d’un Cell

Utilisez le pointeur de votre souris pour pointer sur une cellule. Cliquez sur une cellule pour la sélectionner. La cellule sélectionnée est mise en évidence par un rectangle gras.

Comment ça fonctionne?

Lorsque l’utilisateur clique sur une cellule, l’événement est géré par la fonction de rappel JavaScript qui est attachée au composant Primefaces.

Cell rappel de sélection

                     var columnId = $(this).find('.ui-cell-editor-input input').attr('data-columnid');

                    var rowId = $(this).find('.ui-cell-editor-input input').attr('data-rowid');

                    var clientId = $(this).find('.ui-cell-editor').attr('id');

                    PF('currentColumnIdValue').jq.val(columnId);

                    PF('currentRowIdValue').jq.val(rowId);

                    PF('currentCellClientIdValue').jq.val(clientId);

                    if ($(this).find('.ui-cell-editor-output div').hasClass('b')) {

                        PF('boldOptionButton').check();

                    } else {

                        PF('boldOptionButton').uncheck();

                    }

                    if ($(this).find('.ui-cell-editor-output div').hasClass('i')) {

                        PF('italicOptionButton').check();

                    } else {

                        PF('italicOptionButton').uncheck();

                    }

                    if ($(this).find('.ui-cell-editor-output div').hasClass('u')) {

                        PF('underlineOptionButton').check();

                    } else {

                        PF('underlineOptionButton').uncheck();

                    }

                    PF('fontOptionSelector').selectValue($(this).find('.ui-cell-editor-output div').css('font-family').slice(1, -1));

                    PF('fontSizeOptionSelector').selectValue($(this).find('.ui-cell-editor-output div')[0].style.fontSize.replace('pt', ''));

                    ['al', 'ac', 'ar', 'aj'].forEach(function(v) {

                        if ($(this).find('.ui-cell-editor-output div').hasClass(v)) {

                            // TODO: save the value to PF('alignOptionSelector');

                        }

                    });

                    PF('currentColumnWidthValue').jq.val($(this).width());

                    PF('currentRowHeightValue').jq.val($(this).height());

                    $($this.selectedCell).removeClass('sheet-selected-cell');

                    $(this).addClass('sheet-selected-cell');

                    $this.selectedCell = this;

Supprimer un Cell

Pour supprimer une cellule :

  1. Cliquez sur une cellule que vous souhaitez supprimer.
  2. Basculer versOnglet Format.
  3. Cliquez surSupprimer Cell bouton.
  4. ChoisirMaj Cells vers le haut ou alorsMaj Cells Gauche bouton.

L’éditeur supprimera la cellule sélectionnée. Les cellules adjacentes seront automatiquement décalées horizontalement ou verticalement pour ajuster l’espace.

Comment ça fonctionne?

LeMaj Cells vers le haut etMaj Cells Gauche sont gérés par le bean backend JSFFeuille de calcul. Le code source des méthodes respectives est le suivant :

WorksheetView.removeCellShiftUp

     public void removeCellShiftUp() {

        if (!isLoaded()) {

            return;

        }

        getAsposeWorksheet().getCells().deleteRange(currentRowId, currentColumnId, currentRowId, currentColumnId, com.aspose.cells.ShiftType.UP);

        purge();

    }

WorksheetView.removeCellShiftLeft

     public void removeCellShiftLeft() {

        if (!isLoaded()) {

            return;

        }

        getAsposeWorksheet().getCells().deleteRange(currentRowId, currentColumnId, currentRowId, currentColumnId, com.aspose.cells.ShiftType.LEFT);

        purge();

    }

Effacer un Cell

Pour vider une cellule :

  1. Cliquez sur une cellule que vous souhaitez effacer.
  2. Basculer versOnglet Format.
  3. Cliquez surClair Cell bouton.
  4. ChoisirFormats, Contenu ou alorsTous les deux option.

L’éditeur effacera la cellule sélectionnée.

Comment ça fonctionne?

LeFormats, Contenu etTous les deux sont gérés par le bean backend JSFFeuille de calcul. Le code source des méthodes respectives est le suivant :

WorksheetView.clearCurrentCellFormatting

     public void clearCurrentCellFormatting() {

        if (!isLoaded()) {

            return;

        }

        getAsposeWorksheet().getCells().clearFormats(currentRowId, currentColumnId, currentRowId, currentColumnId);

        reloadCell(currentColumnId, currentRowId);

        RequestContext.getCurrentInstance().update(currentCellClientId);

    }

WorksheetView.clearCurrentCellContents

     public void clearCurrentCellContents() {

        if (!isLoaded()) {

            return;

        }

        getAsposeWorksheet().getCells().clearContents(currentRowId, currentColumnId, currentRowId, currentColumnId);

        reloadCell(currentColumnId, currentRowId);

        RequestContext.getCurrentInstance().update(currentCellClientId);

    }

WorksheetView.clearCurrentCell

     public void clearCurrentCell() {

        if (!isLoaded()) {

            return;

        }

        getAsposeWorksheet().getCells().clearRange(currentRowId, currentColumnId, currentRowId, currentColumnId);

        reloadCell(currentColumnId, currentRowId);

        RequestContext.getCurrentInstance().update(currentCellClientId);

    }