@@ -1364,8 +1364,8 @@ def set_active_sheet(self, index: int) -> Optional[Exception]:
1364
1364
get_sheet_map. It should be greater than or equal to 0 and less than the
1365
1365
total worksheet numbers.
1366
1366
1367
- Parameters :
1368
- index (int): The sheet index
1367
+ Args :
1368
+ index (int): The sheet index
1369
1369
1370
1370
Returns:
1371
1371
Optional[Exception]: Returns None if no error occurred,
@@ -1375,6 +1375,26 @@ def set_active_sheet(self, index: int) -> Optional[Exception]:
1375
1375
err = lib .SetActiveSheet (self .file_index , index ).decode (ENCODE )
1376
1376
return None if err == "" else Exception (err )
1377
1377
1378
+ def set_cell_bool (self , sheet : str , cell : str , value : bool ) -> Optional [Exception ]:
1379
+ """
1380
+ Set bool type value of a cell by given worksheet name, cell reference and
1381
+ cell value.
1382
+
1383
+ Args:
1384
+ sheet (str): The worksheet name
1385
+ cell (str): The cell reference
1386
+ value (bool): The cell value
1387
+
1388
+ Returns:
1389
+ Optional[Exception]: Returns None if no error occurred,
1390
+ otherwise returns an Exception with the message.
1391
+ """
1392
+ err , lib .SetCellBool .restype = None , c_char_p
1393
+ err = lib .SetCellBool (
1394
+ self .file_index , sheet .encode (ENCODE ), cell .encode (ENCODE ), value
1395
+ ).decode (ENCODE )
1396
+ return None if err == "" else Exception (err )
1397
+
1378
1398
def set_cell_formula (
1379
1399
self , sheet : str , cell : str , formula : str , * opts : FormulaOpts
1380
1400
) -> Optional [Exception ]:
@@ -1387,11 +1407,11 @@ def set_cell_formula(
1387
1407
automatically when the workbook has been opened, please call
1388
1408
"update_linked_value" after setting the cell formula functions.
1389
1409
1390
- Parameters :
1391
- sheet (str): The worksheet name
1392
- cell (str): The cell reference
1393
- formula (str): The cell formula
1394
- *opts (FormulaOpts): The formula options
1410
+ Args :
1411
+ sheet (str): The worksheet name
1412
+ cell (str): The cell reference
1413
+ formula (str): The cell formula
1414
+ *opts (FormulaOpts): The formula options
1395
1415
1396
1416
Returns:
1397
1417
Optional[Exception]: Returns None if no error occurred,
@@ -1430,12 +1450,12 @@ def set_cell_hyperlink(
1430
1450
please use the other functions such as `set_cell_style` or
1431
1451
`set_sheet_row`.
1432
1452
1433
- Parameters :
1434
- sheet (str): The worksheet name
1435
- cell (str): The cell reference
1436
- link (str): The hyperlink
1437
- link_type (str): The hyperlink type
1438
- *opts (HyperlinkOpts): The hyperlink options
1453
+ Args :
1454
+ sheet (str): The worksheet name
1455
+ cell (str): The cell reference
1456
+ link (str): The hyperlink
1457
+ link_type (str): The hyperlink type
1458
+ *opts (HyperlinkOpts): The hyperlink options
1439
1459
1440
1460
Returns:
1441
1461
Optional[Exception]: Returns None if no error occurred,
@@ -1700,6 +1720,67 @@ def set_workbook_props(self, opts: WorkbookPropsOptions) -> Optional[Exception]:
1700
1720
err = lib .SetWorkbookProps (self .file_index , byref (options )).decode (ENCODE )
1701
1721
return None if err == "" else Exception (err )
1702
1722
1723
+ def ungroup_sheets (self ) -> Optional [Exception ]:
1724
+ """
1725
+ Ungroup worksheets.
1726
+
1727
+ Returns:
1728
+ Optional[Exception]: Returns None if no error occurred,
1729
+ otherwise returns an Exception with the message.
1730
+ """
1731
+ lib .UngroupSheets .restype = c_char_p
1732
+ err = lib .UngroupSheets (self .file_index ).decode (ENCODE )
1733
+ return None if err == "" else Exception (err )
1734
+
1735
+ def unmerge_cell (
1736
+ self , sheet : str , top_left_cell : str , bottom_right_cell : str
1737
+ ) -> Optional [Exception ]:
1738
+ """
1739
+ Unmerge a given range reference.
1740
+
1741
+ Args:
1742
+ sheet (str): The worksheet name
1743
+ top_left_cell (str): The top-left cell reference
1744
+ bottom_right_cell (str): The right-bottom cell reference
1745
+
1746
+ Returns:
1747
+ Optional[Exception]: Returns None if no error occurred,
1748
+ otherwise returns an Exception with the message.
1749
+
1750
+ Example:
1751
+ Unmerge range reference D3:E9 on Sheet1:
1752
+
1753
+ .. code-block:: python
1754
+
1755
+ err = f.unmerge_cell("Sheet1", "D3", "E9")
1756
+ """
1757
+ lib .UnmergeCell .restype = c_char_p
1758
+ err = lib .UnmergeCell (
1759
+ self .file_index ,
1760
+ sheet .encode (ENCODE ),
1761
+ top_left_cell .encode (ENCODE ),
1762
+ bottom_right_cell .encode (ENCODE ),
1763
+ ).decode (ENCODE )
1764
+ return None if err == "" else Exception (err )
1765
+
1766
+ def update_linked_value (self ) -> Optional [Exception ]:
1767
+ """
1768
+ Fix linked values within a spreadsheet are not updating in Office Excel
1769
+ application. This function will be remove value tag when met a cell have
1770
+ a linked value.
1771
+
1772
+ Notice:
1773
+ After opening generated workbook, Excel will update the linked value
1774
+ and generate a new value and will prompt to save the file or not.
1775
+
1776
+ Returns:
1777
+ Optional[Exception]: Returns None if no error occurred,
1778
+ otherwise returns an Exception with the message.
1779
+ """
1780
+ lib .UpdateLinkedValue .restype = c_char_p
1781
+ err = lib .UpdateLinkedValue (self .file_index ).decode (ENCODE )
1782
+ return None if err == "" else Exception (err )
1783
+
1703
1784
1704
1785
def cell_name_to_coordinates (cell : str ) -> Tuple [int , int , Optional [Exception ]]:
1705
1786
"""
0 commit comments