setting gridline 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
 
A

Amedee Van Gasse

David Lawson shared this with us in microsoft.public.excel:
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

Ooops wrong newsgroup???

--
Amedee Van Gasse using XanaNews 1.17.3.1
If it has an "X" in the name, it must be Linux?

How To Ask Questions The Smart Way

How to Report Bugs Effectively
http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
Only ask questions with yes/no answers if you want "yes" or "no" as the
answer.
http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-n
o-answers.html
 

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