Skip to content

Data validation formula length limit is much stricter than Microsoft Excel #972

@Arnie97

Description

@Arnie97

Description

Some valid data validation patterns with non-ASCII characters were rejected by Excelize.

Steps to reproduce the issue:

package main

import (
	"strings"
	"github.com/360EntSecGroup-Skylar/excelize/v2"
)

func main() {
	var cjkStrings = []string{
		strings.Repeat("漢", 255),
	}
	newWorkbookWithDropList(cjkStrings)
}

func newWorkbookWithDropList(choices []string) {
	f := excelize.NewFile()
	dv := excelize.NewDataValidation(false)
	dv.Sqref = "A:A"
	if err := dv.SetDropList(choices); err != nil {
		panic(err)
	}
	f.AddDataValidation(f.GetSheetName(0), dv)
	f.SaveAs("TestDropList.xlsx")
}

Describe the results you received:

panic: data validation must be 0-255 characters

Describe the results you expected:

Produce a file TestDropList.xlsx, which could be loaded in Microsoft Excel successfully

Output of go version:

go version go1.17rc1 linux/amd64

Excelize version or commit ID:

Environment details (OS, Microsoft Excel™ version, etc.):

The data validation pattern provided above were valid in all the following implementations, but not Excelize:

  • Microsoft Office 365 for Mac, 16.49 (21050901)
  • Microsoft Office 365 for Windows, 2102 (Build 13801.20808)
  • Microsoft Office 2019 Professional Plus for Windows, 2105 (Build 14026.20302)
  • Microsoft Office 2013 Professional Plus for Windows, 15.0.4919.1002

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmedThis issue can be reproduced

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions