in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

C1XLBook: Worksheet protection

Last post 02-11-2008 3:44 PM by C1_GaryB. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-05-2008 5:01 AM

    C1XLBook: Worksheet protection

    Hi!

    Is it possible to protect (unprotect) a cell, row, column or any other range of worksheet from editing at runtime (like worksheet.Protect in MS Excel)? Is it possible to use passwords for protection of workbook (worksheet)?

    Thanks!

  • 02-11-2008 3:44 PM In reply to

    Re: C1XLBook: Worksheet protection

    Hi,
     
    You can protect the Sheet or Cell using the locked property; unfortunately password property is not available with C1Excel. Here is the code to lock -
     
    ' Start with a single locked sheet.

           _c1xl.Clear()

           Dim sheet As XLSheet =  _c1xl.Sheets(0)

           sheet.Locked = True

           ' Create an unlocked style.

           Dim dataEnTry As XLStyle =  New XLStyle(_c1xl)

           dataEnTry.Locked = False

           dataEnTry.BackColor = Color.Beige

           ' Create data entry titles.

           sheet(0,0).Value = "Name:"

           sheet(1,0).Value = "Address:"

           sheet(2,0).Value = "Phone #:"

           ' Create data enTry cells (unlocked).

           sheet(0,1).Style = dataEnTry

           sheet(1,1).Style = dataEnTry

           sheet(2,1).Style = dataEnTry

           ' Save the book.

           _c1xl.Save("c:\temp\Protected.xls")

     

    Thanks,

    Gary.

    <imnst2008> wrote in message news:201638@10.0.1.98...

    Hi!

    Is it possible to protect (unprotect) a cell, row, column or any other range of worksheet from editing at runtime (like worksheet.Protect in MS Excel)? Is it possible to use passwords for protection of workbook (worksheet)?

    Thanks!



    http://helpcentral.componentone.com/cs/forums/p/74209/201638.aspx#201638

Page 1 of 1 (2 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.