Importing selected data to an SDI document from an existing document
Posted on 1998-05-10
I want to import data selectively from an existing SDI document but can't
seem to get the right way to read a second document. Ive tried creating a
new document template and can successfully get the import data, but the
process trashes my existing dialog or view pointers meaning I can't pass the
data back to the calling view (The app is a bit complicated with CDocument
etc all in DLLs).
Can anyone explain why this might happen or alternatively why the following
will not work, it just returns garbage!
Thanks in advance.
CFileDialog dlg(TRUE, "*cit", "*.cit",
"CITS Calc Files (*.cit)|*.cit");
if(dlg.DoModal() == IDOK)
CString pathname = dlg.GetPathName();
// if the file exists then open it and read in the data
if (pathname != "")
CArchive archive(&theFile, CArchive::load);
CCITSDoc* pDoc = new CCITSDoc;
TRACE("Object schema = %d\n", archive.GetObjectSchema());
... pick out the required data from the documment