Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

openoffice Basic

  • 15-06-2007 1:20pm
    #1
    Registered Users, Registered Users 2 Posts: 811 ✭✭✭


    I have a script which converts openoffice sxw files to Microsoft word documents

    it works great until I came a cross a file name that has , in it
    example mary , june
    any Ideas how I could fix this


    Sub SaveAsDoc( cFile )

    cURL = ConvertToURL( cfile )

    ' MsgBox(nfile)
    ' msgbox(cURL)


    oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, (_
    Array(MakePropertyValue( "Hidden", True ),))


    cFile = Left( nFile, Len( cFile ) - 4 ) + ".doc"
    cURL = ConvertToURL( cFile )

    oDoc.storeToURL( cURL, Array(_
    MakePropertyValue( "FilterName", "MS Word 97" ),)
    oDoc.close( True )

    End Sub


Comments

  • Moderators, Politics Moderators Posts: 41,248 Mod ✭✭✭✭Seth Brundle


    Can you replace it with the Chr version of it or something like that?


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    At what line is the code falling over?


  • Registered Users, Registered Users 2 Posts: 811 ✭✭✭Rambo


    kbannon wrote:
    Can you replace it with the Chr version of it or something like that?

    sorry could you explain chr version meanig to change cfile to a string


  • Registered Users, Registered Users 2 Posts: 811 ✭✭✭Rambo


    Evil Phil wrote:
    At what line is the code falling over?

    example filename mary , june.sxw

    the variable cfile pulls the filename in as mary and leave out the rest
    cURL = ConvertToURL( cfile )


  • Moderators, Politics Moderators Posts: 41,248 Mod ✭✭✭✭Seth Brundle


    I was referring to replacing the comma with the Chr version of it.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 811 ✭✭✭Rambo


    kbannon wrote:
    I was referring to replacing the comma with the Chr version of it.

    ok here what I amd doing
    I have a file list

    1.swx
    2.swx
    3.swx
    mary,june.sxw
    10.swx
    in a file called filelist.txt
    I then run this which is in a batch file
    FOR /F "usebackq delims==;" %%G IN (filelist.txt) DO "C:\Program Files\OpenOffice.org 2.2\program\soffice" -invisible macro:///Standard.module1.SaveAsDoc("%%G")

    which is a macro is openoffice

    and this converts file from 1.swx to 1.doc
    work ok
    until the macro reaches the file called mary , june.swx then stops because of bad filename

    changing chr will not work in this case


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 93,604 Mod ✭✭✭✭Capt'n Midnight


    Are you sure it's not the space rather than the comma ?

    yeah you don't have a space in the delims and I take you've checked that the FOR list gives the full file name ?

    if all else fails then you could use the short version of the file name and then rename the doc to the long version - not pretty but it will work


  • Registered Users, Registered Users 2 Posts: 811 ✭✭✭Rambo


    Are you sure it's not the space rather than the comma ?

    yeah you don't have a space in the delims and I take you've checked that the FOR list gives the full file name ?

    if all else fails then you could use the short version of the file name and then rename the doc to the long version - not pretty but it will work

    ok tried it with out a space it does now work at all
    I have also tested this batch file
    "C:\Program Files\OpenOffice.org 2.2\program\soffice.bin" -invisible macro:///Standard.module1.SaveAsDoc(%1)

    convert.bat mary , june.swx

    I can see the full name has gone into SaveAsDoc(%1) on the command line

    but when the macro run it it only has the first name of the file

    how do you do a listing of short filenames using the dir command
    thanks


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    dir /X will display both short and long filenames. The short names are in the column before the long.

    dir /? will display all the options for dir.
    ok tried it with out a space it does now work at all
    Sorry, you've a bit of a typo there. Is that 'does not work at all' or 'does now work'? :o


  • Registered Users, Registered Users 2 Posts: 811 ✭✭✭Rambo


    Ok for F** sake this has being bug in openoffice for over a year now
    so much for open source

    http://www.xml.com/cs/user/view/cs_msg/3372


  • Advertisement
Advertisement