Just like before I couldn't get ChartWizard to work.
In the example I attached above, I was able to do it by creating the chart manually.
Sorry.
Verere testudinem! (Fear the turtle)
Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. -Cicero
So there's no way to modify the chart charachteristics? the tittles, spaces between the grapchic lines.., if you know any way to do it i'll thank you very much.
And I can use with no compilation and execution problems the next line:
But theres no result, and as i can execute the autowrap with "chartwizard" I supose that there must be a way to use it.., with more variables or any thing, but if it's posible to execute the "ChartWizard" Dispatch_Method, I think that there's a way to do it.
Last edited by minagu; October 2nd, 2006 at 04:39 AM.
In this long and tedious example I open a save worksheet called "junk.xls" which already has my x and y data in columns A and B. I create the chart using the chart wizard and then set the chart type, title, and grid line spacing on the x axis.
This worked for me in Visual C++ 6.0 using Excel 2000.
Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. -Cicero
In this second example I was able to get ChartWizard to work. However, I had to put the arguments in in reverse order. Probably something wrong with my Autowrap function. The entire program follows. I still had to set the chart gallery independently. I've found problems before with using gallery type 75 in the chartwizard when using a MFC version of all this.
Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. -Cicero
Thank you very much Tom, it does work it! and I've tested the ChartWizard with the arguments in the reverse order, and it's ok, that was the problem, and this is because I needed to put my range var as the first parameter. And after that I've only had to change the Axes lVal=1 to lVal=2 to specify the major units for the axis y. Thank you.
Two partial examples:
In the first part I hide the gridlines. In the second part, I hide a column.
To hide a cell you would set the font color to white. Otherwise you would have to hide whole rows or whole columns.
To do this you would have to select the range, Get the font of the range
and then set the font color to white (if your background is white.
Probably best to protect those cells so noone can edit them
To include an image I generally copy the image to the clipboard, select a cell to position it and then paste the image. You can adjust the positioning of the image after this programmatically.
I include an example of pasting the graphic using MFC. You can translate it to the without MFC version.
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
OpenClipboard(); // Reserve clipboard for this program
EmptyClipboard();
CBitmap MyBitmap;
MyBitmap.LoadBitmap(IDB_BITMAP1); // A Bitmap you drew in the
// Resource Editor
HBITMAP MyBitmapHandle = (HBITMAP)MyBitmap; // Cast it to a HBITMAP
SetClipboardData(CF_BITMAP, MyBitmapHandle);
CloseClipboard();
app.SetVisible(TRUE);
app.SetUserControl(TRUE);
sheet.Activate();
range = sheet.GetRange(COleVariant("A1"), COleVariant("a1"));
range.Select();
sheet.Paste(covOptional, covOptional);
Last edited by Tom Frohman; November 14th, 2006 at 07:29 AM.
Verere testudinem! (Fear the turtle)
Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. -Cicero
Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. -Cicero
Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. -Cicero
thanks, the problem is that i'm having some problems (error which stops the program) with the "CoUninitialize()" function, called when i delete the Excel class, and i don`t know if there's another way of do the delete of the Excel process diferent of CoUninitialize. If you know some way i'll be pleased to read you.
Hi Tom,
Thanks.
I am trying Excel automation. My problem is formatting excel cells;
I cant give font properties (bold,italic,underline, size, type) and
cell format (is cell currency,text,time,date..) and number of digit after decimal.
If you know some way i'll be pleased to read you.
If you are using the non-MFC methods of this thread you
would set the NumberFormat Property of the range class to "0.000" to
get three digits after the decimal.
A MFC version:
Range range;
range=sheet.GetRange(COleVariant("A1","A1"));
range.SetNumberFormat(COleVariant("0.000"));
You would get the dispatch of the Font from the Range
and then set the Name, Bold, Underline, etc properties of the Font class.
Font font;
font=range.GetFont();
font.SetBold(covTrue);
font.SetSize(COleVariant("12"));
font.SetUnderline(COleVariant(2L));
font.SetUnderline(COleVariant(-4142L)) to unset the underline.
Of course with the non-MFC method this would be a little more involved.
I'm feeling lazy this morning or I'd write down a couple of examples.
Maybe I'll do that in a couple of hours when I have time.
Tom
Verere testudinem! (Fear the turtle)
Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. -Cicero
Bookmarks