A single document (in the comDoc) sense is a single object residing either in memory or within a single disc file. Into this document you can create any number of files; each of which you give a name (e.g. "file1", "image1",... etc.) and you will then typically end up with a single disc file containing this collection of files.SFSxOI wrote:@srod
When you say "any number of disparate 'files' " - do you mean documents only or files of any type?
Looks good and I can see the your touch of excellance in this product, thank you very much
When you subsequently open one of these documents (with one of comDoc's document creation functions) you can then open any (or all) of the 'files' contained within and access that file just as if it was a disc file all of it's own (which it is not!)
For example, here is one of the demo programs which opens a document which I created in another demo. The document sits in a disc file with the name "test.cmp" and inside this one document I created two files; "file1" in which I wrote 1000 longs and "file2" in which I wrote a couple of utf-8 strings. See how the demo opens the document and then accesses these two files.
Code: Select all
CoInitialize_(0)
XIncludeFile "..\comDoc.pbi"
Define myDoc.comDocDocumentObject, myFile.comDocFileObject
;Open our disc-based compound document.
myDoc = comDoc_OpenDiscDocument("test.cmp")
If myDoc
;Open the first file which we named "file1"
myFile = myDoc\OpenFile("file1")
If myfile
Debug "'file1'..."
;Read all the longs we wrote to this file.
While myfile\Eof() = 0
Debug " " + Str(myFile\ReadLong())
Wend
myFile\Close()
EndIf
Debug "====="
;The second file which we named "file2"
myFile = myDoc\OpenFile("file2")
If myfile
Debug "'file2'..."
;Read all the strings we wrote to this file.
While myfile\Eof() = 0
Debug " " + myFile\ReadString(#PB_UTF8)
Wend
myFile\Close()
EndIf
myDoc\Close()
EndIf

I hope that answers your question?