LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default C++ and Excel : Need Simple Charting Example (I can populate sheet with Data)

I am using Microsoft Viusal C++ .Net (unmanaged MFC Application)
and Excel 2002.

I have been able to create and Excel worksheet and fill it with data
from my C++ program. However, I can't figure out how to create a
chart.

I can't find enough documentation on CChart to figure out how to
create a chart.

Can someone show me a simply example or point me to the right
literature?

Thanks
Stephen

Below is my code that creates the excel sheet and populates it with
data:

CApplication oExcel;
CWorkbook oBook;
CWorkbooks oBooks;
CWorksheets oSheets;
CWorksheet oSheet;
CRange oRange;
CChart oChart;
COleVariant covOptional(DISP_E_PARAMNOTFOUND,VT_ERROR);
oExcel.CreateDispatch("Excel.Application");

oBooks = oExcel.get_Workbooks();
oBook = oBooks.Add(covOptional);
oSheets = oBook.get_Worksheets();
oSheet = oSheets.get_Item(COleVariant((short)1));
oChart = oBook.get_Charts();
oExcel.put_Visible(TRUE);
oExcel.put_UserControl(TRUE);


COleSafeArray saRet;
COleSafeArray saDateTime;
COleSafeArray saPhaseAdjustmentAngles;


DWORD numElements[2];
numElements[0] = NumberOfCallIns;
numElements[1] = NumberOfCallIns;


// Get a range of data.
oRange = oSheet.get_Range(COleVariant("C13"),covOptional);
oRange = oRange.get_Resize(COleVariant((short)NumberOfCallI ns),COleVariant((short)24));
saRet.Create(VT_R8,2,numElements);


long index[2];
for (int iRow = 1; iRow < NumberOfCallIns; iRow++) {
for (int iCol = 1; iCol <= 24; iCol++) {
index[0]=iRow-1;
index[1]=iCol-1;
outBug << iRow << "\t" << iCol << endl;


saRet.PutElement(index,&StoreValuesForOutput[iCol][iRow]);
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to populate data from different sheet. Joe Spindola Excel Discussion (Misc queries) 1 May 11th 10 04:04 AM
Need conditional data from 1 sheet to populate another sheet cjtnoobexceller Excel Worksheet Functions 3 April 24th 08 10:45 PM
Populate order sheet with data from work sheet Veronica Johnson Excel Worksheet Functions 4 January 22nd 08 03:29 AM
Best way to extract data on one sheet & populate it on another sheet?????? WebWizard97 Excel Programming 1 September 25th 03 08:50 PM
retrieve data from SQL server and populate excel sheet susie Excel Programming 0 July 11th 03 10:07 PM


All times are GMT +1. The time now is 08:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"