-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
RemoveRow() return a strange error in the latest version(2.8.1) #1896
Labels
bug
Something isn't working
Comments
ran into a similar thing using
|
Some investigations: Seems that the sheet I was reading and editing was using the same data validation twice. inside of func (f *File) adjustDataValidations(ws *xlsxWorksheet, sheet string, dir adjustDirection, num, offset, sheetID int) error {
for _, sheetN := range f.GetSheetList() {
worksheet, err := f.workSheetReader(sheetN)
if err != nil {
if err.Error() == newNotWorksheetError(sheetN).Error() {
continue
}
return err
}
if worksheet.DataValidations == nil {
return nil
}
for i := 0; i < len(worksheet.DataValidations.DataValidation); i++ {
dv := worksheet.DataValidations.DataValidation[i]
if dv == nil {
continue
}
if sheet == sheetN {
fmt.Println("dv.Sqref", dv.Sqref) /// <<----------------HERE
ref, del, err := f.adjustCellRef(dv.Sqref, dir, num, offset) it was feeding two ranges:
which in turn blew up the insides of func rangeRefToCoordinates(ref string) ([]int, error) {
rng := strings.Split(strings.ReplaceAll(ref, "$", ""), ":")
if len(rng) < 2 {
return nil, ErrParameterInvalid
}
fmt.Println(ref, "ref", rng[0], rng[1]) // HERE
return cellRefsToCoordinates(rng[0], rng[1])
} output:
Temporary fix for me was to remove the problematic datavalidations before editing the sheet:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Steps to reproduce the issue:
When I use the latest version(v2.8.1) to delete some rows in the file, I always get the following error:
Code:
There was no such problem using the previous version, such as v2.6.1。The test file has been posted in the link。
template.xlsx
Output of
go version
:Excelize version or commit ID:
Environment details (OS, Microsoft Excel™ version, physical, etc.):
The text was updated successfully, but these errors were encountered: