运算符 '>=' 没有为类型 'Integer' 和 'closedxml.excel.ixlrow 定义
Operator '>=' is not defined for type 'Integer' and 'closedxml.excel.ixlrow
我尝试使用 ClosedXML 每 13 行添加分页符,但我无法解决这个问题
Dim xrow As Integer = 0
Do Until xrow >= ws.LastRowUsed()
ws.PageSetup.AddHorizontalPageBreak(xrow)
xrow += 13
Loop
收到错误
Operator '>=' is not defined for type 'Integer' and
'closedxml.excel.ixlrow
在您的代码中:
Do Until xrow >= ws.LastRowUsed()
ws.LastRowUsed() '<-- will point to the row not the row number hence it cannot be compared with an integer value that's why you are getting such error message while running the code.
So make change it as :
ws.LastRowUsed().RowNumber() '<-- will give you the specific row number
因此您的代码将如下所示:
Dim xrow As Integer = 0
Do Until xrow >= ws.LastRowUsed().RowNumber()
ws.PageSetup.AddHorizontalPageBreak(xrow)
xrow += 13
Loop
我尝试使用 ClosedXML 每 13 行添加分页符,但我无法解决这个问题
Dim xrow As Integer = 0
Do Until xrow >= ws.LastRowUsed()
ws.PageSetup.AddHorizontalPageBreak(xrow)
xrow += 13
Loop
收到错误
Operator '>=' is not defined for type 'Integer' and 'closedxml.excel.ixlrow
在您的代码中:
Do Until xrow >= ws.LastRowUsed()
ws.LastRowUsed() '<-- will point to the row not the row number hence it cannot be compared with an integer value that's why you are getting such error message while running the code. So make change it as :
ws.LastRowUsed().RowNumber() '<-- will give you the specific row number
因此您的代码将如下所示:
Dim xrow As Integer = 0
Do Until xrow >= ws.LastRowUsed().RowNumber()
ws.PageSetup.AddHorizontalPageBreak(xrow)
xrow += 13
Loop