每天定時傳送chart給user,雖然已經寫了前端網站要給使用者查詢,
但卻還是要發送mail…,想了半天,後端要去拉前端的chart實在太難搞了。
最後只有下面四種解法…
每天定時傳送chart給user,雖然已經寫了前端網站要給使用者查詢,
但卻還是要發送mail…,想了半天,後端要去拉前端的chart實在太難搞了。
最後只有下面四種解法…
一般我們要找集合內有沒有特定字串會用
goal.Contains("Date")
但要注意的是,這邊的Date一定要是完整的字串。不屬於like的效果。
但如果想要用like的效果,該如何做?
使用Linq的方式,
var dateFormat = goal.Where(p => p.Contains("Date"))
這樣等同使用like。會將字串內有Date的字取出。
附註:goal是一個字串集合
<div style="width:900px;overflow:hidden;">
<a href='#'><img src='https://xxxxxxx" style="width:900px;margin-top:-100px"/></a>
</div>
var ids = {1, 2, 3};
var query = from item in context.items
where ids.Contains( item.id )
select item;
來做查詢。
但是一使用LinqToExcel 這樣用舊直接掛了,出現
VisitSubQueryExpression method is not implemented
CODE {
display: block; /* fixes a strange ie margin bug */
font-family: Courier New;
font-size: 8pt;
overflow:auto;
background: #f0f0f0 url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;
border: 1px solid #ccc;
padding: 10px 10px 10px 21px;
max-height:200px;
line-height: 1.2em;
}
System.Diagnostics.Process.Start("explorer.exe", AppDomain.CurrentDomain.BaseDirectory)
vb.net
Function Dec3(n As String)
Dim num As UInt32 = UInt32.Parse(n, System.Globalization.NumberStyles.AllowHexSpecifier)
Dim floatVals As Byte() = BitConverter.GetBytes(num)
Dim f As Single = BitConverter.ToSingle(floatVals, 0)
Return f
End Function
String hexString = "43480170";
uint num = uint.Parse(hexString, System.Globalization.NumberStyles.AllowHexSpecifier);
Byte[] floatVals = BitConverter.GetBytes(num);
float f = BitConverter.ToSingle(floatVals, 0);
Console.WriteLine("float convert = {0}", f);
e.Graphics.MeasureString(title,New Font("Arial", 24.0F, FontStyle.Bold), e.MarginBounds.Width).Width
dim ypos as integer = New Font("Arial", 16.0F, FontStyle.Underline).GetHeight
Dim LinePen As New Pen(Color.Black, 1)
Dim lineDash As Single() = {10, 2} '實線長度、虛線長度(loop)
LinePen.DashStyle = Drawing2D.DashStyle.Custom
LinePen.DashPattern = lineDash
e.Graphics.DrawLine(LinePen, New Point(e.MarginBounds.Left, yPos), New PointF(e.MarginBounds.Right, yPos))
e.Graphics.DrawString(String.Format("Cpk製程能力總和指數:{0}\t{1}", txtCpk.Text, txtCpkLv.Text).Replace("\t", vbTab), New Font(dg.Font, FontStyle.Bold), Brushes.Black,e.MarginBounds.Left + 261, yPos)
string.format("{1}{0}{2}{0}",a,vbTab,2,vbTab)
For Each GridCol As DataGridViewColumn In dg.Columns
e.Graphics.FillRectangle(New SolidBrush(Color.LightGray), New Rectangle(CInt(arrColumnLeft(iCount)),
iTopMargin, CInt(arrColumnWidth(iCount)), iHeaderHeight)) e.Graphics.DrawRectangle(Pens.Black, New Rectangle(CInt(arrColumnLeft(iCount)), iTopMargin,
CInt(arrColumnWidth(iCount)), iHeaderHeight))
e.Graphics.DrawString(GridCol.HeaderText, GridCol.InheritedStyle.Font,
New SolidBrush(GridCol.InheritedStyle.ForeColor),
New RectangleF(CInt(arrColumnLeft(iCount)), iTopMargin,
CInt(arrColumnWidth(iCount)), iHeaderHeight), strFormat)
iCount += 1
Next
'將chart轉成圖檔
dataChart.DrawToBitmap(bmp, New Rectangle(0, 0, dataChart.Width, dataChart.Height))
e.Graphics.DrawImage(DirectCast(dest_bmp, Image), e.PageBounds.Left + 20, yPos)
dataChart.Series("Series1").Points.Clear()
dataChart.ChartAreas.Clear()
dataChart.ChartAreas.Add("ChartArea1")
Dim arrWT As Decimal() = CommonHelp.GetTypeStd(txtStd.Text)
Dim intWT_std = arrWT(0), intWT_T = arrWT(1)
Dim ChtLSL = intWT_std - intWT_T, ChtTGT = intWT_std, ChtUSL = intWT_std + intWT_T
Dim chartMin = chartRange(intWT_T)(0), chartMax = chartRange(intWT_T)(1)
'設定MainCht
With dataChart
.Series("Series1").MarkerStyle = MarkerStyle.Circle
.ChartAreas(0).AxisX.MajorGrid.Enabled = False
.ChartAreas(0).AxisY.MajorGrid.Enabled = False
.ChartAreas(0).AxisX.MajorTickMark.Enabled = False
.ChartAreas(0).AxisY.MajorTickMark.Enabled = False
.ChartAreas(0).AxisX.LabelStyle.ForeColor = Color.Black
.ChartAreas(0).InnerPlotPosition.Auto = True
.Legends.Clear()
'最大、最小
.ChartAreas(0).AxisY.Minimum = ChtLSL - 20
.ChartAreas(0).AxisY.Maximum = ChtUSL + 20
'把圖表駔標的左右兩邊空白去除
.ChartAreas(0).AxisX.IsMarginVisible = True
.ChartAreas(0).AxisY.IsMarginVisible = True
'X軸最大的資料點總數
.ChartAreas(0).AxisX.Maximum = 100
'X軸從0開始
.ChartAreas(0).AxisX.Minimum = 0
.ChartAreas(0).AxisX.Interval = 10
'塞滿mschart
.ChartAreas(0).Position.Width = 95
.ChartAreas(0).Position.Height = 90
''Y軸標籤
'first row are dummy labels to suppress axis numberics
'.ChartAreas(0).AxisY.CustomLabels.Add(30, 40, "", 0, LabelMarkStyle.LineSideMark)
.ChartAreas(0).AxisY.CustomLabels.Add(ChtLSL, ChtLSL + 1, "LSL(" & ChtLSL.ToString & ")") 'LSL
.ChartAreas(0).AxisY.CustomLabels.Add(ChtTGT, ChtTGT + 1, "TGT(" & ChtTGT.ToString & ")") 'TGT
.ChartAreas(0).AxisY.CustomLabels.Add(ChtUSL, ChtUSL + 1, "USL(" & ChtUSL.ToString & ")") 'USL
.ChartAreas(0).AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None
'Set series chart type
.Series("Series1").ChartType = SeriesChartType.Point
''加橫線
For LineRow As Integer = 1 To 3
Dim sl1 As StripLine = New StripLine
sl1.BackColor = Color.Black
sl1.StripWidth = 0.25
Select Case LineRow
Case 1
sl1.IntervalOffset = ChtLSL
Case 2
sl1.IntervalOffset = ChtTGT
Case 3
sl1.IntervalOffset = ChtUSL
End Select
.ChartAreas(0).AxisY.StripLines.Add(sl1)
Next
End With