//close the calc document. func (c Calc) Close() error { code := C.oogo_close_calc(C.calc_c(c)) if code == 0 { return nil } else { return Error() } }
//find sheet by index. func (c Calc) SheetI(idx int) (Sheet, error) { sheet := C.oogo_sheet_i(C.calc_c(c), C.int(idx)) if sheet.code == 0 { return Sheet(sheet), nil } else { return Sheet{}, Error() } }
//find sheet by name. func (c Calc) SheetN(name string) (Sheet, error) { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) sheet := C.oogo_sheet_n(C.calc_c(c), cname) if sheet.code == 0 { return Sheet(sheet), nil } else { return Sheet{}, Error() } }
//new sheet by name and index. func (c Calc) NewSheet(name string, idx int) (Sheet, error) { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) sheet := C.oogo_sheet_new(C.calc_c(c), cname, C.int(idx)) if sheet.code == 0 { return Sheet(sheet), nil } else { return Sheet{}, Error() } }
//save document to file by file and file url. func (c Calc) Store(filter, url string) error { cfilter := C.CString(filter) curl := C.CString(url) defer func() { C.free(unsafe.Pointer(cfilter)) C.free(unsafe.Pointer(curl)) }() code := C.oogo_store_calc(C.calc_c(c), cfilter, curl) if code == 0 { return nil } else { return Error() } }