@@ -296,6 +296,16 @@ func regConstants() {
296
296
"HeaderFooterImagePositionLeft" : int (excelize .HeaderFooterImagePositionLeft ),
297
297
"HeaderFooterImagePositionCenter" : int (excelize .HeaderFooterImagePositionCenter ),
298
298
"HeaderFooterImagePositionRight" : int (excelize .HeaderFooterImagePositionRight ),
299
+ // IgnoredErrorsType enumeration
300
+ "IgnoredErrorsEvalError" : int (excelize .IgnoredErrorsEvalError ),
301
+ "IgnoredErrorsTwoDigitTextYear" : int (excelize .IgnoredErrorsTwoDigitTextYear ),
302
+ "IgnoredErrorsNumberStoredAsText" : int (excelize .IgnoredErrorsNumberStoredAsText ),
303
+ "IgnoredErrorsFormula" : int (excelize .IgnoredErrorsFormula ),
304
+ "IgnoredErrorsFormulaRange" : int (excelize .IgnoredErrorsFormulaRange ),
305
+ "IgnoredErrorsUnlockedFormula" : int (excelize .IgnoredErrorsUnlockedFormula ),
306
+ "IgnoredErrorsEmptyCellReference" : int (excelize .IgnoredErrorsEmptyCellReference ),
307
+ "IgnoredErrorsListDataValidation" : int (excelize .IgnoredErrorsListDataValidation ),
308
+ "IgnoredErrorsCalculatedColumn" : int (excelize .IgnoredErrorsCalculatedColumn ),
299
309
// PictureInsertType enumeration
300
310
"PictureInsertTypePlaceOverCells" : int (excelize .PictureInsertTypePlaceOverCells ),
301
311
"PictureInsertTypePlaceInCell" : int (excelize .PictureInsertTypePlaceInCell ),
@@ -314,12 +324,14 @@ func regInteropFunc(f *excelize.File, fn map[string]interface{}) interface{} {
314
324
"AddDataValidation" : AddDataValidation (f ),
315
325
"AddFormControl" : AddFormControl (f ),
316
326
"AddHeaderFooterImage" : AddHeaderFooterImage (f ),
327
+ "AddIgnoredErrors" : AddIgnoredErrors (f ),
317
328
"AddPictureFromBytes" : AddPictureFromBytes (f ),
318
329
"AddPivotTable" : AddPivotTable (f ),
319
330
"AddShape" : AddShape (f ),
320
331
"AddSlicer" : AddSlicer (f ),
321
332
"AddSparkline" : AddSparkline (f ),
322
333
"AddTable" : AddTable (f ),
334
+ "AddVBAProject" : AddVBAProject (f ),
323
335
"AutoFilter" : AutoFilter (f ),
324
336
"CalcCellValue" : CalcCellValue (f ),
325
337
"CopySheet" : CopySheet (f ),
@@ -1199,6 +1211,25 @@ func AddHeaderFooterImage(f *excelize.File) func(this js.Value, args []js.Value)
1199
1211
}
1200
1212
}
1201
1213
1214
+ // AddIgnoredErrors provides the method to ignored error for a range of cells.
1215
+ func AddIgnoredErrors (f * excelize.File ) func (this js.Value , args []js.Value ) interface {} {
1216
+ return func (this js.Value , args []js.Value ) interface {} {
1217
+ ret := map [string ]interface {}{"error" : nil }
1218
+ if err := prepareArgs (args , []argsRule {
1219
+ {types : []js.Type {js .TypeString }},
1220
+ {types : []js.Type {js .TypeString }},
1221
+ {types : []js.Type {js .TypeNumber }},
1222
+ }); err != nil {
1223
+ ret ["error" ] = err .Error ()
1224
+ return js .ValueOf (ret )
1225
+ }
1226
+ if err := f .AddIgnoredErrors (args [0 ].String (), args [1 ].String (), excelize .IgnoredErrorsType (args [2 ].Int ())); err != nil {
1227
+ ret ["error" ] = err .Error ()
1228
+ }
1229
+ return js .ValueOf (ret )
1230
+ }
1231
+ }
1232
+
1202
1233
// AddPictureFromBytes provides the method to add picture in a sheet by given
1203
1234
// picture format set (such as offset, scale, aspect ratio setting and print
1204
1235
// settings), file base name, extension name and file bytes.
@@ -1361,6 +1392,26 @@ func AddTable(f *excelize.File) func(this js.Value, args []js.Value) interface{}
1361
1392
}
1362
1393
}
1363
1394
1395
+ // AddVBAProject provides the method to add vbaProject.bin file which contains
1396
+ // functions and/or macros. The file extension should be XLSM or XLTM.
1397
+ func AddVBAProject (f * excelize.File ) func (this js.Value , args []js.Value ) interface {} {
1398
+ return func (this js.Value , args []js.Value ) interface {} {
1399
+ ret := map [string ]interface {}{"error" : nil }
1400
+ if err := prepareArgs (args , []argsRule {
1401
+ {types : []js.Type {js .TypeObject }},
1402
+ }); err != nil {
1403
+ ret ["error" ] = err .Error ()
1404
+ return js .ValueOf (ret )
1405
+ }
1406
+ buf := make ([]byte , args [0 ].Get ("length" ).Int ())
1407
+ js .CopyBytesToGo (buf , args [0 ])
1408
+ if err := f .AddVBAProject (buf ); err != nil {
1409
+ ret ["error" ] = err .Error ()
1410
+ }
1411
+ return js .ValueOf (ret )
1412
+ }
1413
+ }
1414
+
1364
1415
// AutoFilter provides the method to add auto filter in a worksheet by given
1365
1416
// worksheet name, range reference and settings. An auto filter in Excel is a
1366
1417
// way of filtering a 2D range of data based on some simple criteria.
@@ -3314,7 +3365,7 @@ func SetCellInt(f *excelize.File) func(this js.Value, args []js.Value) interface
3314
3365
}
3315
3366
3316
3367
// SetCellRichText provides a function to set cell with rich text by given
3317
- // worksheet.
3368
+ // worksheet name, cell reference and rich text runs .
3318
3369
func SetCellRichText (f * excelize.File ) func (this js.Value , args []js.Value ) interface {} {
3319
3370
return func (this js.Value , args []js.Value ) interface {} {
3320
3371
ret := map [string ]interface {}{"error" : nil }
0 commit comments