2121 c_char ,
2222 c_double ,
2323 c_int ,
24+ c_longlong ,
2425 c_ubyte ,
2526 cast ,
2627 CDLL ,
@@ -584,7 +585,9 @@ def merge_cell(self, top_left_cell: str, bottom_right_cell: str) -> None:
584585 if err != "" :
585586 raise RuntimeError (err )
586587
587- def set_col_width (self , start_col : int , end_col : int , width : float ) -> None :
588+ def set_col_width (
589+ self , start_col : int , end_col : int , width : Union [int , float ]
590+ ) -> None :
588591 """
589592 Set the width of a single column or multiple columns for the stream
590593 writer. Note that you must call the `set_col_width` function before the
@@ -593,7 +596,7 @@ def set_col_width(self, start_col: int, end_col: int, width: float) -> None:
593596 Args:
594597 start_col (int): The start column number
595598 end_col (int): The end column number
596- width (float): The column width
599+ width (Union[int, float] ): The column width
597600
598601 Returns:
599602 None: Return None if no error occurred, otherwise raise a
@@ -614,12 +617,12 @@ def set_col_width(self, start_col: int, end_col: int, width: float) -> None:
614617 [
615618 argsRule ("start_col" , [int ]),
616619 argsRule ("end_col" , [int ]),
617- argsRule ("width" , [float ]),
620+ argsRule ("width" , [int , float ]),
618621 ],
619622 )
620623 lib .StreamSetColWidth .restype = c_char_p
621624 err = lib .StreamSetColWidth (
622- self .sw_index , c_int (start_col ), c_int (end_col ), c_double (width )
625+ self .sw_index , c_longlong (start_col ), c_longlong (end_col ), c_double (width )
623626 ).decode (ENCODE )
624627 if err != "" :
625628 raise RuntimeError (err )
@@ -2331,7 +2334,9 @@ def copy_sheet(self, src: int, to: int) -> None:
23312334 """
23322335 prepare_args ([src , to ], [argsRule ("src" , [int ]), argsRule ("to" , [int ])])
23332336 err , lib .CopySheet .restype = None , c_char_p
2334- err = lib .CopySheet (self .file_index , src , to ).decode (ENCODE )
2337+ err = lib .CopySheet (self .file_index , c_longlong (src ), c_longlong (to )).decode (
2338+ ENCODE
2339+ )
23352340 if err != "" :
23362341 raise RuntimeError (err )
23372342
@@ -2512,9 +2517,9 @@ def duplicate_row(self, sheet: str, row: int) -> None:
25122517 [argsRule ("sheet" , [str ]), argsRule ("row" , [int ])],
25132518 )
25142519 err , lib .DuplicateRow .restype = None , c_char_p
2515- err = lib .DuplicateRow (self . file_index , sheet . encode ( ENCODE ), row ). decode (
2516- ENCODE
2517- )
2520+ err = lib .DuplicateRow (
2521+ self . file_index , sheet . encode ( ENCODE ), c_longlong ( row )
2522+ ). decode ( ENCODE )
25182523 if err != "" :
25192524 raise RuntimeError (err )
25202525
@@ -2556,7 +2561,7 @@ def duplicate_row_to(self, sheet: str, row: int, row2: int) -> None:
25562561 )
25572562 err , lib .DuplicateRowTo .restype = None , c_char_p
25582563 err = lib .DuplicateRowTo (
2559- self .file_index , sheet .encode (ENCODE ), row , row2
2564+ self .file_index , sheet .encode (ENCODE ), c_longlong ( row ), c_longlong ( row2 )
25602565 ).decode (ENCODE )
25612566 if err != "" :
25622567 raise RuntimeError (err )
@@ -2935,7 +2940,7 @@ def get_row_height(self, sheet: str, row: int) -> float:
29352940 [argsRule ("sheet" , [str ]), argsRule ("row" , [int ])],
29362941 )
29372942 lib .GetRowHeight .restype = types_go ._Float64ErrorResult
2938- res = lib .GetRowHeight (self .file_index , sheet .encode (ENCODE ), row )
2943+ res = lib .GetRowHeight (self .file_index , sheet .encode (ENCODE ), c_longlong ( row ) )
29392944 err = res .err .decode (ENCODE )
29402945 if not err :
29412946 return res .val
@@ -2969,7 +2974,9 @@ def get_row_outline_level(self, sheet: str, row: int) -> int:
29692974 [argsRule ("sheet" , [str ]), argsRule ("row" , [int ])],
29702975 )
29712976 lib .GetRowOutlineLevel .restype = types_go ._IntErrorResult
2972- res = lib .GetRowOutlineLevel (self .file_index , sheet .encode (ENCODE ), row )
2977+ res = lib .GetRowOutlineLevel (
2978+ self .file_index , sheet .encode (ENCODE ), c_longlong (row )
2979+ )
29732980 err = res .err .decode (ENCODE )
29742981 if not err :
29752982 return res .val
@@ -3002,7 +3009,7 @@ def get_row_visible(self, sheet: str, row: int) -> bool:
30023009 [argsRule ("sheet" , [str ]), argsRule ("row" , [int ])],
30033010 )
30043011 lib .GetRowVisible .restype = types_go ._BoolErrorResult
3005- res = lib .GetRowVisible (self .file_index , sheet .encode (ENCODE ), c_int (row ))
3012+ res = lib .GetRowVisible (self .file_index , sheet .encode (ENCODE ), c_longlong (row ))
30063013 err = res .err .decode (ENCODE )
30073014 if not err :
30083015 return res .val
@@ -3169,7 +3176,7 @@ def get_sheet_name(self, sheet: int) -> str:
31693176 """
31703177 prepare_args ([sheet ], [argsRule ("sheet" , [int ])])
31713178 lib .GetSheetName .restype = types_go ._StringErrorResult
3172- res = lib .GetSheetName (self .file_index , c_int (sheet ))
3179+ res = lib .GetSheetName (self .file_index , c_longlong (sheet ))
31733180 err = res .err .decode (ENCODE )
31743181 if not err :
31753182 return res .val .decode (ENCODE )
@@ -3233,7 +3240,7 @@ def get_style(self, style_id: int) -> Optional[Style]:
32333240 """
32343241 prepare_args ([style_id ], [argsRule ("style_id" , [int ])])
32353242 lib .GetStyle .restype = types_go ._GetStyleResult
3236- res = lib .GetStyle (self .file_index , c_int (style_id ))
3243+ res = lib .GetStyle (self .file_index , c_longlong (style_id ))
32373244 err = res .err .decode (ENCODE )
32383245 if not err :
32393246 return c_value_to_py (res .style , Style ())
@@ -3291,7 +3298,9 @@ def group_sheets(self, sheets: List[str]) -> None:
32913298 array = (c_char_p * len (sheets ))()
32923299 for i , value in enumerate (sheets ):
32933300 array [i ] = value .encode (ENCODE )
3294- err = lib .GroupSheets (self .file_index , array , c_int (len (sheets ))).decode (ENCODE )
3301+ err = lib .GroupSheets (self .file_index , array , c_longlong (len (sheets ))).decode (
3302+ ENCODE
3303+ )
32953304 if err != "" :
32963305 raise RuntimeError (err )
32973306
@@ -3335,7 +3344,7 @@ def insert_cols(self, sheet: str, col: str, n: int) -> None:
33353344 self .file_index ,
33363345 sheet .encode (ENCODE ),
33373346 col .encode (ENCODE ),
3338- c_int (n ),
3347+ c_longlong (n ),
33393348 ).decode (ENCODE )
33403349 if err != "" :
33413350 raise RuntimeError (err )
@@ -3407,8 +3416,8 @@ def insert_rows(self, sheet: str, row: int, n: int) -> None:
34073416 err = lib .InsertRows (
34083417 self .file_index ,
34093418 sheet .encode (ENCODE ),
3410- c_int (row ),
3411- c_int (n ),
3419+ c_longlong (row ),
3420+ c_longlong (n ),
34123421 ).decode (ENCODE )
34133422 if err != "" :
34143423 raise RuntimeError (err )
@@ -3913,9 +3922,9 @@ def remove_row(self, sheet: str, row: int) -> None:
39133922 [argsRule ("sheet" , [str ]), argsRule ("row" , [int ])],
39143923 )
39153924 lib .RemoveRow .restype = c_char_p
3916- err = lib .RemoveRow (self . file_index , sheet . encode ( ENCODE ), c_int ( row )). decode (
3917- ENCODE
3918- )
3925+ err = lib .RemoveRow (
3926+ self . file_index , sheet . encode ( ENCODE ), c_longlong ( row )
3927+ ). decode ( ENCODE )
39193928 if err != "" :
39203929 raise RuntimeError (err )
39213930
@@ -3994,7 +4003,7 @@ def set_active_sheet(self, index: int) -> None:
39944003 """
39954004 prepare_args ([index ], [argsRule ("index" , [int ])])
39964005 err , lib .SetActiveSheet .restype = None , c_char_p
3997- err = lib .SetActiveSheet (self .file_index , index ).decode (ENCODE )
4006+ err = lib .SetActiveSheet (self .file_index , c_longlong ( index ) ).decode (ENCODE )
39984007 if err != "" :
39994008 raise RuntimeError (err )
40004009
@@ -4275,7 +4284,7 @@ def set_cell_int(self, sheet: str, cell: str, value: int) -> None:
42754284 self .file_index ,
42764285 sheet .encode (ENCODE ),
42774286 cell .encode (ENCODE ),
4278- value ,
4287+ c_longlong ( value ) ,
42794288 ).decode (ENCODE )
42804289 if err != "" :
42814290 raise RuntimeError (err )
@@ -4497,7 +4506,7 @@ def set_cell_style(
44974506 sheet .encode (ENCODE ),
44984507 top_left_cell .encode (ENCODE ),
44994508 bottom_right_cell .encode (ENCODE ),
4500- style_id ,
4509+ c_longlong ( style_id ) ,
45014510 ).decode (ENCODE )
45024511 if err != "" :
45034512 raise RuntimeError (err )
@@ -4584,7 +4593,7 @@ def set_col_outline_level(self, sheet: str, col: str, level: int) -> None:
45844593 )
45854594 lib .SetColOutlineLevel .restype = c_char_p
45864595 err = lib .SetColOutlineLevel (
4587- self .file_index , sheet .encode (ENCODE ), col .encode (ENCODE ), level
4596+ self .file_index , sheet .encode (ENCODE ), col .encode (ENCODE ), c_longlong ( level )
45884597 ).decode (ENCODE )
45894598 if err != "" :
45904599 raise RuntimeError (err )
@@ -4633,7 +4642,10 @@ def set_col_style(self, sheet: str, columns: str, style_id: int) -> None:
46334642 )
46344643 lib .SetColStyle .restype = c_char_p
46354644 err = lib .SetColStyle (
4636- self .file_index , sheet .encode (ENCODE ), columns .encode (ENCODE ), style_id
4645+ self .file_index ,
4646+ sheet .encode (ENCODE ),
4647+ columns .encode (ENCODE ),
4648+ c_longlong (style_id ),
46374649 ).decode (ENCODE )
46384650 if err != "" :
46394651 raise RuntimeError (err )
@@ -4687,7 +4699,7 @@ def set_col_visible(self, sheet: str, columns: str, visible: bool) -> None:
46874699 raise RuntimeError (err )
46884700
46894701 def set_col_width (
4690- self , sheet : str , start_col : str , end_col : str , width : float
4702+ self , sheet : str , start_col : str , end_col : str , width : Union [ float , int ]
46914703 ) -> None :
46924704 """
46934705 Set the width of a single column or multiple columns.
@@ -4696,7 +4708,7 @@ def set_col_width(
46964708 sheet (str): The worksheet name
46974709 start_col (str): The start column name
46984710 end_col (str): The end column name
4699- width (float): The column width
4711+ width (Union[ float, int] ): The column width
47004712
47014713 Returns:
47024714 None: Return None if no error occurred, otherwise raise a
@@ -4718,7 +4730,7 @@ def set_col_width(
47184730 argsRule ("sheet" , [str ]),
47194731 argsRule ("start_col" , [str ]),
47204732 argsRule ("end_col" , [str ]),
4721- argsRule ("width" , [float ]),
4733+ argsRule ("width" , [int , float ]),
47224734 ],
47234735 )
47244736 lib .SetColWidth .restype = c_char_p
@@ -5028,7 +5040,7 @@ def set_panes(self, sheet: str, opts: Panes) -> None:
50285040 if err != "" :
50295041 raise RuntimeError (err )
50305042
5031- def set_row_height (self , sheet : str , row : int , height : float ) -> None :
5043+ def set_row_height (self , sheet : str , row : int , height : Union [ int , float ] ) -> None :
50325044 """
50335045 Set the height of a single row. If the value of height is 0, will hide
50345046 the specified row, if the value of height is -1, will unset the custom
@@ -5037,7 +5049,7 @@ def set_row_height(self, sheet: str, row: int, height: float) -> None:
50375049 Args:
50385050 sheet (str): The worksheet name
50395051 row (int): The row number
5040- height (float): The row height
5052+ height (Union[int, float] ): The row height
50415053
50425054 Returns:
50435055 None: Return None if no error occurred, otherwise raise a
@@ -5058,12 +5070,12 @@ def set_row_height(self, sheet: str, row: int, height: float) -> None:
50585070 [
50595071 argsRule ("sheet" , [str ]),
50605072 argsRule ("row" , [int ]),
5061- argsRule ("height" , [float ]),
5073+ argsRule ("height" , [int , float ]),
50625074 ],
50635075 )
50645076 lib .SetRowHeight .restype = c_char_p
50655077 err = lib .SetRowHeight (
5066- self .file_index , sheet .encode (ENCODE ), c_int (row ), c_double (height )
5078+ self .file_index , sheet .encode (ENCODE ), c_longlong (row ), c_double (height )
50675079 ).decode (ENCODE )
50685080 if err != "" :
50695081 raise RuntimeError (err )
@@ -5102,7 +5114,7 @@ def set_row_outline_level(self, sheet: str, row: int, level: int) -> None:
51025114 )
51035115 lib .SetRowOutlineLevel .restype = c_char_p
51045116 err = lib .SetRowOutlineLevel (
5105- self .file_index , sheet .encode (ENCODE ), c_int (row ), c_int (level )
5117+ self .file_index , sheet .encode (ENCODE ), c_longlong (row ), c_longlong (level )
51065118 ).decode (ENCODE )
51075119 if err != "" :
51085120 raise RuntimeError (err )
@@ -5155,9 +5167,9 @@ def set_row_style(self, sheet: str, start: int, end: int, style_id: int) -> None
51555167 err = lib .SetRowStyle (
51565168 self .file_index ,
51575169 sheet .encode (ENCODE ),
5158- c_int (start ),
5159- c_int (end ),
5160- c_int (style_id ),
5170+ c_longlong (start ),
5171+ c_longlong (end ),
5172+ c_longlong (style_id ),
51615173 ).decode (ENCODE )
51625174 if err != "" :
51635175 raise RuntimeError (err )
@@ -5198,7 +5210,7 @@ def set_row_visible(self, sheet: str, row: int, visible: bool) -> None:
51985210 err = lib .SetRowVisible (
51995211 self .file_index ,
52005212 sheet .encode (ENCODE ),
5201- c_int (row ),
5213+ c_longlong (row ),
52025214 c_bool (visible ),
52035215 ).decode (ENCODE )
52045216 if err != "" :
@@ -5480,7 +5492,10 @@ def set_sheet_view(self, sheet: str, view_index: int, opts: ViewOptions) -> None
54805492 lib .SetSheetView .restype = c_char_p
54815493 options = py_value_to_c (opts , types_go ._ViewOptions ())
54825494 err = lib .SetSheetView (
5483- self .file_index , sheet .encode (ENCODE ), view_index , byref (options )
5495+ self .file_index ,
5496+ sheet .encode (ENCODE ),
5497+ c_longlong (view_index ),
5498+ byref (options ),
54845499 ).decode (ENCODE )
54855500 if err != "" :
54865501 raise RuntimeError (err )
@@ -5727,7 +5742,7 @@ def column_number_to_name(num: int) -> str:
57275742 """
57285743 prepare_args ([num ], [argsRule ("num" , [int ])])
57295744 lib .ColumnNumberToName .restype = types_go ._StringErrorResult
5730- res = lib .ColumnNumberToName (c_int (num ))
5745+ res = lib .ColumnNumberToName (c_longlong (num ))
57315746 err = res .err .decode (ENCODE )
57325747 if not err :
57335748 return res .val .decode (ENCODE )
@@ -5761,7 +5776,7 @@ def coordinates_to_cell_name(col: int, row: int, *is_absolute: bool) -> str:
57615776 options = False
57625777 if len (is_absolute ) > 0 :
57635778 options = is_absolute [0 ]
5764- res = lib .CoordinatesToCellName (col , row , options )
5779+ res = lib .CoordinatesToCellName (c_longlong ( col ), c_longlong ( row ) , options )
57655780 err = res .err .decode (ENCODE )
57665781 if not err :
57675782 return res .val .decode (ENCODE )
0 commit comments