Hi,
I’m looking into ways to save a binary file to disk with a macro. I’ve played with arrays and streams but the file is really big and it is quite painful to have to use an array of Bytes representing the full file to the save it to disk with streams.
Is there any way to embed the file into the calc document (like an image for example) and then have it saved to disk. For now here’s what I’ve done with an array of bytes and DataOutputStream:
Sub Exploit()
Dim oSFA As Object, oOutText As Object
Dim FileURL As String
oSFA = createUNOService("com.sun.star.ucb.SimpleFileAccess")
FileURL = ConvertToURL("/tmp/truff")
oOutText = createUNOService("com.sun.star.io.DataOutputStream")
oOutText.setOutputStream(oSFA.openFileWrite(FileURL))
oOutText.writeByte(144)
oOutText.flush
End Sub
Thanks in advance !