|
|
|
@ -61,7 +61,6 @@ type Cols struct {
|
|
|
|
|
// }
|
|
|
|
|
// fmt.Println()
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
func (f *File) GetCols(sheet string, opts ...Options) ([][]string, error) {
|
|
|
|
|
cols, err := f.Cols(sheet)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -202,7 +201,6 @@ func columnXMLHandler(colIterator *columnXMLIterator, xmlElement *xml.StartEleme
|
|
|
|
|
// }
|
|
|
|
|
// fmt.Println()
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
func (f *File) Cols(sheet string) (*Cols, error) {
|
|
|
|
|
name, ok := f.getSheetXMLPath(sheet)
|
|
|
|
|
if !ok {
|
|
|
|
@ -245,7 +243,6 @@ func (f *File) Cols(sheet string) (*Cols, error) {
|
|
|
|
|
// in Sheet1:
|
|
|
|
|
//
|
|
|
|
|
// visible, err := f.GetColVisible("Sheet1", "D")
|
|
|
|
|
//
|
|
|
|
|
func (f *File) GetColVisible(sheet, col string) (bool, error) {
|
|
|
|
|
colNum, err := ColumnNameToNumber(col)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -278,7 +275,6 @@ func (f *File) GetColVisible(sheet, col string) (bool, error) {
|
|
|
|
|
// Hide the columns from D to F (included):
|
|
|
|
|
//
|
|
|
|
|
// err := f.SetColVisible("Sheet1", "D:F", false)
|
|
|
|
|
//
|
|
|
|
|
func (f *File) SetColVisible(sheet, columns string, visible bool) error {
|
|
|
|
|
start, end, err := f.parseColRange(columns)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -319,7 +315,6 @@ func (f *File) SetColVisible(sheet, columns string, visible bool) error {
|
|
|
|
|
// level of column D in Sheet1:
|
|
|
|
|
//
|
|
|
|
|
// level, err := f.GetColOutlineLevel("Sheet1", "D")
|
|
|
|
|
//
|
|
|
|
|
func (f *File) GetColOutlineLevel(sheet, col string) (uint8, error) {
|
|
|
|
|
level := uint8(0)
|
|
|
|
|
colNum, err := ColumnNameToNumber(col)
|
|
|
|
@ -366,7 +361,6 @@ func (f *File) parseColRange(columns string) (start, end int, err error) {
|
|
|
|
|
// 'level' is 1-7. For example, set outline level of column D in Sheet1 to 2:
|
|
|
|
|
//
|
|
|
|
|
// err := f.SetColOutlineLevel("Sheet1", "D", 2)
|
|
|
|
|
//
|
|
|
|
|
func (f *File) SetColOutlineLevel(sheet, col string, level uint8) error {
|
|
|
|
|
if level > 7 || level < 1 {
|
|
|
|
|
return ErrOutlineLevel
|
|
|
|
@ -416,7 +410,6 @@ func (f *File) SetColOutlineLevel(sheet, col string, level uint8) error {
|
|
|
|
|
// Set style of columns C:F on Sheet1:
|
|
|
|
|
//
|
|
|
|
|
// err = f.SetColStyle("Sheet1", "C:F", style)
|
|
|
|
|
//
|
|
|
|
|
func (f *File) SetColStyle(sheet, columns string, styleID int) error {
|
|
|
|
|
start, end, err := f.parseColRange(columns)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -459,7 +452,6 @@ func (f *File) SetColStyle(sheet, columns string, styleID int) error {
|
|
|
|
|
//
|
|
|
|
|
// f := excelize.NewFile()
|
|
|
|
|
// err := f.SetColWidth("Sheet1", "A", "H", 20)
|
|
|
|
|
//
|
|
|
|
|
func (f *File) SetColWidth(sheet, startCol, endCol string, width float64) error {
|
|
|
|
|
min, err := ColumnNameToNumber(startCol)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -583,7 +575,6 @@ func flatCols(col xlsxCol, cols []xlsxCol, replacer func(fc, c xlsxCol) xlsxCol)
|
|
|
|
|
//
|
|
|
|
|
// width # Width of object frame.
|
|
|
|
|
// height # Height of object frame.
|
|
|
|
|
//
|
|
|
|
|
func (f *File) positionObjectPixels(sheet string, col, row, x1, y1, width, height int) (int, int, int, int, int, int) {
|
|
|
|
|
// Adjust start column for offsets that are greater than the col width.
|
|
|
|
|
for x1 >= f.getColWidth(sheet, col) {
|
|
|
|
@ -670,7 +661,6 @@ func (f *File) GetColWidth(sheet, col string) (float64, error) {
|
|
|
|
|
// index. For example, create a new column before column C in Sheet1:
|
|
|
|
|
//
|
|
|
|
|
// err := f.InsertCol("Sheet1", "C")
|
|
|
|
|
//
|
|
|
|
|
func (f *File) InsertCol(sheet, col string) error {
|
|
|
|
|
num, err := ColumnNameToNumber(col)
|
|
|
|
|
if err != nil {
|
|
|
|
|