wb.AppendHTML("<style>#table2 td{width:100px;word-break: break-all;} #table2 thead{display:none}</style>",True)
With wb.AddTable("","Table1")
.ColWidth = "100px,100px,100px,100px,100px,100px,100px,100px" '设置列宽
Dim nms() As String = {"商品代码","颜色","尺码","助记符","大类","售价","横调数","图片"}
.Head.AddRow(nms)
End With
wb.InsertHTML("","<div id='div' style='overflow-y:auto;height:500px'>")
With wb.AddTable("","Table2")
.Alternate = 2
For Each r As DataRow In dt.DataRows
With .Body.AddRow(r("商品代码"),r("颜色"),r("尺码"),r("助记符"),r("大类"))
.AddCell(Format(r("售价"),"#0"))
.AddCell(Format(r("补货数"),"#0"))
Dim s As String = r("图片")
.AddCell("<img src = " & s & " style='width:100px;height:100px'></img>")
End With
Next
End With
wb.InsertHTML("","</div>")
e.WriteString(wb.Build)
因为加入了图片,列就对不上了,列宽都是100px也没有用,该怎么调整呢