Hi,
Giuseppe Castagno ha scritto:
[...]
In this first example, I can access the whole document storage,
creating a storage object starting from the document URL.
[...]
In the second example I'll use the XStorageBaseDocument to retrieve
the document storage, here it goes.
[...]
With the above code I got the following (wrong!) document package
structure:
[...]
Besides I got the following exception:
[...]
I tried to reproduce the problem.
I've prepared a sample document (Calc) with some OLE object embedded.
and some starbasic macros to reproduce the problem:
(I can provide the document if needed)
The code tries to access to the document storage a first time using the
com.sun.star.embed.StorageFactory and the document URL
and a second time using the XStorageBaseDocument of the document itself
As Giuseppe reported, using the second method causes IO errors
Below the Starbasic code I've used (
In attachment the two log files
Ciao
Paolo M
-------------------------------------
REM ***** BASIC *****
Dim mLog()
Sub Main
Globalscope.BasicLibraries.loadLibrary("Tools")
oStorageFactory = CreateUnoService("com.sun.star.embed.StorageFactory")
sURL = "file:///home/paolo/test.ods"
iMode = com.sun.star.embed.ElementModes.READ
ReDim mLog()
oMyStorage =
oStorageFactory.createInstanceWithArguments(Array(sURL, iMode))
AppendItem(mLog(), "oMyStorage =
oStorageFactory.createInstanceWithArguments(Array(sURL, iMode))" )
FillElementList(oMyStorage, "")
SaveDataToFile("file:///home/paolo/log.txt", mLog())
ReDim mLog()
oMyStorage = ThisComponent.getDocumentStorage()
AppendItem(mLog(), "oMyStorage = ThisComponent.getDocumentStorage()" )
FillElementList(oMyStorage, "")
SaveDataToFile("file:///home/paolo/log1.txt", mLog())
End Sub
Sub FillElementList(oStorage, sPath)
on Error goto ErrH
AppendItem(mLog(), sPath & "/" )
For Each sElemName In oStorage.ElementNames()
If oStorage.isStorageElement(sElemName) Then
oElem = oStorage.openStorageElement(sElemName,
com.sun.star.embed.ElementModes.READ)
FillElementList(oElem, sPath & "/" & sElemName)
GoAhead:
Else
AppendItem(mLog(), sPath & "/" & sElemName)
End If
Next
Exit Sub
ErrH:
AppendItem(mLog(), "openStorageElement :" & sElemName & " - " & Error$ )
Resume GoAhead
End Sub
Sub AppendItem(mList(), vItem)
Dim iMax As Long
iMax = UBound(mList())
iMax = iMax + 1
Redim Preserve mList(iMax)
mList(iMax) = vItem
End Sub
oMyStorage = oStorageFactory.createInstanceWithArguments(Array(sURL, iMode))
/
/Configurations2/
/Configurations2/statusbar/
/Configurations2/accelerator/
/Configurations2/accelerator/current.xml
/Configurations2/floater/
/Configurations2/popupmenu/
/Configurations2/progressbar/
/Configurations2/menubar/
/Configurations2/toolbar/
/Configurations2/images/
/Configurations2/images/Bitmaps/
/META-INF/
/arbitrarycontent/
/arbitrarycontent/alienfile.txt
/ObjectReplacements/
/ObjectReplacements/Object 1
/ObjectReplacements/Object 2
/ObjectReplacements/Object 3
/content.xml
/Basic/
/Basic/Standard/
/Basic/Standard/Module1.xml
/Basic/Standard/script-lb.xml
/Basic/script-lc.xml
/styles.xml
/Object 1/
/Object 1/content.xml
/Object 1/styles.xml
/Object 1/meta.xml
/Object 2/
/Object 2/content.xml
/Object 2/styles.xml
/Object 2/meta.xml
/Object 3/
/Object 3/content.xml
/Object 3/styles.xml
/Object 3/meta.xml
/meta.xml
/Thumbnails/
/Thumbnails/thumbnail.png
/settings.xml
oMyStorage = ThisComponent.getDocumentStorage()
/
openStorageElement :Configurations2 - Si è verificata un'eccezione
Type: com.sun.star.io.IOException
Message: .
/META-INF/
/arbitrarycontent/
/arbitrarycontent/alienfile.txt
/ObjectReplacements/
/ObjectReplacements/Object 1
/ObjectReplacements/Object 2
/ObjectReplacements/Object 3
/content.xml
/Basic/
/Basic/Standard/
/Basic/Standard/Module1.xml
/Basic/Standard/script-lb.xml
/Basic/script-lc.xml
/styles.xml
openStorageElement :Object 1 - Si è verificata un'eccezione
Type: com.sun.star.io.IOException
Message: .
openStorageElement :Object 2 - Si è verificata un'eccezione
Type: com.sun.star.io.IOException
Message: .
openStorageElement :Object 3 - Si è verificata un'eccezione
Type: com.sun.star.io.IOException
Message: .
/meta.xml
/Thumbnails/
/Thumbnails/thumbnail.png
/settings.xml
/Dialogs/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org