|
| 1 | +from dataclasses import dataclass |
| 2 | + |
| 3 | + |
| 4 | +@dataclass |
| 5 | +class RangeProperties: |
| 6 | + |
| 7 | + """ |
| 8 | + ### Overview |
| 9 | + ---- |
| 10 | + A python dataclass which is used to represent Range Properties. |
| 11 | + The Microsoft Graph API allows users to update Range objects and |
| 12 | + this utility makes constructing those updates in a concise way that |
| 13 | + is python friendly. |
| 14 | +
|
| 15 | + ### Parameters |
| 16 | + ---- |
| 17 | + column_hidden : bool (optional, Default=None) |
| 18 | + Represents if all columns of the current range are hidden. |
| 19 | +
|
| 20 | + formulas : list (optional, Default=None) |
| 21 | + Represents the formula in A1-style notation. |
| 22 | +
|
| 23 | + formulas_local : list (optional, Default=None) |
| 24 | + Represents the formula in A1-style notation, in the user's |
| 25 | + language and number-formatting locale. For example, the |
| 26 | + English "=SUM(A1, 1.5)" formula would become |
| 27 | + "=SUMME(A1; 1,5)" in German. |
| 28 | +
|
| 29 | + formulas_r1c1 : list (optional, Default=None) |
| 30 | + Represents the formula in R1C1-style notation. |
| 31 | +
|
| 32 | + number_format : str (optional, Default=None) |
| 33 | + Represents Excel's number format code for the given cell. |
| 34 | +
|
| 35 | + row_hidden : bool (optional, Default=None) |
| 36 | + Represents if all rows of the current range are hidden. |
| 37 | +
|
| 38 | + values : list (optional, Default=None) |
| 39 | + Represents the raw values of the specified range. The |
| 40 | + data returned could be of type string, number, or a |
| 41 | + boolean. Cell that contain an error will return the |
| 42 | + error string. |
| 43 | + """ |
| 44 | + |
| 45 | + column_hidden: bool |
| 46 | + row_hidden: bool |
| 47 | + formulas: list |
| 48 | + formulas_local: list |
| 49 | + formulas_r1c1: list |
| 50 | + number_format: str |
| 51 | + values: list |
| 52 | + |
| 53 | + def to_dict(self) -> dict: |
| 54 | + """Generates a dictionary containing all the field |
| 55 | + names and values. |
| 56 | +
|
| 57 | + ### Returns |
| 58 | + ---- |
| 59 | + dict |
| 60 | + The Field Name and Values. |
| 61 | + """ |
| 62 | + |
| 63 | + class_dict = { |
| 64 | + "columnHidden": self.column_hidden, |
| 65 | + "rowHidden": self.row_hidden, |
| 66 | + "formulas": self.formulas, |
| 67 | + "numberFormat": self.number_format, |
| 68 | + "formulasR1C1": self.formulas_r1c1, |
| 69 | + "formulasLocal": self.formulas_local, |
| 70 | + "values": self.values, |
| 71 | + } |
| 72 | + |
| 73 | + return class_dict |
0 commit comments