@@ -366,6 +366,7 @@ func regInteropFunc(f *excelize.File, fn map[string]interface{}) interface{} {
366
366
"GetRowOutlineLevel" : GetRowOutlineLevel (f ),
367
367
"GetRows" : GetRows (f ),
368
368
"GetRowVisible" : GetRowVisible (f ),
369
+ "GetSheetDimension" : GetSheetDimension (f ),
369
370
"GetSheetIndex" : GetSheetIndex (f ),
370
371
"GetSheetList" : GetSheetList (f ),
371
372
"GetSheetMap" : GetSheetMap (f ),
@@ -423,6 +424,7 @@ func regInteropFunc(f *excelize.File, fn map[string]interface{}) interface{} {
423
424
"SetRowVisible" : SetRowVisible (f ),
424
425
"SetSheetBackgroundFromBytes" : SetSheetBackgroundFromBytes (f ),
425
426
"SetSheetCol" : SetSheetCol (f ),
427
+ "SetSheetDimension" : SetSheetDimension (f ),
426
428
"SetSheetName" : SetSheetName (f ),
427
429
"SetSheetProps" : SetSheetProps (f ),
428
430
"SetSheetRow" : SetSheetRow (f ),
@@ -2412,6 +2414,24 @@ func GetRowVisible(f *excelize.File) func(this js.Value, args []js.Value) interf
2412
2414
}
2413
2415
}
2414
2416
2417
+ // GetSheetDimension provides the method to get the used range of the worksheet.
2418
+ func GetSheetDimension (f * excelize.File ) func (this js.Value , args []js.Value ) interface {} {
2419
+ return func (this js.Value , args []js.Value ) interface {} {
2420
+ ret := map [string ]interface {}{"dimension" : false , "error" : nil }
2421
+ err := prepareArgs (args , []argsRule {
2422
+ {types : []js.Type {js .TypeString }},
2423
+ })
2424
+ if err != nil {
2425
+ ret ["error" ] = err .Error ()
2426
+ return js .ValueOf (ret )
2427
+ }
2428
+ if ret ["dimension" ], err = f .GetSheetDimension (args [0 ].String ()); err != nil {
2429
+ ret ["error" ] = err .Error ()
2430
+ }
2431
+ return js .ValueOf (ret )
2432
+ }
2433
+ }
2434
+
2415
2435
// GetRows return all the rows in a sheet by given worksheet name, returned as
2416
2436
// a two-dimensional array, where the value of the cell is converted to the
2417
2437
// string type. If the cell format can be applied to the value of the cell,
@@ -3834,6 +3854,28 @@ func SetSheetCol(f *excelize.File) func(this js.Value, args []js.Value) interfac
3834
3854
}
3835
3855
}
3836
3856
3857
+ // SetSheetDimension provides the method to set or remove the used range of the
3858
+ // worksheet by a given range reference. It specifies the row and column bounds
3859
+ // of used cells in the worksheet. The range reference is set using the A1
3860
+ // reference style(e.g., "A1:D5"). Passing an empty range reference will remove
3861
+ // the used range of the worksheet.
3862
+ func SetSheetDimension (f * excelize.File ) func (this js.Value , args []js.Value ) interface {} {
3863
+ return func (this js.Value , args []js.Value ) interface {} {
3864
+ ret := map [string ]interface {}{"error" : nil }
3865
+ if err := prepareArgs (args , []argsRule {
3866
+ {types : []js.Type {js .TypeString }},
3867
+ {types : []js.Type {js .TypeString }},
3868
+ }); err != nil {
3869
+ ret ["error" ] = err .Error ()
3870
+ return js .ValueOf (ret )
3871
+ }
3872
+ if err := f .SetSheetDimension (args [0 ].String (), args [1 ].String ()); err != nil {
3873
+ ret ["error" ] = err .Error ()
3874
+ }
3875
+ return js .ValueOf (ret )
3876
+ }
3877
+ }
3878
+
3837
3879
// SetSheetName provides a function to set the worksheet name by given source
3838
3880
// and target worksheet names. Maximum 31 characters are allowed in sheet
3839
3881
// title and this function only changes the name of the sheet and will not
0 commit comments