![]() |
【转帖】can not get correct data from oddbole2frame1
can not get correct data from oddbole2frame!
can not get correct data from oddbole2frame! oddbole2frameptr oleentity =(oddbole2frameptr)pmsent; odstreambufptr pfile = odmemorystream::createnew(); oleentity->getcompounddocument(*pfile); pfile->rewind(); int len =pfile->length(); byte *arr =new byte[len]; pfile->getbytes((void *)arr,len); pfile->rewind(); crectitem *ole =(crectitem *)createole(); char temp_file[128]; gettemppath(128,temp_file); strcat(temp_file,"acmilan.txt"); ole->release(); cfile file; file.open(temp_file,cfile::modecreate|cfile::moder eadwrite|cfile::sharedenynone); file.write(arr,len); file.flush(); file.seektobegin(); carchive archive(&file, carchive::load); archive.m_pdocument = g_ole_doc; ole->serialize(archive);fff">//occur error here file.close(); attached files and what is crectitem ??? crectitem inherit coleclientitem... crectitem inherits coleclientitem,such as class crectitem : public coleclientitem { ...... }. i'm sure that class crectitem has no problem.because the code as follow is ok. oddbole2frameptr oleentity =(oddbole2frameptr)pmsent; { crectitem *ole =(crectitem *)createole(); cfile file0; file0.open("c:\\acmilan1.txt",cfile::modereadwrite |cfile::sharedenynone); file0.flush(); file0.seektobegin(); carchive archive(&file, carchive::load); archive.m_pdocument = g_ole_doc; ole->serialize(archive);fff">//every is ok.ole entity can display correctly. file.close(); } attention to the difference between acmilan1.txt and acmilan.txt. i found that only the heads of the two files are different. how can i get data such as acmilan1.txt ,but not acmilan.txt . thanks a lot. attached files (20.0 kb, 4 views) (24.9 kb, 3 views) hi, now i see! replace oleentity->getcompounddocument(*pfile); with oleentity->itemhandler()->save(*pfile); to get data that you want. now every is ok. thanks very much! |
所有的时间均为北京时间。 现在的时间是 03:23 AM. |