0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[SpreadsheetGear]ウィンドウ枠の固定をしている時のセル位置の取得

Posted at
SpreadsheetGear.IRange range = cells["F10"];
double x, y;
if (worksheet.WindowInfo.FreezePanes) {		// ウィンドウ枠の固定実行時
	RangeLocationFlags rangeLocationFlags;
	var splitRows = worksheet.WindowInfo.SplitRows;
	var splitColumns = worksheet.WindowInfo.SplitColumns;
	
	if (splitRows > 0 && splitColumns > 0) {  // 4分割
		// セルが4分割のどこにいるか
		if (splitRows - range.Row > 0 && splitColumns - range.Column > 0) {
			rangeLocationFlags = RangeLocationFlags.Pane1;
		} else if (splitRows - range.Row > 0) {
			rangeLocationFlags = RangeLocationFlags.Pane2;
		} else if (splitColumns - range.Column > 0) {
			rangeLocationFlags = RangeLocationFlags.Pane3;
		} else {
			rangeLocationFlags = RangeLocationFlags.Pane4;
		}
	} else {  // 2分割
		if (splitRows - range.Row > 0 || splitColumns - range.Column > 0) {
			rangeLocationFlags = RangeLocationFlags.Pane1;
		} else {
			rangeLocationFlags = RangeLocationFlags.Pane2;
		}
	}
	
	// セル位置取得
	this.RangeToLocation(range.Row, range.Column, out x, out y, rangeLocationFlags);
} else {	
	// セル位置取得
	this.RangeToLocation(range.Row, range.Column, out x, out y);
}

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?