示例#1
0
//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()
	}
}
示例#2
0
//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()
	}
}
示例#3
0
//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()
	}
}
示例#4
0
//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()
	}
}
示例#5
0
//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()
	}
}