View Full Version : sort protected spreadsheet?


texlnghorn
05-24-2006, 05:52 AM
I am using OWC11 with C#. I have protected areas of the spreadsheet and
unlocked other areas that can be edited. However, I cannot sort the
spreadsheet. Whenever I choose the sort buttons, I receive the message: "The
range you are trying to modify is locked and there-fore read only." I have
set axSpreadsheet1.ActiveSheet.Protection.AllowSorting = true but this does
not give me the ability to sort the spreadsheet. What do I need to do in
order to be able to sort the spreadsheet.

Thanks,
Mike

Alvin Bruney
05-24-2006, 01:26 PM
The spreadsheet cannot be sorted while it is locked. You will need to catch
the sort event and inside the event handler, lift the protection, apply the
sort, and the re-apply the protection.

--

________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------

"texlnghorn" <texlnghorn@discussions.microsoft.com> wrote in message
news:E5635174-9D01-4DA5-88EA-78D0763C9042@microsoft.com...
>I am using OWC11 with C#. I have protected areas of the spreadsheet and
> unlocked other areas that can be edited. However, I cannot sort the
> spreadsheet. Whenever I choose the sort buttons, I receive the message:
> "The
> range you are trying to modify is locked and there-fore read only." I
> have
> set axSpreadsheet1.ActiveSheet.Protection.AllowSorting = true but this
> does
> not give me the ability to sort the spreadsheet. What do I need to do in
> order to be able to sort the spreadsheet.
>
> Thanks,
> Mike

texlnghorn
05-24-2006, 02:55 PM
I figured thats what I would need to do. Do you know what the sort event is?
I looked through the documentation a little bit yesterday but could not find
the sort event.

Thanks,
Mike

"Alvin Bruney" wrote:

> The spreadsheet cannot be sorted while it is locked. You will need to catch
> the sort event and inside the event handler, lift the protection, apply the
> sort, and the re-apply the protection.
>
> --
>
> ________________________
> Warm regards,
> Alvin Bruney [MVP ASP.NET]
>
> [Shameless Author plug]
> Professional VSTO.NET - Wrox/Wiley
> The O.W.C. Black Book with .NET
> www.lulu.com/owc, Amazon
> Blog: http://www.msmvps.com/blogs/alvin
> -------------------------------------------------------
>
> "texlnghorn" <texlnghorn@discussions.microsoft.com> wrote in message
> news:E5635174-9D01-4DA5-88EA-78D0763C9042@microsoft.com...
> >I am using OWC11 with C#. I have protected areas of the spreadsheet and
> > unlocked other areas that can be edited. However, I cannot sort the
> > spreadsheet. Whenever I choose the sort buttons, I receive the message:
> > "The
> > range you are trying to modify is locked and there-fore read only." I
> > have
> > set axSpreadsheet1.ActiveSheet.Protection.AllowSorting = true but this
> > does
> > not give me the ability to sort the spreadsheet. What do I need to do in
> > order to be able to sort the spreadsheet.
> >
> > Thanks,
> > Mike
>
>
>