スプレッドシート エディター - Cells での作業
Contents
[
Hide
]
目次
- Cellの選択 Cell 選択コールバック
- Cellを削除 WorksheetView.removeCellShiftUp
- WorksheetView.removeCellShiftLeft
- Cellをクリア WorksheetView.clearCurrentCellFormatting
- WorksheetView.clearCurrentCellContents
- WorksheetView.clearCurrentCell
Cellの選択
マウス ポインタを使用してセルをポイントします。セルをクリックして選択します。選択したセルは、太い四角形で強調表示されます。
使い方?
ユーザーがセルをクリックすると、イベントは Primefaces コンポーネントに添付された JavaScript コールバック関数によって処理されます。
Cell 選択コールバック
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;
Cellを削除
セルを削除するには:
- 削除したいセルをクリックします。
- 切り替えるフォーマットタブ.
- クリックCellを削除ボタン。
- 選ぶシフト Cells 上またシフト Cells 左ボタン。
エディターは、選択したセルを削除します。隣接するセルは、スペースを調整するために水平または垂直に自動的にシフトされます。
使い方?
のシフト Cells 上とシフト Cells 左 JSF バックエンド Bean によって処理されますワークシート ビュー.それぞれのメソッドのソース コードは次のとおりです。
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();
}
Cellをクリア
セルをクリアするには:
- クリアしたいセルをクリックします。
- 切り替えるフォーマットタブ.
- クリッククリア Cellボタン。
- 選ぶフォーマット, コンテンツまた両方オプション。
エディターは、選択したセルをクリアします。
使い方?
のフォーマット, コンテンツと両方 JSF バックエンド Bean によって処理されますワークシート ビュー.それぞれのメソッドのソース コードは次のとおりです。
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);
}