setting gridlines in c++?

D

David Lawson

I've been able to cause VC++ 6.0 (no mfc) to create a chart in excel. Eg,

.....

chart->ChartWizard(
(Excel::Range*) range, // source
(long) Excel::xlXYScatter, // Gallery
6L, // Format (1-10)
(long) Excel::xlColumns, // PlotBy
1L, // 1 CategoryLabels
0L, // 0 SeriesLabels
2L,
title,
"Time",
"Value"
);


I can then set the name of the chart with:

chart->Name = "Test Plot";

Now I'd like to turn on the axes major and minor grid lines, but can't figure out the syntax.
I tried this:

chart->Axes(Excel::xlValue, Excel::xlPrimary)->HasMajorGridlines = 1;
but get a compilation error:

\main.cpp(870) : error C2664: 'Axes' : cannot convert parameter 1 from 'enum Excel::XlAxisType' to
'const class _variant_t &'
Reason: cannot convert from 'enum Excel::XlAxisType' to 'const class _variant_t'
No constructor could take the source type, or constructor overload resolution was ambiguous
c:\_flo5\excel\main.cpp(870) : error C2227: left of '->HasMajorGridlines' must point to
class/struct/union


Can someone tell me what the correct way to do this is in C++?

thanks,
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top