Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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]);
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default C++ and Excel : Need Simple Charting Example (I can populate sheet with Data)

Try searching the knowledge base

http://support.microsoft.com

choose advanced search, then select Visual C++ as product and search on
terms like

Excel Chart

--
Regards,
Tom Ogilvy

"stevo" wrote in message
om...
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]);



  #3   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 found the following article on MSDN.

How To Use MFC to Create a Microsoft Excel Chart
http://support.microsoft.com/default...b;en-us;178783

but is uses #include "excel.h" (for Excel 2002) and I don't have
that .h on my computer (I have full install of VC++ .Net and Excel
2002).

Any Ideas?

Thanks
Stephen




"Tom Ogilvy" wrote in message ...
Try searching the knowledge base

http://support.microsoft.com

choose advanced search, then select Visual C++ as product and search on
terms like

Excel Chart

--
Regards,
Tom Ogilvy

"stevo" wrote in message
om...
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]);

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default C++ and Excel : Need Simple Charting Example (I can populate sheet with Data)

http://support.microsoft.com/default...48&Product=vcc

look at step 9 - it talks about excel.h

does that help?

--
Regards,
Tom Ogilvy


"stevo" wrote in message
om...
I found the following article on MSDN.

How To Use MFC to Create a Microsoft Excel Chart
http://support.microsoft.com/default...b;en-us;178783

but is uses #include "excel.h" (for Excel 2002) and I don't have
that .h on my computer (I have full install of VC++ .Net and Excel
2002).

Any Ideas?

Thanks
Stephen




"Tom Ogilvy" wrote in message

...
Try searching the knowledge base

http://support.microsoft.com

choose advanced search, then select Visual C++ as product and search on
terms like

Excel Chart

--
Regards,
Tom Ogilvy

"stevo" wrote in message
om...
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]);



  #5   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)

Yes, Thanks Tom.








"Tom Ogilvy" wrote in message ...
http://support.microsoft.com/default...48&Product=vcc

look at step 9 - it talks about excel.h

does that help?

--
Regards,
Tom Ogilvy


"stevo" wrote in message
om...
I found the following article on MSDN.

How To Use MFC to Create a Microsoft Excel Chart
http://support.microsoft.com/default...b;en-us;178783

but is uses #include "excel.h" (for Excel 2002) and I don't have
that .h on my computer (I have full install of VC++ .Net and Excel
2002).

Any Ideas?

Thanks
Stephen




"Tom Ogilvy" wrote in message

...
Try searching the knowledge base

http://support.microsoft.com

choose advanced search, then select Visual C++ as product and search on
terms like

Excel Chart

--
Regards,
Tom Ogilvy

"stevo" wrote in message
om...
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]);

Reply
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 04: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 02:48 PM.

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

About Us

"It's about Microsoft Excel"