@@ -4040,6 +4040,78 @@ def set_active_sheet(self, index: int) -> None:
4040
4040
if err != "" :
4041
4041
raise RuntimeError (err )
4042
4042
4043
+ def set_app_props (self , app_properties : AppProperties ) -> None :
4044
+ """
4045
+ Set document application properties. The properties that can be set are:
4046
+
4047
+ application: The name of the application that created this document.
4048
+
4049
+ scale_crop: Indicates the display mode of the document thumbnail. Set
4050
+ this element to `true` to enable scaling of the document thumbnail to
4051
+ the display. Set this element to `false` to enable cropping of the
4052
+ document thumbnail to show only sections that will fit the display.
4053
+
4054
+ doc_security: Security level of a document as a numeric value. Document
4055
+ security is defined as:
4056
+ 1 - Document is password protected.
4057
+ 2 - Document is recommended to be opened as read-only.
4058
+ 3 - Document is enforced to be opened as read-only.
4059
+ 4 - Document is locked for annotation.
4060
+
4061
+ company: The name of a company associated with the document.
4062
+
4063
+ links_up_to_date: Indicates whether hyperlinks in a document are
4064
+ up-to-date. Set this element to `true` to indicate that hyperlinks are
4065
+ updated. Set this element to `false` to indicate that hyperlinks are
4066
+ outdated.
4067
+
4068
+ hyperlinks_changed: Specifies that one or more hyperlinks in this part
4069
+ were updated exclusively in this part by a producer. The next producer
4070
+ to open this document shall update the hyperlink relationships with the
4071
+ new hyperlinks specified in this part.
4072
+
4073
+ app_version: Specifies the version of the application which produced
4074
+ this document. The content of this element shall be of the form XX.YYYY
4075
+ where X and Y represent numerical values, or the document shall be
4076
+ considered non-conformant.
4077
+
4078
+ Args:
4079
+ app_properties (AppProperties): The application properties
4080
+
4081
+ Returns:
4082
+ None: Return None if no error occurred, otherwise raise a
4083
+ RuntimeError with the message.
4084
+
4085
+ Example:
4086
+ For example:
4087
+
4088
+ ```python
4089
+ try:
4090
+ f.set_app_props(
4091
+ excelize.AppProperties(
4092
+ application: "Microsoft Excel",
4093
+ scale_crop: true,
4094
+ doc_security: 3,
4095
+ company: "Company Name",
4096
+ links_up_to_date: true,
4097
+ hyperlinks_changed: true,
4098
+ app_version: "16.0000",
4099
+ )
4100
+ )
4101
+ except (RuntimeError, TypeError) as err:
4102
+ print(err)
4103
+ ```
4104
+ """
4105
+ prepare_args (
4106
+ [app_properties ],
4107
+ [argsRule ("app_properties" , [AppProperties ])],
4108
+ )
4109
+ lib .SetAppProps .restype = c_char_p
4110
+ options = py_value_to_c (app_properties , types_go ._AppProperties ())
4111
+ err = lib .SetAppProps (self .file_index , byref (options )).decode (ENCODE )
4112
+ if err != "" :
4113
+ raise RuntimeError (err )
4114
+
4043
4115
def set_cell_bool (self , sheet : str , cell : str , value : bool ) -> None :
4044
4116
"""
4045
4117
Set bool type value of a cell by given worksheet name, cell reference
0 commit comments