Bonjour Bernard et merci bien pour votre conseil , Je suis desole que je n'ecrire pas bien en Francais . Depuis 20 ans que je ne parle pas et n'ecrire pas en Francais donc je vais ecrirer en Anglais tout de suit.

I couldn't find the class from which I could cast (convert) to unoidl.com.sun.star.ucb.XFileIdentifierConverter as the method you mentioned here is the member of this interface and interface as we know couldn't instantiate with a sub New so it is not possible to invoke the method without a proper casting . So I did the conversion the URL from file path by using String.Replace function it work perfectly and I can save as URL. By doing this the instant of Spreadsheet object still alive and need to close . Actually I don't want to confuse the user with this (they may not aware that the file has been saved programmatically as they still see the document name untitled at the top left Corner) . If possible I would like to get access to SaveFile Dialog of this document and set FileName property as well as File filter so the user just click save as and close the document.
Any suggestion or advise.

Regards
Khammonh

-----Original Message----- From: Bernard Marcelly
Sent: Saturday, November 28, 2015 3:13 AM
To: api@openoffice.apache.org
Subject: Re: XStorable object thrown an exception with error code 283

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


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org

Reply via email to