SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Aug 2009
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ActiveX - Save Excel Workbook to Network

    Hi Chaps,

    I have an ActiveX Javascript function, that pulls data from an HTML table and then populates an Excel Workbook.

    This works OK, but I need to save the workbook to a network path.

    I have sucessfully saved it locally:

    Code:
    // Save the Excel Workbook
    xlBook.SaveAs("C:\\TEST.XLSX");
    But this does not:

    Code:
    // Save the Excel Workbook
    xlBook.SaveAs("\\\Server\\Projects\\TEST.XLSX");
    When attempting this, I get this error:
    SaveAs method of Workbook class failed
    Which refers to the above.

    I have tried different variations, but with little sucess (sometimes the path will default to the Server's 'My Documents'/'User Shared' folder, with the filename:
    ServerProjectsTEST.XLSX
    Anyone know where I'm going wrong?

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Shot in the dark here, but perhaps you have to map the server to a drive letter?

    Are you sure you don't need login credentials to access that server?

    Do you have write access?

    It could also be some ActiveX feature that only allows it to interact with the local computer.

    Again, I'm just guessing possibilities here. Maybe they'll help.

  3. #3
    SitePoint Addict
    Join Date
    Aug 2009
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Uhh, I have tried to map the path to a drive letter with no luck . . .

    Write access shouldn't be a problem, with PHP I can create/edit/remove directories and files, so don't see a problem with that.

    The ActiveX feature can save the file to the server:
    sometimes the path will default to the Server's 'My Documents'/'User Shared' folder
    Just not in the place I told it to:
    I say:
    \\\Server\\Projects\\TEST.XLSX
    It does:
    \\\Server\\User Shared\\ServerProjectsTEST.XLSX
    Mental?!

  4. #4
    Learning...
    Join Date
    Jan 2003
    Posts
    779
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is this from client to server? In this case you'll need to upload it. PHP is working without any problem because it is executing on the server.
    The beauty of life is not dependent on how happy you are,
    but on how happy others can be because of you...

  5. #5
    SitePoint Addict
    Join Date
    Aug 2009
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    technically yes, this is an internal application, specifically for company employees. do you think i'd need to save a local copy first, then copy/upload the file to the server location? i can then delete the local copy so the user is none-the-wiser?

  6. #6
    Learning...
    Join Date
    Jan 2003
    Posts
    779
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why are you building this on the client? Javascript will not let you save or delete a file on the users local hard drive.

    http://in.answers.yahoo.com/question...5131419AAoieLo

    However from the server side you can build the file and then push it as a download. If you are building the information on the client, then put it in some hidden field and post it to the server. All you have to do is set up proper headers and then write the content to the client. I believe it is echo in php.

    I googled 'php creating excel file' and came up with tons of examples. The following link has information that may be of help to you.
    http://www.appservnetwork.com/module...=article&sid=8
    The beauty of life is not dependent on how happy you are,
    but on how happy others can be because of you...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •