开发者

Using VB2010 to view an Excel 2003 chart

I am trying to take a chart(on it's own "sheet", not as an object inside of another "sheet"), and display it on a VB2010 windows form.

The only thing I could find was creating the chart using code, and then loading in the data series from excel. ie. Chart1.ChartType = "XYscatter" or something along those lines, and I haven't even gotten that to work right.

I have way to many chart开发者_如何转开发s to go through and manually set them to the way they should be. Is there an easy way to just use Imports Microsoft.Office.Interop to do something along the lines of

Chart1 = xlWorkBook.Charts("MyChart")

?


Your are on the right line, if you have specific questions about creating a chart with code, post what you've got and i'll see if i can help

If you want to display the chart on a .Net form it might be best to take an image of the chart and put that on the form

get a chart object:

Set Chart1 = xlWorkBook.Charts("MyChart")

copy it

Chart1.ChartArea.Copy

its now on the clipboard. you should be able to access from there in .Net as you see fit

To prove its there, you can paste it into a normal excel worksheet

ActiveSheet.PasteSpecial Format:="Picture (Enhanced Metafile)", _
    Link:=False, DisplayAsIcon:=False
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜