locked
Open office 2007 files ? RRS feed

  • Question

  • Hello all,
    here is my problem
    I'm using AXFramerControl to view office files in my windows application (visual studio 2005)
    And i am trying to Open these file as read-only
    and recording to Open method, it opens files by default as read-only but I still can type inside the opened doc
    how can I prevent user from type inside the opened document.

    I can explain more if you do not get the problem. !!
    Thanks

    • Moved by Peter Ritchie Friday, October 24, 2008 1:19 PM Not about C# Language syntax, question about DSOFramer (Moved from Visual C# Language to Off-Topic Posts (Do Not Post Here))
    Thursday, October 23, 2008 4:29 PM

Answers

  • I wrote a blog on how to open and display a Word 2007 document in a WebBrowser control for Windows Forms.  When you open them in the WebBrowser control, they're not editable.  I think that solution might work well for you. 

    http://blog.davemorton.net/2008/10/simple-docbrowser-control.html
    David Morton - http://blog.davemorton.net/
    • Marked as answer by Rami Shareef Saturday, October 25, 2008 9:14 AM
    Thursday, October 23, 2008 4:38 PM
  • I knew how to protect excel file in ocxframer

     Workbook wb = (Workbook)framer.ActiveDocument;
     object m = Type.Missing;
     object f = false;
     foreach(Worksheet ws in wb.Worksheets )
            ws.Protect(m, m, m, m, m, f, f, f, f, f, f, f, f, f, f, f);

    still working on powerpoint protection (read-only)
    • Marked as answer by Rami Shareef Wednesday, May 6, 2009 8:53 AM
    Thursday, October 30, 2008 10:53 AM

All replies

  • I wrote a blog on how to open and display a Word 2007 document in a WebBrowser control for Windows Forms.  When you open them in the WebBrowser control, they're not editable.  I think that solution might work well for you. 

    http://blog.davemorton.net/2008/10/simple-docbrowser-control.html
    David Morton - http://blog.davemorton.net/
    • Marked as answer by Rami Shareef Saturday, October 25, 2008 9:14 AM
    Thursday, October 23, 2008 4:38 PM
  • I'll Check this
    Thursday, October 23, 2008 4:44 PM
  • Cool, doc And docx works fine
    But on xls, xlsx throw an exception (The file appears to be corrupted.) !!
    file opens successfully in Excel 2007
    also, you have to kill the opened file process after closing program !!
    After checking my task-manager I have a bout 7 WINWORD Processes

    consider it as a feedback : )
    Thanks
    Thursday, October 23, 2008 5:09 PM
  • Yeah, it was never intended for excel files also, only for word documents.  Thanks for noticing the remaining processes.  I'll update the blog when I get a chance.
    David Morton - http://blog.davemorton.net/
    Thursday, October 23, 2008 5:55 PM
  • guys, I come with sth new
    now I'm using OCXFramerControl instate of converting files to HTML..
    my problem is that now I can open words files as read-only by using protect method
    put it dose not work fine with excel worksheets, and no such method in presentation class
    so
    how can I protect (read-only-open) my excel and presentation files
    thanks.
    Thursday, October 30, 2008 9:27 AM
  • I knew how to protect excel file in ocxframer

     Workbook wb = (Workbook)framer.ActiveDocument;
     object m = Type.Missing;
     object f = false;
     foreach(Worksheet ws in wb.Worksheets )
            ws.Protect(m, m, m, m, m, f, f, f, f, f, f, f, f, f, f, f);

    still working on powerpoint protection (read-only)
    • Marked as answer by Rami Shareef Wednesday, May 6, 2009 8:53 AM
    Thursday, October 30, 2008 10:53 AM