作成日: 2019/05/21 最終更新日: 2021/07/28
文書種別
不具合
状況
修正済み
詳細
行/列の一部を非表示にし、非表示にした行/列に隣接するセルを選択してから、[Shift]+ 矢印キーでセルを選択すると、セル選択の動作が不正になります。
セルの高さ/幅を0に設定した場合にも、同様の事象が発生します。
例えば以下のような動作です。
【F列が非表示の場合】
セルの高さ/幅を0に設定した場合にも、同様の事象が発生します。
例えば以下のような動作です。
【F列が非表示の場合】
- G1セルを選択する
- Shift + 左矢印キーを押下して、E1:G1を選択する
- Shift + 右矢印キーを押下すると、G1セルのみ選択された状態になる
- Shift + 右矢印キーを押下して、G1:H1を選択する
- Shift + 左矢印キーを押下すると、E1:H1が選択された状態になる(不正)
回避方法
Service Pack 5(v2.0.2021.0728)で修正済みです。
Service Pack 5(v2.0.2021.0726)より前のバージョンでは次の回避方法が有効です。
以下ようにSelectionChangingイベントを使用したコード処理を追加することで回避します。
◎サンプルコード(C#)
◎サンプルコード(C#)
private void Spread_SelectionChanging(object sender, SelectionChangingEventArgs e)
{
var selection = e.ActiveSelection;
if (selection.Length != 1)
{
return;
}
var firstSelection = selection.First();
var left = firstSelection.Column;
var top = firstSelection.Row;
var right = firstSelection.Column + firstSelection.ColumnCount - 1;
var bottom = firstSelection.Row + firstSelection.RowCount - 1;
var reselect = false;
var hiddenColumns = (from c in Spread.Columns
where !c.IsVisible
select c).ToArray();
var trimLeft = (from c in hiddenColumns
where c.Index == left
select c).Any();
if (trimLeft)
{
reselect = trimLeft;
left = SelectionTrimLeft(left, right);
}
var trimRight = (from c in hiddenColumns
where c.Index == right
select c).Any();
if (trimRight)
{
reselect = trimRight;
right = SelectionTrimRight(left, right);
}
var hiddenRows = (from r in Spread.Rows
where !r.IsVisible
select r).ToArray();
var trimTop = (from r in hiddenRows
where r.Index == top
select r).Any();
if (trimTop)
{
reselect = trimTop;
top = SelectionTrimTop(top, bottom);
}
var trimBottom = (from r in hiddenRows
where r.Index == bottom
select r).Any();
if (trimBottom)
{
reselect = trimBottom;
bottom = SelectionTrimBottom(top, bottom);
}
if (reselect)
{
e.Cancel = true;
Spread.Select(new CellRange(top, left, bottom - top + 1, right - left + 1), SelectionType.New);
}
}
private int SelectionTrimBottom(int top, int bottom)
{
for (int rowId = bottom; rowId > top; rowId--)
{
if (!Spread.Rows[rowId].IsVisible)
{
bottom--;
}
else
{
break;
}
}
return bottom;
}
private int SelectionTrimTop(int top, int bottom)
{
for (int rowId = top; rowId < bottom; rowId++)
{
if (!Spread.Rows[rowId].IsVisible)
{
top++;
}
else
{
break;
}
}
return top;
}
private int SelectionTrimRight(int left, int right)
{
for (int colId = right; colId > left; colId--)
{
if (!Spread.Columns[colId].IsVisible)
{
right--;
}
else
{
break;
}
}
return right;
}
private int SelectionTrimLeft(int left, int right)
{
for (int colId = left; colId < right; colId++)
{
if (!Spread.Columns[colId].IsVisible)
{
left++;
}
else
{
break;
}
}
return left;
}
旧文書番号
83983