Board index » delphi » Exel Charting from Delphi

Exel Charting from Delphi

Hi!
Can anybody help me to understand how to execute ChartWizard method for a
Chart object to fill data to embeded chart. I can't make to work a D5
TExelChart component, so i have to do this manualy. A statment

WS:=ExcelApplication1.ActiveSheet as _Worksheet;
 ch := (WS.ChartObjects(EmptyParam, lcid) as ChartObjects).Add(100, 30, 400,
250);

ch.Chart.ChartWizard(WS.Range'A1','B10'],xlLine,emptyParam,xlRows,0,0,True,e
mptyParam,emptyParam,emptyParam,emptyparam,lcid);

compiles correctly, but at runtime force an exeption. What is wrong?

Thank you!

 

Re:Exel Charting from Delphi


<<Dmitry Yakimenkov:

ch.Chart.ChartWizard(WS.Range'A1','B10'],xlLine,emptyParam,xlRows,0,0,
True,
emptyParam,emptyParam,emptyParam,emptyparam,lcid);

 compiles correctly, but at runtime force an exeption.
What is wrong?

Quote

Nothing, as far as I can see - but I get the 'parameter is
incorrect exception' too. However, if you cast Ch to an
OleVariant and remove the lcid parameter, it all works
beautifully:
OleVariant(ch).Chart.ChartWizard(WS.Range'A1','B10'],
        xlLine, emptyParam, xlRows, 0, 0, True,
       emptyParam, emptyParam, emptyParam, emptyparam);

HTH
Deborah Pate

Other Threads