Exemplo n.º 1
0
//get the text by index.
func (s Sheet) GetText(x, y int) (string, error) {
	var l C.int = 0
	code := C.oogo_sheet_get_text_l(C.sheet_c(s), C.int(x), C.int(y), &l)
	if code != 0 {
		return "", Error()
	}
	if l < 1 {
		return "", nil
	}
	buf := make([]byte, int(l))
	code = C.oogo_sheet_cpy_text(C.sheet_c(s), C.int(x), C.int(y), (*C.char)(unsafe.Pointer(&buf[0])), C.int(l))
	if code == 0 {
		return string(buf), nil
	} else {
		return "", Error()
	}
}
Exemplo n.º 2
0
// //
//set number value by index.
func (s Sheet) SetV(x, y int, num float64) error {
	code := C.oogo_sheet_set_v(C.sheet_c(s), C.int(x), C.int(y), C.double(num))
	if code == 0 {
		return nil
	} else {
		return Error()
	}
}
Exemplo n.º 3
0
//get number value by index.
func (s Sheet) GetV(x, y int) (float64, error) {
	var num C.double = 0
	code := C.oogo_sheet_get_v(C.sheet_c(s), C.int(x), C.int(y), &num)
	if code == 0 {
		return float64(num), nil
	} else {
		return 0, Error()
	}
}
Exemplo n.º 4
0
//return the end cell index of column and row
func (s Sheet) EndRL() (int, int, error) {
	var c C.int = 0
	var r C.int = 0
	code := C.oogo_sheet_end_r_l(C.sheet_c(s), &c, &r)
	if code == 0 {
		return int(c), int(r), nil
	} else {
		return 0, 0, Error()
	}
}
Exemplo n.º 5
0
// //
//set the text by index.
func (s Sheet) SetText(x, y int, val string) error {
	cval := C.CString(val)
	defer C.free(unsafe.Pointer(cval))
	code := C.oogo_sheet_set_text(C.sheet_c(s), C.int(x), C.int(y), cval)
	if code == 0 {
		return nil
	} else {
		return Error()
	}
}