excel报表给符合条件的记录添加删除线效果代码如下:sheet(startRow + i, startCol + 1).Style.Font.Style = FontStyle.Strikeout
报错,只读
如何修改?
参考:
http://www.foxtable.com/webhelp/topics/1146.htm
Dim Style As XLS.Style = Book.NewStyle() '定义新样式
Style.Font = Dim fnt As New Font("宋体",12,FontStyle.Underline)
sheet(startRow + i, startCol + 1).Style = Style

此主题相关图片如下:微信图片_20250228134913.png

存盘时报错
程序运行此此,报“未将对象引用设置到对象的实例。”
For c1 As Integer = startCol To startCol + 10 ' 遍历所有列
Dim cell As XLS.Cell = sheet(startRow + i, c1)
If cell.Style Is Nothing Then
cell.Style = book.NewStyle() ' 如果单元格没有样式,则创建新样式
End If
cell.Style.BorderLeft = XLS.LineStyleEnum.Thin ' 左边框
cell.Style.BorderRight = XLS.LineStyleEnum.Thin ' 右边框
cell.Style.BorderTop = XLS.LineStyleEnum.Thin ' 上边框
cell.Style.BorderBottom = XLS.LineStyleEnum.Thin ' 下边框
Next