Page 1 of 1

[Solved] Assign Existing FileName Instead of private:factory

Posted: Mon Nov 11, 2019 10:48 am
by npandit
I have merged the Saving data to calc code with my exisiting code.However while saving the file in my exisitng code i have written as Save(XMLFilename) XMLFilename will be used and assigned everywhere in the project
But with Open Office i tried oDoc = oDesk.loadComponentFromURL(XMlfilename", "_blank", 0, arg) But it is giving error and this line
oDoc = oDesk.loadComponentFromURL("private:factory/scalc", "_blank", 0, arg)
Opens a new File always .I jus want it to ASSIGN IT with xmlfilename
Like Border,Image should be stored in the file whichever user selects and load that is XMLFilename
Can anybody suggest how to do this?

Re: Assign Existing FileName Instead of private:factory/sca

Posted: Mon Nov 11, 2019 5:03 pm
by JeJe
oDoc = oDesk.loadComponentFromURL(XMlfilename", "_blank", 0, arg)

You have a " at the end of XMlfilename which shouldn't be there

Edit: assuming XMlfilename is a variable. If its a string you need another " in front of it. Make sure the path is a URL.

Re: Assign Existing FileName Instead of private:factory/sca

Posted: Tue Nov 12, 2019 6:37 am
by npandit
I did try putting " before XMLFilename but it gives error
Also the XMLFilename is normal path not a URL
What to do?

Re: Assign Existing FileName Instead of private:factory/sca

Posted: Tue Nov 12, 2019 6:50 am
by FJCC
There is a convertToURL() function you can use to make a URL

Code: Select all

XMLurl = convertToURL(XMlfilename)
oDoc = oDesk.loadComponentFromURL(XMLurl, "_blank", 0, arg)
A couple of questions:
1. Is the variable really XMlfilename and not XMLfilename?
2. How is arg defined? If you just need an empty array as the last parameter of loadComponentFromURL(), you can use Array().

Code: Select all

oDoc = oDesk.loadComponentFromURL(XMLurl, "_blank", 0, Array())

Re: Assign Existing FileName Instead of private:factory/sca

Posted: Tue Nov 19, 2019 8:24 am
by npandit
Thank you all for the help
I used this line :
oDoc = oDesk.loadComponentFromURL("file:///" & XMLFilename.Replace("\", "/"), "_default", 0, arg)
and it worked
It now opens an existing file