Issue 97823 - StoreToUrl error 1001 automation bridge when saving document
Summary: StoreToUrl error 1001 automation bridge when saving document
Status: CLOSED IRREPRODUCIBLE
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: OOO300m9
Hardware: All Windows XP
: P3 Trivial with 4 votes (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: needmoreinfo
Depends on:
Blocks:
 
Reported: 2009-01-07 10:38 UTC by forwarn
Modified: 2017-05-20 10:01 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description forwarn 2009-01-07 10:38:32 UTC
Code which worked in all previous OO 2.3 and earlier versions now fails in OO 
3.0.0 Build 9358.
The code fails in both VB and Foxpro.

Can create a document through code and save OK. However if an existing document 
is opened (either a Writer document or Calc) and it is modified and then saved -
 you get the error - OLE I Dsipatch exception code 1001 from [automation 
bridge] com.sun.star.task.ErrorCodeIOException: ..

Here is the code in VB -

  Try
    oDesk = oSM.CreateInstance("com.sun.star.frame.Desktop")

    Catch ex As Exception
                Throw New Exception("Could not create OpenOffice service" & 
vbCrLf & ex.ToString())
    End Try

'Set the parameters for opening the file
   Dim OpenParams(1)
   OpenParams(0) = OOoPropertyValue(oSM, "Hidden", True)
   OpenParams(1) = OOoPropertyValue(oSM, "OverWrite", True)

'Document name
Dim cURL
   cURL = "file://///Fw1/homedrives/dswift/My Documents/Work Folder/Word 
Processing/Filing/Test Letter.odt"

       Try
           oDoc = oDesk.loadcomponentFromURL(cURL, "_blank", 0, OpenParams)
      Catch ex As Exception
                Throw New Exception("Could not open " & cURL & vbCrLf & 
ex.ToString())
       End Try

'Write back the Title, Keyword and Comments
   oDoc.DocumentInfo.Title = "The Title"
   oDoc.DocumentInfo.Keywords = "The keyword"
   oDoc.DocumentInfo.Description = "The Description"

            'Set the parameters for saving the file
            Dim SaveParams(1)

            SaveParams(0) = OOoPropertyValue(oSM, "Hidden", True)
            SaveParams(1) = OOoPropertyValue(oSM, "OverWrite", True)


            oDoc.storeToUrl(cURL, SaveParams)  '---------------------This line 
fails with error code 1001

            oDoc.close(True)
            oDoc = Nothing

    Public Function OOoPropertyValue(ByRef objServiceMgr As Object, ByVal cName 
As Object, ByVal uValue As Object) As Object
        Dim oPropertyValue As Object
        ' not sure where I found this, but it does the trick!
        oPropertyValue = objServiceMgr.Bridge_GetStruct
("com.sun.star.beans.PropertyValue")
        oPropertyValue.Name = cName
        oPropertyValue.Value = uValue
        Return oPropertyValue
    End Function
Comment 1 Olaf Felka 2009-05-15 09:26:17 UTC
@ jsk: Something for you?
Comment 2 hans_werner67 2011-03-28 11:53:35 UTC
Assign to new default-assignee
Comment 3 gregfox1 2011-07-22 05:23:16 UTC
(In reply to comment #2)
> Assign to new default-assignee

To fma.
I am using OO 3.0.0 and VB5 and have this problem.
I am not sure which parts of the code below to use and some of it is not recognised.
Can you give me some assistance?
From snookered
Comment 4 Edwin Sharp 2014-01-24 12:15:13 UTC
Please attach example.
Comment 5 Edwin Sharp 2014-02-11 11:30:13 UTC
No info from author.