读书人

请大家帮小弟我把vb的代码转换成delph

发布时间: 2012-02-20 21:18:23 作者: rapoo

请大家帮我把vb的代码转换成delphi的
我实在是没有办法了,请大家帮我把vb的代码转换成delphi的,谢谢了,我等着急用
Dim oWordApp
Dim oDoc
Dim oTable
Dim oLine
Dim oCell
Dim oShape,oGraphChart
On error resume next
Set oWordApp = CreateObject( "Word.Application ")
Set oDoc = oWordApp.Documents.Add
oWordApp.Visible = true

Const xlArea = 1
Const xlBar = 2
Const xlColumn = 3
'Const xlLine = 4
Const xlPie = 5
Const xlRadar = -4151
Const xlXYScatter = -4169
Const xlCombination = -4111
Const xl3DArea = -4098
Const xl3DBar = -4099
Const xl3DColumn = -4100
Const xl3DLine = -4101
Const xl3DPie = -4102
Const xl3DSurface = -4103
Const xlDoughnut = -4120



'Embed a chart on the document.
Set oShape = oDoc.Shapes.AddOLEObject( "MSGraph.Chart ")
Set oGraphChart = oShape.OLEFormat.object
oShape.Top = 100
With oGraphChart
.Width= 600
.Height = 400
.Top = 20
.Left = 20
.ChartArea.Font.Size = 8
.Application.Update
.ChartType = 'xlLine '
.HasTitle = True
.ChartTitle.Text = "Sales per Product "
.ChartTitle.Font.Size = 9
.ChartArea.AutoScaleFont = False
'Add data for the chart to the DataSheet in MSGraph.
With .Application.DataSheet.Cells.Clear
'Add the chart row labels.
.Cells(2, 1).Value = "Widgets "
.Cells(3, 1).Value = "Gadgets "
.Cells(4, 1).Value = "Gizmos "


'Add the chart column labels.
.Cells(1, 2).Value = "1999 "
.Cells(1, 3).Value = "2000 "
'Add data to the chart.
Dim r , c
For r = 2 To 4
For c = 2 To 3
.Cells(r, c).Value = Rnd() * 100000
Next
Next
End With
.Application.Update 'Update the changes
.Application.Quit 'and deactivate the chart.
End With
'Clean up.
Set oGraphChart = Nothing
Set oShape = Nothing
Set oDoc = Nothing
Set oWordApp = Nothing

[解决办法]
Dim相当于DELPHI中的VAR
SET相当于:=,剩下的自己看着办吧

读书人网 >.NET

热点推荐