Click here to Skip to main content
15,896,201 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to convert *.tif to *.bmp? Pin
TooShy2Talk18-Sep-07 23:20
TooShy2Talk18-Sep-07 23:20 
GeneralRe: How to convert *.tif to *.bmp? Pin
KarstenK18-Sep-07 23:42
mveKarstenK18-Sep-07 23:42 
AnswerRe: How to convert *.tif to *.bmp? Pin
Mark Salsbery19-Sep-07 5:48
Mark Salsbery19-Sep-07 5:48 
Questionreading simple excel sheet without using odbc Pin
neha.agarwal2718-Sep-07 21:58
neha.agarwal2718-Sep-07 21:58 
AnswerRe: reading simple excel sheet without using odbc Pin
KarstenK18-Sep-07 22:59
mveKarstenK18-Sep-07 22:59 
GeneralRe: reading simple excel sheet without using odbc Pin
neha.agarwal2718-Sep-07 23:09
neha.agarwal2718-Sep-07 23:09 
GeneralRe: reading simple excel sheet without using odbc Pin
KarstenK18-Sep-07 23:26
mveKarstenK18-Sep-07 23:26 
AnswerRe: reading simple excel sheet without using odbc Pin
Karismatic18-Sep-07 23:07
Karismatic18-Sep-07 23:07 
Using this code you can get the values from xl sheet in the variant variable var.

There are step to use this code: -
1. write the import statements acording to the verision of office u have
for office 2000 they are: -
<br />
#import "Lib\mso9.dll" no_namespace rename("DocumentProperties", "DocumentPropertiesXL") <br />
<br />
#import "Lib\vbe6ext.olb" no_namespace<br />
<br />
#import "Lib\Excel9.olb" \<br />
	rename( "DialogBox", "ExcelDialogBox" ) \<br />
	rename( "RGB", "ExcelRGB" ) \<br />
	rename( "CopyFile", "ExcelCopyFile" ) \<br />
	rename( "ReplaceText", "ExcelReplaceText" ) \<br />
	rename_namespace("EXL")<br />

Best place to add these statements is in stdafx.h

2.Declare these variables: -
<br />
	// excel variables.<br />
	EXL::_ApplicationPtr pEXLApp;<br />
	WorkbooksPtr pEXLBooks;<br />
	_WorkbookPtr pEXLBook;<br />
	WorksheetsPtr pEXLSheets;<br />
	_WorksheetPtr pEXLSheet;<br />

3.
<br />
::CoInitialize(NULL);<br />
try<br />
{<br />
	if(NULL == pEXLApp)<br />
		hResApp = pEXLApp.CreateInstance("Excel.Application");<br />
	else<br />
		hResApp = pEXLApp.GetActiveObject("Excel.Application");<br />
<br />
	pEXLBooks = pEXLApp->GetWorkbooks();<br />
	pEXLBook = pEXLBooks->Open(_bstr_t("Path of the xls file"));<br />
	pEXLSheet = pEXLBook->GetActiveSheet();<br />
<br />
	_variant_t var = pEXLSheet->GetRange("A1")->GetFormulaR1C1();<br />
<br />
	pEXLApp->GetActiveWindow()->Close();<br />
}<br />
catch(_com_error &e)<br />
{<br />
	string strError;<br />
	_bstr_t bstrSource(e.Source());<br />
	_bstr_t bstrDescription(e.Description());<br />
	_bstr_t bstrError(e.Error());<br />
<br />
	_bstr_t err_msg = "Error : " + bstrError + "\nDescription : " + bstrDescription + "\nSource : " + bstrSource;<br />
<br />
	strError = _com_util::ConvertBSTRToString(err_msg);<br />
	AfxMessageBox(strError.c_str());<br />
}


Regards,
Pankaj Sachdeva

"There is no future lies in any job"
"but"
"future lies in the person who holds the job"

QuestionConvert char string to UTF-8 Pin
kcynic18-Sep-07 21:25
kcynic18-Sep-07 21:25 
AnswerRe: Convert char string to UTF-8 Pin
fefe.wyx18-Sep-07 23:13
fefe.wyx18-Sep-07 23:13 
GeneralRe: Convert char string to UTF-8 Pin
kcynic19-Sep-07 15:00
kcynic19-Sep-07 15:00 
AnswerRe: Convert char string to UTF-8 Pin
KarstenK18-Sep-07 23:46
mveKarstenK18-Sep-07 23:46 
QuestionCombo box Max Length Pin
danasegaranea18-Sep-07 21:02
danasegaranea18-Sep-07 21:02 
AnswerRe: Combo box Max Length Pin
nbugalia18-Sep-07 21:13
nbugalia18-Sep-07 21:13 
AnswerRe: Combo box Max Length Pin
Nelek18-Sep-07 21:13
protectorNelek18-Sep-07 21:13 
GeneralRe: Combo box Max Length Pin
danasegaranea19-Sep-07 0:03
danasegaranea19-Sep-07 0:03 
Questiondierect show Pin
amiya das18-Sep-07 20:37
amiya das18-Sep-07 20:37 
QuestionWindow questions Pin
Programm3r18-Sep-07 20:29
Programm3r18-Sep-07 20:29 
QuestionRe: Window questions Pin
Programm3r18-Sep-07 20:49
Programm3r18-Sep-07 20:49 
AnswerRe: Window questions Pin
toxcct18-Sep-07 23:43
toxcct18-Sep-07 23:43 
QuestionRe: Window questions Pin
GauranG Shah19-Sep-07 1:56
GauranG Shah19-Sep-07 1:56 
AnswerRe: Window questions [modified] Pin
toxcct19-Sep-07 2:00
toxcct19-Sep-07 2:00 
QuestionWhat simple API function can i use to read/create some Registry key ? Pin
Yanshof18-Sep-07 20:29
Yanshof18-Sep-07 20:29 
AnswerRe: What simple API function can i use to read/create some Registry key ? Pin
nbugalia18-Sep-07 20:48
nbugalia18-Sep-07 20:48 
AnswerRe: What simple API function can i use to read/create some Registry key ? Pin
Randor 18-Sep-07 20:57
professional Randor 18-Sep-07 20:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.