-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvpagebreak.go
63 lines (48 loc) · 1.15 KB
/
vpagebreak.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package goxcel
import (
"github.com/go-ole/go-ole"
"github.com/go-ole/go-ole/oleutil"
)
type (
VPageBreak struct {
goxcelObj GoxcelObject
comObj *ole.IDispatch
}
)
func newVPageBreak(goxcelObj GoxcelObject, comObj *ole.IDispatch) *VPageBreak {
vpb := new(VPageBreak)
vpb.goxcelObj = goxcelObj
vpb.comObj = comObj
vpb.Releaser().Add(func() error {
vpb.ComObject().Release()
return nil
})
return vpb
}
func NewVPageBreak(vpbs *VPageBreaks, comObj *ole.IDispatch) *VPageBreak {
return newVPageBreak(vpbs, comObj)
}
func (vpb *VPageBreak) Goxcel() *Goxcel {
return vpb.goxcelObj.Goxcel()
}
func (vpb *VPageBreak) Releaser() *Releaser {
return vpb.Goxcel().Releaser()
}
func (vpb *VPageBreak) ComObject() *ole.IDispatch {
return vpb.comObj
}
func (vpb *VPageBreak) Location() (*XlRange, error) {
v, err := oleutil.GetProperty(vpb.ComObject(), "Location")
if err != nil {
return nil, err
}
ra := NewRangeFromVPageBreak(vpb, v.ToIDispatch())
return ra, nil
}
func (vpb *VPageBreak) SetLocation(ra *XlRange) error {
_, err := oleutil.PutProperty(vpb.ComObject(), "Location", ra.ComObject())
if err != nil {
return err
}
return nil
}