根据昨天提问回复的帖子写了如下代码
最终获取的range对象的行列并不准确,很多都是显示[-1,-1]
因为我最终想通过fpSpread1.Sheets.Cells[range.Row, range.Column]
获得相应的cell对象,并设置cell的CellType属性,这时就会报索引错误
foreach (FarPoint.Win.Spread.DrawingSpace.PSShape item in fpSpread1.Sheets.DrawingContainer.ContainedObjects)
{
if (item != null)
{
FarPoint.Win.Spread.Model.CellRange range = fpSpread1.GetCellFromPixel(0, 0, item.Left + (int)(fpSpread1.Sheets.Columns[0].Width), item.Top + (int)(fpSpread1.Sheets.Rows[0].Height));
if (range != null)
{
int r = range.Row;
int c = range.Column;
listBox1.Items.Add("sheet" + fpSpread1.Sheets.SheetName.ToString()+ "[" + r.ToString() + "," + c.ToString() + "]");
}
}
} |
|