diff --git a/comparexlsxlsx.go b/comparexlsxlsx.go deleted file mode 100644 index a161abd..0000000 --- a/comparexlsxlsx.go +++ /dev/null @@ -1,55 +0,0 @@ -package xls - -import ( - "fmt" - "github.com/tealeg/xlsx" - "math" - "strconv" -) - -//Compares xls and xlsx files -func CompareXlsXlsx(xlsfilepathname string, xlsxfilepathname string) string { - xlsFile, err := Open(xlsfilepathname, "utf-8") - if err != nil { - return fmt.Sprintf("Cant open xls file: %s", err) - } - - xlsxFile, err := xlsx.OpenFile(xlsxfilepathname) - if err != nil { - return fmt.Sprintf("Cant open xlsx file: %s", err) - } - - for sheet, xlsxSheet := range xlsxFile.Sheets { - xlsSheet := xlsFile.GetSheet(sheet) - if xlsSheet == nil { - return fmt.Sprintf("Cant get xls sheet") - } - for row, xlsxRow := range xlsxSheet.Rows { - xlsRow := xlsSheet.Row(row) - for cell, xlsxCell := range xlsxRow.Cells { - xlsxText := xlsxCell.String() - xlsText := xlsRow.Col(cell) - if xlsText != xlsxText { - //try to convert to numbers - xlsFloat, xlsErr := strconv.ParseFloat(xlsText, 64) - xlsxFloat, xlsxErr := strconv.ParseFloat(xlsxText, 64) - //check if numbers have no significant difference - if xlsErr == nil && xlsxErr == nil { - diff := math.Abs(xlsFloat - xlsxFloat) - if diff > 0.0000001 { - return fmt.Sprintf("sheet:%d, row/col: %d/%d, xlsx: (%s)[%d], xls: (%s)[%d], numbers difference: %f.", - sheet, row, cell, xlsxText, len(xlsxText), - xlsText, len(xlsText), diff) - } - } else { - return fmt.Sprintf("sheet:%d, row/col: %d/%d, xlsx: (%s)[%d], xls: (%s)[%d].", - sheet, row, cell, xlsxText, len(xlsxText), - xlsText, len(xlsText)) - } - } - } - } - } - - return "" -} diff --git a/issue47_test.go b/issue47_test.go deleted file mode 100644 index 1385ad3..0000000 --- a/issue47_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package xls - -import ( - "io/ioutil" - "path" - "path/filepath" - "strings" - "testing" -) - -func TestIssue47(t *testing.T) { - testdatapath := "testdata" - files, err := ioutil.ReadDir(testdatapath) - if err != nil { - t.Fatalf("Cant read testdata directory contents: %s", err) - } - for _, f := range files { - if filepath.Ext(f.Name()) == ".xls" { - xlsfilename := f.Name() - xlsxfilename := strings.TrimSuffix(xlsfilename, filepath.Ext(xlsfilename)) + ".xlsx" - err := CompareXlsXlsx(path.Join(testdatapath, xlsfilename), - path.Join(testdatapath, xlsxfilename)) - if err != "" { - t.Fatalf("XLS file %s an XLSX file are not equal: %s", xlsfilename, err) - } - - } - } - -} diff --git a/testdata/bigtable.xls b/testdata/bigtable.xls deleted file mode 100644 index e7c7481..0000000 Binary files a/testdata/bigtable.xls and /dev/null differ diff --git a/testdata/bigtable.xlsx b/testdata/bigtable.xlsx deleted file mode 100644 index b54c6fb..0000000 Binary files a/testdata/bigtable.xlsx and /dev/null differ diff --git a/testdata/float.xls b/testdata/float.xls deleted file mode 100644 index dbe9585..0000000 Binary files a/testdata/float.xls and /dev/null differ diff --git a/testdata/float.xlsx b/testdata/float.xlsx deleted file mode 100644 index f399236..0000000 Binary files a/testdata/float.xlsx and /dev/null differ diff --git a/testdata/issue47.xls b/testdata/issue47.xls deleted file mode 100644 index 866f246..0000000 Binary files a/testdata/issue47.xls and /dev/null differ diff --git a/testdata/issue47.xlsx b/testdata/issue47.xlsx deleted file mode 100644 index 146e84c..0000000 Binary files a/testdata/issue47.xlsx and /dev/null differ diff --git a/testdata/negatives.xls b/testdata/negatives.xls deleted file mode 100644 index 47902e3..0000000 Binary files a/testdata/negatives.xls and /dev/null differ diff --git a/testdata/negatives.xlsx b/testdata/negatives.xlsx deleted file mode 100644 index 0d705cc..0000000 Binary files a/testdata/negatives.xlsx and /dev/null differ diff --git a/testdata/superstore.xls b/testdata/superstore.xls deleted file mode 100644 index 34c7090..0000000 Binary files a/testdata/superstore.xls and /dev/null differ diff --git a/testdata/superstore.xlsx b/testdata/superstore.xlsx deleted file mode 100644 index b610f26..0000000 Binary files a/testdata/superstore.xlsx and /dev/null differ diff --git a/testdata/times.xls b/testdata/times.xls deleted file mode 100644 index 585797e..0000000 Binary files a/testdata/times.xls and /dev/null differ diff --git a/testdata/times.xlsx b/testdata/times.xlsx deleted file mode 100644 index 8020038..0000000 Binary files a/testdata/times.xlsx and /dev/null differ