set rng=cells.find("日期")'查找含有“日期”的单元格 if not rng is nothing then‘如果找到 Ro=rng.row’行号 Co=rng.column‘列号 end if参考技术Aactivecell.row activecell.colunm参考技术B标签里有个单元格是“日期”
这句话是什么意思?
golang Golang:从行号和列号中获取列名
package helpers
import (
"time"
"strconv"
)
// ExcelError is an error implementation that includes a time and message.
type ExcelError struct {
When time.Time
What string
}
// Return the ColumnName
func GetColumnName(rowNumber int, colNumber int)(colName string, err error) {
if rowNumber < 1 || colNumber < 1 {
err = ExcelError{
time.Now(),
"Row and Column Number can not be less than 1",
}
return
}
dividend := colNumber
var modulo int
for dividend > 0 {
modulo = (dividend - 1) % 26
// Convert int to char
colName = string(65+modulo) + colName
dividend = (int)((dividend - modulo) / 26)
}
colName = colName + strconv.Itoa(rowNumber)
return
}