try it, then you know it____________just do it , as love easily fade.

一次只有一个目标,步子迈小些,抑制一次实现所有功能的冲动。 过程如何结果就如何,行动是欢喜的,不管是兴奋还是沮丧的情绪都对结果无益。贵在持之以恒

导航

VC++ excel date handle

1,use a VARIANT type to read dates of  the worksheet sheet1

Range objRange;

VARIANT   vaRead;

objRange = sheet1.GetUsedRange();  //get all dates in the table

vaRead = objRange.GetValue();

others :

uchar cell1[NUM] = " ";

uchar cell2[NUM] = " ";

sprintf(cell1, "C1");

sprintf(cell2, "F%u",ucValue);

objRange =  sheet1.GetRange( COleVariant( (CString) cell1), COleVariant( (CString) cell2) )//from C1 to F.

//the above one can in try structure,failing handle

2,build a stray,to access the dates

COleVariant  av(vaRead);

long index[2];

VARIANT vaBuffer;

index[0] = 1;

index[1] = 1;

av.GetElement(index,vaBuffer);  //read the cell at row 1, column 1

for the variant date read above,

fist check the type, use switch or if structure,

than deal with the value

posted on 2013-12-10 18:37  吾一  阅读(218)  评论(0编辑  收藏  举报