Hi,
I solved using the technique explained from Mikhail Voitenko in this old post:
http://api.openoffice.org/servlets/ReadMsg?listName=dev&msgNo=13383
Thank you
Paolo Mantovani
Alle 20:26, venerdì 24 novembre 2006, Paolo Mantovani ha scritto:
> Hi,
>
> me again, about zip packages...
> Thanks to help from Kai Sommerfeld I was able to read any contents into a
> zip file
>
> Now I'm trying to *write* contents, but again :-( without any luke
> Please see my test code below
> Notice that if I try with a regular file URL the code works perfectly and I
> can modify or delete the file.
>
> Any help will be appreciated
> Paolo M
>
>
> REM ***** BASIC *****
>
> Sub WriteManifestTest
>
> oSM = GetProcessServiceManager()
> oUCB = oSM.createInstanceWithArguments( _
> "com.sun.star.ucb.UniversalContentBroker", Array("Local","Office"))
>
> sUrl = "file:///home/paolo/Library1.uno.pkg"
> sUrl = _
> "vnd.sun.star.zip://" & Join(Split(sUrl, "/"), "%2F")
> & "/META-INF/manifest.xml"
>
> 'sUrl = "file:///home/paolo/manifest.xml" '<---this works
> oID = oUCB.createContentIdentifier(sUrl)
> oProvider = oUCB.queryContentProvider(sUrl)
> oContent = oProvider.queryContent(oID)
>
> 'now write the manifest with empty data
> oMySinc = CreateUnoService("com.sun.star.io.Pipe")
> oWriter = CreateUnoService("com.sun.star.packages.manifest.ManifestWriter")
> oWriter.writeManifestSequence(oMySinc, array())
>
> Dim aArg1 As New com.sun.star.ucb.InsertCommandArgument
> aArg1.ReplaceExisting = True
> aArg1.Data = oMySinc
> UcbExecuteCommand(oContent, "insert", aArg1)
>
> 'UcbExecuteCommand(oContent, "delete", True)
>
> End Sub
>
>
> Function UcbExecuteCommand(oContent As Object, _
> sCommandName As String, aArgument As Variant) As Variant
>
> ' Assemble command to execute.
> Dim aCommand As New com.sun.star.ucb.Command
> aCommand.Name = sCommandName
> aCommand.Handle = -1 ' not available
> aCommand.Argument = aArgument
>
> ' Note: throws CommandAbortedException and Exception since
> ' we pass null for the XCommandEnvironment parameter
> UcbExecuteCommand = oContent.execute(aCommand, 0, Null)
>
> End Function
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]