iT邦幫忙

0

gridview大腸包小腸格式問題

  • 分享至 

  • xImage

各位大大您好,目前我在做girdview大腸包小腸的功能,然後最後要匯出excel,希望的格式如下:
https://ithelp.ithome.com.tw/upload/images/20180123/20105760ed2efjeNeW.jpg
白色部分為大腸(gridview1)
黃色部分為小腸(gridview2)
但是目前有兩個問題
1.本來小腸應該橫跨13欄 但是目前整個小腸會限縮在同一欄
2.每個小腸前面還會多出一列空的資料列
目前狀況如下:
https://ithelp.ithome.com.tw/upload/images/20180123/201057609D0pPHfGfk.jpg

https://ithelp.ithome.com.tw/upload/images/20180123/201057602U9jJyFiA0.jpg

請問各位大大如何調整小腸gridview2設計 讓它橫跨13欄,以符合預期設計?

阿薛 iT邦新手 5 級 ‧ 2018-01-23 12:01:38 檢舉
程式碼如下
```
<asp:ScriptManager runat="server" ID="ScriptManager1" EnablePartialRendering="true" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="gridview5_RowDataBound">
<Columns>
<asp:TemplateField>
<HeaderStyle Width="90px" CssClass="GridviewScrollHeader" />
<HeaderTemplate>
<table style='font-size: 12pt'>
<tr><td></td><td colspan='14' style='text-align: center'><div>xxxx中心<br>xxxx檢查表</div></td><td></td></tr>
<tr><td></td><td><span>單位:</span></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><span>日期:</span></td><td></td><td></td><td></td></tr>
<tr style='text-align: center'><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy/span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td><td style='border: solid'><span>yy</span></td></tr></table>
</HeaderTemplate>
<ItemTemplate><table style="font-size: 12pt">
<tr><td rowspan="5" style="border: solid"><asp:Label ID="labno" runat="server" Text='<%# Bind("no")%>'></asp:Label></td>
<td rowspan="5" style="border: solid"><asp:Label ID="Labcaseid" runat="server" Text='<%# Bind("caseid")%>'></asp:Label></td>
<td style="border: solid"><span>xx時間</span></td><td style="border: solid; text-align: center"><asp:Label ID="labWpic1" runat="server" Text='<%# Bind("uldate1")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labCamera" runat="server" Text='<%# Bind("uldateCamera")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labWpic4" runat="server" Text='<%# Bind("uldateWpic4")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labWpic3" runat="server" Text='<%# Bind("uldateWpic3")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labWpic5" runat="server" Text='<%# Bind("uldateWpic5")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labWpic6" runat="server" Text='<%# Bind("uldateWpic6")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labWpichm" runat="server" Text='<%# Bind("uldateWpichm")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labWpic7" runat="server" Text='<%# Bind("uldateWpic7")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labWpic57" runat="server" Text='<%# Bind("uldateWpic57")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labWpic58" runat="server" Text='<%# Bind("uldateWpic58")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labWpic8" runat="server" Text='<%# Bind("uldateWpic8")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labWpic10" runat="server" Text='<%# Bind("uldateWpic10")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="labWpic9" runat="server" Text='<%# Bind("uldateWpic9")%>'></asp:Label></td></tr><tr><td style="border: solid"><span>xx數量</span></td><td style="border: solid; text-align: center"><asp:Label ID="Labcount1" runat="server" Text='<%# Bind("count1")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountCamera" runat="server" Text='<%# Bind("countCamera")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountWpic4" runat="server" Text='<%# Bind("countWpic4")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountWpic3" runat="server" Text='<%# Bind("countWpic3")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountWpic5" runat="server" Text='<%# Bind("countWpic5")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountWpic6" runat="server" Text='<%# Bind("countWpic6")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountWpichm" runat="server" Text='<%# Bind("countWpichm")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountWpic7" runat="server" Text='<%# Bind("countWpic7")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountWpic57" runat="server" Text='<%# Bind("countWpic57")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountWpic58" runat="server" Text='<%# Bind("countWpic58")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountWpic8" runat="server" Text='<%# Bind("countWpic8")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountWpic10" runat="server" Text='<%# Bind("countWpic10")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabcountWpic9" runat="server" Text='<%# Bind("countWpic9")%>'></asp:Label></td></tr>
<tr><td style="border: solid"><span>xxx結果</span></td><td style="border: solid; text-align: center"><asp:Label ID="Labresult1" runat="server" Text='<%# Bind("result1")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultCamera" runat="server" Text='<%# Bind("resultCamera")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultWpic4" runat="server" Text='<%# Bind("resultWpic4")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultWpic3" runat="server" Text='<%# Bind("resultWpic3")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultWpic5" runat="server" Text='<%# Bind("resultWpic5")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultWpic6" runat="server" Text='<%# Bind("resultWpic6")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultWpichm" runat="server" Text='<%# Bind("resultWpichm")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultWpic7" runat="server" Text='<%# Bind("resultWpic7")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultWpic57" runat="server" Text='<%# Bind("resultWpic57")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultWpic58" runat="server" Text='<%# Bind("resultWpic58")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultWpic8" runat="server" Text='<%# Bind("resultWpic8")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultWpic10" runat="server" Text='<%# Bind("resultWpic10")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabresultWpic9" runat="server" Text='<%# Bind("resultWpic9")%>'></asp:Label></td></tr><tr><td style="border: solid"><span>xxx備註</span></td><td style="border: solid; text-align: center"><asp:Label ID="Lab1note" runat="server" Text='<%# Bind("1note")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="LabCamerarnote" runat="server" Text='<%# Bind("Cameranote")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="Lab4rnote" runat="server" Text='<%# Bind("Wpic4note")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="Lab3rnote" runat="server" Text='<%# Bind("Wpic3note")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="Lab5rnote" runat="server" Text='<%# Bind("Wpic5note")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="Lab6rnote" runat="server" Text='<%# Bind("Wpic6note")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="Labhmrnote" runat="server" Text='<%# Bind("Wpichmnote")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="Lab7rnote" runat="server" Text='<%# Bind("Wpic7note")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="Lab57rnote" runat="server" Text='<%# Bind("Wpic57note")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="Lab58rnote" runat="server" Text='<%# Bind("Wpic58note")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="Lab8rnote" runat="server" Text='<%# Bind("Wpic8note")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="Lab10rnote" runat="server" Text='<%# Bind("Wpic10note")%>'></asp:Label></td><td style="border: solid; text-align: center"><asp:Label ID="Lab9rnote" runat="server" Text='<%# Bind("Wpic9note")%>'></asp:Label></td><asp:HiddenField ID="hidstartid" runat="server" Value='<%# Bind("startid")%>' /></tr><tr><td style="border: solid"><span>xxxx項目</span></td><td colspan="13" style="border: solid"><asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"><ContentTemplate>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" Width="1500px"><Columns><asp:TemplateField><ItemTemplate>
<table>
<tr><td><asp:Label ID="labnoo" runat="server"></asp:Label></td><td><asp:Label ID="LabTypeNa" runat="server" Text='<%# Bind("TypeNa")%>'></asp:Label></td><td colspan="11"><asp:Label ID="Labstna" runat="server" Text='<%# Bind("STypeNa")%>'></asp:Label></td></tr>
</table></ItemTemplate></asp:TemplateField></Columns></asp:GridView></ContentTemplate></asp:UpdatePanel></td></tr></table></ItemTemplate></asp:TemplateField></Columns></asp:GridView></ContentTemplate></asp:UpdatePanel>
```
阿薛 iT邦新手 5 級 ‧ 2018-02-07 16:37:44 檢舉
已解決 解答如下 。

設計:

<asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField HeaderText="XX">
<ItemTemplate>
<asp:Label ID="labno" runat="server" Text='<%# Bind("no")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="XX">
<ItemTemplate><asp:Label ID="Labcaseid" runat="server" Text='<%# Bind("caseid")%>'></asp:Label>
<asp:HiddenField ID="Hidstartid" runat="server" value='<%# Bind("startid")%>'></asp:HiddenField>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="XX">
<ItemTemplate>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="XX<td>XXX</td><td>XXXX</td><td>XXXX</td><td>XXXX</td>">
<ItemTemplate>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="XXXX<td>XXXX</td>">
<ItemTemplate>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="XXXX<td>XXXX</td><td>XXXX</td><td>XXXX</td><td>XXXX</td><td>XXXX</td>">
<ItemTemplate>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
程式碼如下:

Private Sub ButExcel3_Click(sender As Object, e As EventArgs) Handles ButExcel3.Click
Try

If XXXGridView.Rows.Count > 0 Then
Using cn As New SqlConnection(ConnectString)
cn.Open()
SetExcel3(cn)
End Using
Else
TycFunction.MsgAlert(Page, "無資料,無法輸出!!")
Exit Sub
End If

SetGridView4()
Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=中心單位自主檢查表.xls")
Response.Charset = "big5"
Response.ContentType = "application/vnd.xls"
Dim stringWrite As System.IO.StringWriter = New System.IO.StringWriter
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite)
GridView4.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString)
Response.End()
Me.Session("dtEX3") = Nothing
Catch ex As Exception
Dim str As String = "系統執行發生錯誤:ButExcel3_Click()" & "<br>"
str += "message:" & ex.Message & "<br>"
str += "sql:" & sql & "<br>"
LabError.Text = str
End Try
End Sub



Private Sub SetGridView4()
Try
Dim gvr As GridViewRow = New GridViewRow(0, -1, DataControlRowType.DataRow, DataControlRowState.Normal)
Dim cell1 As TableCell = New TableCell()
cell1.Text = "<table style='font-size:12pt;font-family:DFKai-sb'><tr><td></td><td>駐點人員簽名:</td><td></td><td></td><td></td><td></td><td></td><td></td><td>中心人員:</td><td></td><td></td><td></td><td></td><td></td><td>第 頁</td><td>共 頁</td></tr></table>"
cell1.ColumnSpan = 16
gvr.Controls.Add(cell1)
GridView4.Controls(0).Controls.AddAt(GridView4.Rows.Count + 2, gvr)
Catch ex As Exception
Dim str As String = "系統執行發生錯誤:SetGridView4()" & "<br>"
str += "message:" & ex.Message & "<br>"
str += "sql:" & sql & "<br>"
LabError.Text = str
End Try

End Sub
Private Sub SetExcel3(ByRef cn As SqlConnection)
Try
Dim myDataView As DataView = Me.Session("dv")
Dim myDataTable As DataTable = myDataView.Table
Dim dt As New DataTable("dtEX3")

dt.Columns.Add("XX", Type.GetType("System.String"))
dt.Columns.Add("XXXXXid", Type.GetType("System.String"))
dt.Columns.Add("XXXXXd", Type.GetType("System.String"))
dt.Columns.Add("XXXXe1", Type.GetType("System.String"))
......
dt.Columns.Add("XXXXXote", Type.GetType("System.String"))
dt.Columns.Add("XXXXXe", Type.GetType("System.String"))
dt.Columns.Add("XXXXXte", Type.GetType("System.String"))
Dim row As DataRow = dt.NewRow()
If myDataTable.Rows.Count > 0 Then
For i As Integer = 0 To myDataTable.Rows.Count - 1
row = dt.NewRow
row("no") = (i + 1).ToString()
row("startid") = myDataTable.Rows(i).Item("startid")
......
SqlDA.Dispose()
SqlDR.Close()
End If
dt.Rows.Add(row)
Next
dt.AcceptChanges()

End If
Me.Session("dtEX3") = dt
GridView4.DataSource = Me.Session("dtEX3")

GridView4.DataBind()


For j As Integer = 0 To GridView4.Rows.Count - 1
Dim Hidstartid As HiddenField = GridView4.Rows(j).FindControl("Hidstartid")
Dim DB As DataTable
sql = "select Typ ...... Result='1' "
SqlDA = New SqlDataAdapter(sql, cn)
sql += " and dt.StartID = @startid order by ch.TypeID"
SqlDA.SelectCommand.Parameters.Add("@startid", SqlDbType.NVarChar)
SqlDA.SelectCommand.Parameters("@startid").Value = Hidstartid.Value
SqlDA.SelectCommand.CommandText = sql
SqlDS = New DataSet 'DataSet資料集物件實體化
SqlDA.Fill(SqlDS) '填充DataSet資料集
DB = SqlDS.Tables(0)

SqlDA.Dispose()
SqlDS.Dispose()


Dim DB2 As DataTable
sql = "selec ......nd CChkResult='1' "
SqlDA = New SqlDataAdapter(sql, cn)
sql += " and dt.StartID = @startid order by ch.TypeID"
SqlDA.SelectCommand.Parameters.Add("@startid", SqlDbType.NVarChar)
SqlDA.SelectCommand.Parameters("@startid").Value = Hidstartid.Value
SqlDA.SelectCommand.CommandText = sql
SqlDS = New DataSet 'DataSet資料集物件實體化
SqlDA.Fill(SqlDS) '填充DataSet資料集
DB2 = SqlDS.Tables(0)

SqlDA.Dispose()
SqlDS.Dispose()
Dim g As Integer = 1
If DB.Rows.Count > 0 And DB2.Rows.Count < DB.Rows.Count Then
g = DB.Rows.Count
End If
If DB2.Rows.Count > 0 And DB2.Rows.Count > DB.Rows.Count Then
g = DB2.Rows.Count
End If
If DB2.Rows.Count > 0 And DB.Rows.Count > 0 And DB2.Rows.Count = DB.Rows.Count Then
g = DB2.Rows.Count
End If

GridView4.Rows(j).Cells(2).Text = "<table><tr><td style='border: solid'>XXXX</td></tr>"
GridView4.Rows(j).Cells(2).Text += "<tr><td style='border: solid'>XXXX</td></tr>"
GridView4.Rows(j).Cells(2).Text += "<tr><td style ='border: solid'>XXXX結果</td></tr>"
GridView4.Rows(j).Cells(2).Text += "<tr><td style='border: solid'>XXXX備註</td></tr>"
GridView4.Rows(j).Cells(2).Text += "<tr><td style='border: solid'>XXXX結果</td></tr>"
GridView4.Rows(j).Cells(2).Text += "<tr><td style='border: solid'>XXXX備註</td></tr>"
GridView4.Rows(j).Cells(2).Text += "<tr><td rowspan='" & g & "' style='border: solid'>XX單位審查不合格項目</td></tr>"
GridView4.Rows(j).Cells(2).Text += "</table>"



GridView4.Rows(j).Cells(3).Text += "<table><tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXXX1") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXmera") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXc4") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXc3") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXc5") & "</td></tr>"

GridView4.Rows(j).Cells(3).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXX1") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXra") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXc4") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXX3") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXX5") & "</td></tr>"




GridView4.Rows(j).Cells(3).Text += "<tr><td style ='border: solid'>" & dt.Rows(j).Item("XXXXX") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXXera") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXX4") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXXc3") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXX5") & "</td></tr>"



GridView4.Rows(j).Cells(3).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXXe") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXe") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXe") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXe") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXe") & "</td></tr>"


GridView4.Rows(j).Cells(3).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXX1") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXXera") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXc4") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXc3") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXc5") & "</td></tr>"

GridView4.Rows(j).Cells(3).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXte") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXte") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXe") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXe") & "</td>"
GridView4.Rows(j).Cells(3).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXe") & "</td></tr>"



For k As Integer = 0 To DB.Rows.Count - 1
GridView4.Rows(j).Cells(3).Text += "<tr><td style='border: solid'>" & k + 1 & "</td><td style='border: solid'>" & DB.Rows(k).Item("XXXXNa") & "</td><td colspan='3' style='border: solid'>" & DB.Rows(k).Item("STypeNa") & "</td></tr>"
Next

GridView4.Rows(j).Cells(3).Text += "</table>"

GridView4.Rows(j).Cells(3).ColumnSpan = 5

GridView4.Rows(j).Cells(4).Text += "<table><tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXX6") & "</td>"
GridView4.Rows(j).Cells(4).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXcHM") & "</td></tr>"

GridView4.Rows(j).Cells(4).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXc6") & "</td>"
GridView4.Rows(j).Cells(4).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXM") & "</td></tr>"

GridView4.Rows(j).Cells(4).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXX6") & "</td>"
GridView4.Rows(j).Cells(4).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXHM") & "</td></tr>"

GridView4.Rows(j).Cells(4).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXte") & "</td>"
GridView4.Rows(j).Cells(4).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXte") & "</td></tr>"

GridView4.Rows(j).Cells(4).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXc6") & "</td>"
GridView4.Rows(j).Cells(4).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXM") & "</td></tr>"

GridView4.Rows(j).Cells(4).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXte") & "</td>"
GridView4.Rows(j).Cells(4).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXe") & "</td></tr>"

GridView4.Rows(j).Cells(4).Text += "<tr><td colspan='2' rowspan='" & g & "' style='border: solid'>XX抽查不合格項目</td></tr>"

GridView4.Rows(j).Cells(4).Text += "</table>"
GridView4.Rows(j).Cells(4).ColumnSpan = 2

GridView4.Rows(j).Cells(5).Text += "<table><tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXX7") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXX7") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXX58") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXc8") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXX10") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXX9") & "</td></tr>"



GridView4.Rows(j).Cells(5).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXX7") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXX7") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXc58") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXic8") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXX10") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXX9") & "</td></tr>"




GridView4.Rows(j).Cells(5).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXX7") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXX7") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXX58") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXX8") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXX10") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXc9") & "</td></tr>"



GridView4.Rows(j).Cells(5).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXXte") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXte") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXe") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXte") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXe") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXte") & "</td></tr>"



GridView4.Rows(j).Cells(5).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXX7") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXX7") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXXltWpic58") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXWpic8") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXX0") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXXX9") & "</td></tr>"





GridView4.Rows(j).Cells(5).Text += "<tr><td style='border: solid'>" & dt.Rows(j).Item("XXXXte") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXote") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXote") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXote") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXnote") & "</td>"
GridView4.Rows(j).Cells(5).Text += "<td style='border: solid'>" & dt.Rows(j).Item("XXXXte") & "</td></tr>"



For k As Integer = 0 To DB2.Rows.Count - 1
GridView4.Rows(j).Cells(5).Text += "<tr><td style='border: solid'>" & k + 1 & "</td><td style='border: solid'>" & DB2.Rows(k).Item("XXpeNa") & "</td><td colspan='4' style='border: solid'>" & DB2.Rows(k).Item("STypeNa") & "</td></tr>"
Next

GridView4.Rows(j).Cells(5).Text += "</table>"
GridView4.Rows(j).Cells(5).ColumnSpan = 6
Next

Catch ex As Exception
Dim str As String = "系統執行發生錯誤:SetExcel3()" & "<br>"
str += "message:" & ex.Message & "<br>"
str += "sql:" & sql & "<br>"
LabError.Text = str
End Try
End Sub

Protected Sub GridView4_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GridView4.RowCreated
If (e.Row.RowType = DataControlRowType.Header) Then
Dim header As String = ""
header = "<table><tr><td></td><td colspan='14' style='text-align: center'><div>XX中心<br>"
header += "XX表</div></td><td></td></tr><tr><td></td><td><span>單位:</span></td>"
header += "<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>"
header += "<td></td><td></td><td><span>日期:</span></td><td></td><td></td><td></td></tr></table>"

Dim headRow As GridViewRow = New GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert)
Dim cell1 As New TableHeaderCell
cell1.Text = header
cell1.ColumnSpan = 16
headRow.Cells.Add(cell1)
GridView4.Controls(0).Controls.Add(headRow)
End If
End Sub
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答