2014年1月11日 星期六

應收帳款收現計算-應計基礎轉現金基礎~軟體free自行開發請珍惜資源

應收帳款收現計算-應計基礎轉現金基礎軟體計算

Asp.net匯出chart

Protected Sub btnExportExcel_Click(sender As Object, e As EventArgs)
    Response.Clear()
    Response.Buffer = True
    Response.AddHeader("content-disposition", "attachment;filename=ChartExport.xls")
    Response.ContentType = "application/vnd.ms-excel"
    Response.Charset = ""
    Dim sw As New StringWriter()
    Dim hw As New HtmlTextWriter(sw)
    Chart1.RenderControl(hw)
    Dim src As String = Regex.Match(sw.ToString(), "<img.+?src=[""'](.+?)[""'].+?>", RegexOptions.IgnoreCase).Groups(1).Value
    Dim table As String = "<table><tr><td><img src='{0}' /></td></tr></table>"
    table = String.Format(table, Request.Url.GetLeftPart(UriPartial.Authority) + src)
    Response.Write(table)
    Response.Flush()
    Response.End()
End Sub