Get a Jumpstart with our Sample Apps
Results 1 to 9 of 9

Thread: Office::ExcelDocument ?

  1. #1
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,182

    Default Office::ExcelDocument ?

    Example (made in v11 /3381):
    Code:
    dim Doc as Office::ExcelDocument
    dim Sheet as Office::Spreadsheet
    Sheet=Doc.AddSheet("Sheet1")
    Sheet.Write(1,1, "Hello word")
    doc.Save(""C:\...................\test.xlsx"  )
    delete doc
    Works fine..up to a point.
    Open the Excel file and change anything and save it then try to access it again via the same pointer. Won't work.
    ?

  2. #2
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Office::ExcelDocument ?

    you should open the existing file then the sheet then add the content then it should work.
    for example
    your xlsx file is gandhi.xlsx in c:\temp directory
    Code:
    dim doc as Office::ExcelDocument
    dim Sheet as Office::SpreadSheet
    dim filename as c = "c:\temp\gandhi.xlsx"
    if doc.load(filename) then
       if doc.find(Sheet, "sheet1") then
       sheet.write(some_row, some_col, "some_content")
       doc.save(filename)
      end if
    end if
    delete doc
    should work
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  3. #3
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,182

    Default Re: Office::ExcelDocument ?

    Thanks gandhi, but it doesn't work.
    Are you using the same version?

  4. #4
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Office::ExcelDocument ?

    see my signature.
    can you post your steps so that i can test it.

    edit: when i tested i tested without manipulating the document with excel, now i did. yes, you are absolutely correct. the document did not change.
    i will take a look again later.
    Last edited by GGandhi; 12-25-2017 at 08:54 AM.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  5. #5
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Office::ExcelDocument ?

    Code:
    dim doc as Office::Excel2003Document
    dim Sheet as Office::SpreadSheet
    dim filename as c = "c:\temp\gandhi.xls"
    if doc.load(filename) then
       if doc.findsheet(Sheet, "sheet1") then
       sheet.write(some_row, some_col, "some_content")
       doc.save(filename)
      end if
    end if
    delete doc
    here is the follow up.
    i went to properties of the excel file .xls changed permission to allow all to users.
    then reran the code and it seems to work. even after working with excel in between.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  6. #6
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,182

    Default Re: Office::ExcelDocument ?

    Thanks Govindan (Hope I got right this this time! sorry about that)

    Not working!
    If you start a whole new workbook with a script from alpha, the new one will work fine up until you open it and make any changes and ave it.
    I figured it's got be one of two things (assuming it works for others):
    Either my version of alpha, or
    The format that the script saves the workbook in might be different (though they both have the same extension xlsx).
    Not sure yet.

  7. #7
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,698

    Default Re: Office::ExcelDocument ?

    There appears to be an issue with (at least) Excel 2013 saved spreadsheets in Alpha V11.

    Code:
    dim doc as Office::ExcelDocument
    ? doc.Load("F:\Book1 2007.xlsx") 'file created in Excel 2007
    = .T.
    ? doc.ErrorMessage
    = "ok"
    ? doc.Load("F:\Book1 2013.xlsx") 'file created in Excel 2013
    = .F.
    ? doc.ErrorMessage
    = "Mandatory element missing"
    delete doc
    Both load in Alpha V12.
    There can be only one.

  8. #8
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,182

    Default Re: Office::ExcelDocument ?

    Thanks. I figured it must be a bug and not sure if alpha will look into v11 bugs anymore.

  9. #9
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,698

    Default Re: Office::ExcelDocument ?

    Not sure if it would be a bug if MS changed something in Excel. And no, there are no V11 updates any longer.
    There can be only one.

Similar Threads

  1. Office 365
    By jacsolutions in forum Application Server Version 11 - Web/Browser Applications
    Replies: 1
    Last Post: 01-16-2017, 11:20 PM
  2. Need Advice: Dump Office 365 and go back to Office ####?
    By MoGrace in forum General Questions
    Replies: 9
    Last Post: 08-05-2016, 10:37 PM
  3. ExcelDocument autofilter and autofit
    By Pete119j in forum Alpha Five Version 11 - Desktop Applications
    Replies: 4
    Last Post: 07-19-2013, 07:27 AM
  4. Office 2007 OLE
    By Bob Houle in forum Alpha Five Version 10 - Desktop Applications
    Replies: 2
    Last Post: 05-14-2010, 11:50 AM
  5. Away from the Office
    By Selwyn Rabins in forum Alpha Five Version 5
    Replies: 7
    Last Post: 11-21-2002, 03:09 PM

Posting Permissions

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