C # using VSTO to Operate Excel Protect

Source: Internet
Author: User

Print? Excel. Worksheet. Protect (
[OptionalAttribute] Object Password,
[OptionalAttribute] Object DrawingObjects,
[OptionalAttribute] Object Contents,
[OptionalAttribute] Object Scenarios,
[OptionalAttribute] Object UserInterfaceOnly,
[OptionalAttribute] Object AllowFormattingCells,
[OptionalAttribute] Object AllowFormattingColumns,
[OptionalAttribute] Object AllowFormattingRows,
[OptionalAttribute] Object AllowInsertingColumns,
[OptionalAttribute] Object AllowInsertingRows,
[OptionalAttribute] Object AllowInsertingHyperlinks,
[OptionalAttribute] Object AllowDeletingColumns,
[OptionalAttribute] Object AllowDeletingRows,
[OptionalAttribute] Object AllowSorting,
[OptionalAttribute] Object AllowFiltering,
[OptionalAttribute] Object allowusingtransferttables
)

Excel. Worksheet. Protect (
[OptionalAttribute] Object Password,
[OptionalAttribute] Object DrawingObjects,
[OptionalAttribute] Object Contents,
[OptionalAttribute] Object Scenarios,
[OptionalAttribute] Object UserInterfaceOnly,
[OptionalAttribute] Object AllowFormattingCells,
[OptionalAttribute] Object AllowFormattingColumns,
[OptionalAttribute] Object AllowFormattingRows,
[OptionalAttribute] Object AllowInsertingColumns,
[OptionalAttribute] Object AllowInsertingRows,
[OptionalAttribute] Object AllowInsertingHyperlinks,
[OptionalAttribute] Object AllowDeletingColumns,
[OptionalAttribute] Object AllowDeletingRows,
[OptionalAttribute] Object AllowSorting,
[OptionalAttribute] Object AllowFiltering,
[OptionalAttribute] Object allowusingtransferttables
) Password, the Password of the worksheet, case sensitive. If this parameter is omitted, you do not need to use a password to disable worksheet protection. Otherwise, you must specify a password to disable worksheet protection. If you forget the password, you cannot disable worksheet protection. It is best to save the list of passwords and their corresponding document names in a safe location.
DrawingObjects. If it is set to true, the shape is protected. The default value is false.
Contents, which is true to protect the content in the locked cell. The default value is true.
Scenarios. If it is true, the protection scheme is used. The default value is true.
UserInterfaceOnly, which is true to protect the user interface, but not macros. If this parameter is omitted, both macro and user interface applications are protected.
If AllowFormattingCells is set to true, You Can format any cells in the protected worksheet. The default value is false.
If AllowFormattingColumns is set to true, You Can format any columns in a protected worksheet. The default value is false.
If AllowFormattingRows is set to true, You Can format any row in the protected worksheet. The default value is false.
If AllowInsertingColumns is set to true, columns can be inserted to a protected worksheet. The default value is false.
If AllowInsertingRows is set to true, you can insert rows to a protected worksheet. The default value is false.
If AllowInsertingHyperlinks is set to true, you can insert a hyperlink to the worksheet. The default value is false.
If AllowDeletingColumns is set to true, you are allowed to delete columns in a protected worksheet. Each cell in the column to be deleted is unlocked. The default value is false.
If the value of AllowDeletingRows is true, you are allowed to delete rows in a protected worksheet. Each cell in the row to be deleted is unlocked. The default value is false.
If AllowSorting is set to true, the user is allowed to sort the protected worksheet. Each cell in the sorting range must be unlocked or unprotected. The default value is false.
If AllowFiltering is set to true, you can set a filter on the protected worksheet. You can change filtering conditions, but cannot enable or disable automatic filtering. You can set a filter on an existing automatic filter. The default value is false.
If the value of allowusingtransferttables is true, you can use a PivotTable on a protected worksheet. The default value is false.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.