- Code: Select all
RtvCmd.CommandText = "SELECT Day1,Day2,Day3,Day4,Day5,Day6,Day7,Day8,Day9,Day10,Day11,Day12," &
" Day13,Day14,Day15,Day16,Day17,Day18,Day19,Day20,Day21,Day22,Day23,Day24," &
" Day25,Day26,Day27,Day28,Day29,Day30,TOTAL,MEAN,SIGMA FROM DLTPREPT WHERE" &
" DataField='No of INGOTS' AND Report='CW LEAD TIME REPORT ' AND QAAMON" &
" ='" & qaaMonLTCW & "' AND QAADAY ='" & qaaDayLTCW & "'"
strconn.Open()
RtvCmd.Connection = strconn
RtvCmd.CommandTimeout = 100
RtvCmd.ExecuteNonQuery()
Rtvda.SelectCommand = RtvCmd
Rtvda.Fill(Fillds)
tblFill = Fillds.Tables(0)
Then, I want to plot to excel file that dedicated to this report.
- Code: Select all
If Dir(WebPath & "LeadtmRptCW.xlsx") <> "" Then
Kill(WebPath & "LeadtmRptCW.xlsx")
End If
Dim wbLTCW As Workbook = New Workbook()
wbLTCW.LoadFromFile(WebPath & "LeadtmRptCW.xls")
Dim wsLTCW As Worksheet = wbLTCW.Worksheets(0)
wsLTCW.Name = "Graph-LeadTime-CW"
wsLTCW(1, 1).Value = "S.E.H. SA : CW CYCLETIME"
wsLTCW(1, 27).Value = "Month of : " & fulldte
For j = 0 To 29
If Fillds.Tables(0).Rows(0).Item(j) = "- " Then
Fillds.Tables(0).Rows(0).Item(j) = "0"
End If
wsLTCW(35, j + 2).Value = Fillds.Tables(0).Rows(0).Item(j)
Next
wsLTCW(35, 35).Value = Fillds.Tables(0).Rows(0).Item(31)
wsLTCW(36, 35).Value = Fillds.Tables(0).Rows(0).Item(32)
wsLTCW.SaveToFile(WebPath2 & "LeadtmRptCW.xls", ExcelVersion.Version97to2003)
Dim objFileInfoIGANRej As System.IO.FileInfo = New System.IO.FileInfo("D:\webtmp\LeadtmRptCW.xls") 'It should be change according to webpath
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-Disposition", "attachment; filename=LeadtmRptCW.xls")
Response.TransmitFile(filename:=WebPath2 & "LeadtmRptCW.xls") 'It should be change according to webpath
Response.End()
Response.Flush()
'Finally
HttpContext.Current.Response.Flush() ' Sends all currently buffered output To the client.
HttpContext.Current.Response.SuppressContent = True ' Gets Or sets a value indicating whether To send HTTP content To the client.
HttpContext.Current.ApplicationInstance.CompleteRequest() ' Causes ASP.NET To bypass all events And filtering In the HTTP pipeline chain Of execution And directly execute the EndRequest Event.
I can download the file however it does not show the way I wanted. I attach image file. A is the downloaded file. B is that I really want.
Previously I used Excel interop library and its working. Now want to implement spire. Is there anything that I left?