Hi,
An URL is not a Windows address preceded by "file:///".
Even if you change \ into / it may still be incorrect, depending on the
characters in the path.
Example:
C:\Docs OpenOffice\Report_20151127
URL : file:///C:/Docs%20OpenOffice/Report_20151127
You can convert a system address into an URL with method
getFileURLFromSystemPath() of service com.sun.star.ucb.FileContentProvider
If the argument Filter is absent, you provide a null object. This is not
incorrect, you must provide at least an empty array.
The Overwrite option is True by default, so you don't need it.
Bernard
khammonh a écrit le 2015-11-27 10:18 :
Hi there
I have some problem when implementing Interface XStorable of
unoidl.com.sun.star.frame class .
I developed my own Library base on SDK here are method body of SaveDocAs and
SaveDocToFile
Public Sub SaveDocAs(ByVal FileName As String, Optional ByVal Filter As
SpreadSheetFileFilter = SpreadSheetFileFilter.MS_Excel_97)
Dim Store As XStorable
Dim Prop() As PropertyValue = {New PropertyValue, New PropertyValue}
'Dim MyUrl As String = FileName
Dim MyUrl As String = "file:///" + FileName
Store = CType(m_mxDocument, XStorable)
If Filter = SpreadSheetFileFilter.DefaultOpenOffice Then
Prop = Nothing
Else
Prop(0).Name = "FilterName"
Prop(0).Value = New uno.Any(ParserFilter(Filter))
Prop(1).Name = "Overwrite"
Prop(1).Value = New uno.Any(True)
End If
Store.storeAsURL(MyUrl, Prop)
End Sub
Public Sub SaveDocToFile(ByVal FileName As String, Optional ByVal Filter As
SpreadSheetFileFilter = SpreadSheetFileFilter.MS_Excel_97)
Dim Store As XStorable
Dim Prop() As PropertyValue = {New PropertyValue, New PropertyValue}
Dim MyUrl As String = "file:///" + FileName
Store = CType(m_mxDocument, XStorable)
Prop(0).Name = "FilterName"
Prop(0).Value = New uno.Any(ParserFilter(Filter))
Prop(1).Name = "Overwrite"
Prop(1).Value = New uno.Any(True)
Store.storeToURL(MyUrl, Prop)
End Sub
when invoke this method on client application with the code fragment bellow
ExcelAttach = ExcelRoot & "\" & "Report_" &
ReportDate.ToShortDateString
OO.SaveDocToFile(ExcelAttach,
OOClass.SpreadSheetHelper.SpreadSheetFileFilter.MS_Excel_97)
where ExcelAttach is a file path
I got an exception with error code 283
Actually the document is opened by the app from a template file then the app
filled the sheets with content and need to save this file with above mentioned
method.
If I could set file location and filter of Document SaveFile dialog it would be
more easy then use these 2 methods . But I don’t know how to interact with
SaveFile dialog of OpenOffice .
Please if any body can help me.
Thank in advance.
Regards
Khammonh
---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org