GithubHelp home page GithubHelp logo

Comments (6)

cxn03651 avatar cxn03651 commented on July 24, 2024

Hi, chdem

when the sum of array's elements length is bigger than 255, writeexcel
reports error message and exit.
spreadsheet-writeexcel, which is original perl module, also shows same
behavior.

thank you for your report.

'exit' should be replaced with 'raise' in line 302 in formula.rb. I'll fix
it later.

cxn03651

2014-05-22 2:22 GMT+09:00 chdem [email protected]:

I'm trying to create a data_validation list from an array with 10 elements.

I'm getting this error :

TypeError - can't convert String into Integer: writeexcel (1.0.4) lib/writeexcel/formula.rb:302:in convert_string' writeexcel (1.0.4) lib/writeexcel/formula.rb:101:inparse_tokens' writeexcel (1.0.4) lib/writeexcel/formula.rb:52:in parse_formula' writeexcel (1.0.4) lib/writeexcel/data_validations.rb:278:inpack_dv_formula'
writeexcel (1.0.4) lib/writeexcel/data_validations.rb:120:in `dv_record'...

This test throught the error at line 302 of formula.rb :

exit "String in formula has more than 255 chars\n" if length > 255

Concatenation of my 10 array elements gave a string of more than 255
length chars.


Reply to this email directly or view it on GitHubhttps://github.com//issues/38
.

from writeexcel.

chrstphdm avatar chrstphdm commented on July 24, 2024

Hi cxn03651,

So if your recommendation is to replace 'exit' by 'raise', there is no way to have a sum of array's elements length bigger than 255. In other words, we have a limit concerning the number of elements of a validation list. It's a pity.

Is it a 8 bits xls binary format limitation ?

I'm a ruby developper, but I have no knowledge about xls binary specs format. Is there any way to change this limitation ?

Perhaps, with your directives, I could make some corrections, make some tests and if I reach a solution, I could push it on the git.

Chdem

from writeexcel.

cxn03651 avatar cxn03651 commented on July 24, 2024

it seems excel has limitation on data validation.
see https://www.google.com/search?q=excel+data+validation+255

you have another way:

  1. write allowed value not to array but to another worksheet.
  2. specify data_validation parameter such as :value => 'sheet2!A1:A100'

from writeexcel.

vincentpaca avatar vincentpaca commented on July 24, 2024

@cxn03651 the above doesn't actually work. Writing then referencing the source from another worksheet produces an empty sheet.

Adding the reference list to the same worksheet has some issues too, it shifts the reference as you move down in rows. For example, the item list is in B1:B3, adding a data_validation at A2 only returns the items listed in B2:B3. Adding a data_validation on A3 only returns the item in B3 and so on.

from writeexcel.

cxn03651 avatar cxn03651 commented on July 24, 2024

Hi, vincentpaca

Yes, that's bug!
I'll try to fix it, but it'll take long time because I'm busy until next spring.

If you use write_xlsx gem, it works well. :-)

# -*- coding: utf-8 -*-

require 'writeexcel'                            # require 'write_xlsx'

workbook  = WriteExcel.new('issue38.xlsx')      # workbook = WriteXLSX.new('issue38.xlsx')
worksheet = workbook.add_worksheet
worksheet.write('B1', 'a')
worksheet.write('B2', 'b')
worksheet.write('B3', 'c')
worksheet.data_validation('A2',
                      validate: 'list',
                      source:   'B1:B3'
                      )
workbook.close

from writeexcel.

vincentpaca avatar vincentpaca commented on July 24, 2024

Yes. I've just tried that with write_xlsx and it works. :)

from writeexcel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.