如何将libreoffice文档保存到流或字节数组

问题描述

在libreoffice中,我想将当前文档保存到流(/字节数组)中,然后上传到服务器。 应该先完成,然后先保存到光盘。

我读了 https://www.codota.com/code/java/methods/com.sun.star.frame.XStorable/storeToURL

并尝试

Dim a_doc
Set a_Doc = ThisComponent
oOutputStream=CreateUnoService("com.sun.star.io.outputstream")
dim props(1) as new com.sun.star.beans.PropertyValue
props(0).Name = "OutputStream"
props(0).Value = oOutputStream
props(1).Name = "FilterName"
props(1).Value = "writer_pdf_Export"
a_doc.storetoURL( "private:stream",props)

但收到错误

消息:SfxBaseModel :: impl_store private:stream失败:0x20d(错误区域:IoClass:Genereal代码:13)

也尝试过

Dim a_doc
Set a_Doc = ThisComponent
oOutputStream=CreateUnoService("com.sun.star.io.SequenceOutputStream")
dim props(1) as new com.sun.star.beans.PropertyValue
props(0).Name = "OutputStream"
props(0).Value = oOutputStream
props(1).Name = "FilterName"
props(1).Value = "writer_pdf_Export"
a_doc.storetoURL( "private:stream",props)
Set Z= oOutputStream.getWrittenBytes()

然后storetoURL命令成功执行,没有错误,但是命令

Set Z= oOutputStream.getWrittenBytes()

错误提出

Type:com.sun.star.io.NotConnectedException

有人知道如何将文档保存到流或字节数组,还是我做错了什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)