Ticket T745921
Visible to All Users

What is the best way for have a SpreadSheet in readOnly mode?

created 6 years ago

What is the best way for have a SpreadSheet in readOnly mode?

I change some options of the <tdxSpreadSheet>.OptionsBehavior property, but when I try to edit the book by pressing a key or edit through the TdxSpreadSheetFormulaBar component, I found this error message:
"The cell that you are trying to change is protected and therefore read-only."

The options that I change are:

procedure TForm1.FormShow(Sender: TObject);
begin
   dxSpreadSheet1.OptionsBehavior.&Protected  := True;
   dxSpreadSheet1.OptionsBehavior.DragFilling := False;
   dxSpreadSheet1.OptionsBehavior.DragMoving  := False;
   dxSpreadSheet1.OptionsBehavior.Deleting  := False;
   dxSpreadSheet1.OptionsBehavior.Editing   := False;
   dxSpreadSheet1.OptionsBehavior.Inserting := False;
end;

Comments (2)
DevExpress Support Team 6 years ago

    Hello,

    Your approach looks correct. This exception message means that Spreadsheet is in ReadOnly mode. We have implemented this behavior to emulate Microsoft Excel.

    Do you mean that you need to suppress this message? I suggest that you review the load spreadsheet in read-only mode and Error editing protected spreadsheet tickets for more information.

    M M
    MICHEL PRIETO TRUJILLO 6 years ago

      Hello,

      Yes, I want to suppress this message.

      The users will can to access to SpreadSheet without get exception.

      I tried the suggest in the T545652, but not all of the areas of the SpreadSheet are readonly

      Thanks

      Answers approved by DevExpress Support

      created 6 years ago

      Hello,

      Thank you for your clarification. The most appropriate approach to avoid displaying an error message on EdxSpreadSheetProtectionError is to manually handle this exception. For example, you can do this in the OnException event handler of the TApplicationEvents component. If this approach does not help, provide me with a small sample project with your document and protection options. I will try to fine-tune it.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.