Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This closes #674, closes #1454, add new exported functions GetTables and DeleteTable #1573

Merged
merged 11 commits into from
Aug 23, 2023
19 changes: 19 additions & 0 deletions table.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,25 @@ func (f *File) AddTable(sheet string, table *Table) error {
return f.addContentTypePart(tableID, "table")
}

func (f *File) GetTables(sheet string) ([]Table, error) {
fsfsx marked this conversation as resolved.
Show resolved Hide resolved
var tables []Table
ws, err := f.workSheetReader(sheet)
if err != nil {
return tables, err
}
for _, tbl := range ws.TableParts.TableParts {
fsfsx marked this conversation as resolved.
Show resolved Hide resolved
if tbl != nil {
target := f.getSheetRelationshipsTargetByID(sheet, tbl.RID)
tableXML := strings.ReplaceAll(target, "..", "xl")
content, ok := f.Pkg.Load(tableXML)
if !ok {
continue
}
}
}
return tables, err
}

// countTables provides a function to get table files count storage in the
// folder xl/tables.
func (f *File) countTables() int {
Expand Down