I am using axlsx_rails in my Rails project to generate an excel file with validations and dropdowns. After generating the File, I tried to open the file in MS Excel and it said that it needs to repair the file and all the validations and dropdowns are cleared off.
Versions
axlsx_rails - 0.1.5
axlsx - 1.3.6
rubyzip - 1.2.0
rails - 4.1.2
ruby - 2.2.2
Code
#excel = Axlsx::Package.new
#excel.workbook.add_worksheet(name: "Samples") do |ws|
ws.add_row #field_names
sheet.add_data_validation("G2:G1000", {
:type => :list,
:formula1 => '"Jim", "Tom", "Jack"',
:showDropDown => false,
:showErrorMessage => true,
:errorTitle => '',
:error => 'Please use the dropdown selector to choose the value',
:errorStyle => :stop,
:showInputMessage => true,
:prompt => 'Choose the value from the dropdown'})
end
#excel.serialize "tmp/SampleTemplate.xlsx"
Sending the file using
send_file "tmp/SampleTemplate.xlsx"
The generated file is working in LibreOffice but not in MSExcel
Please help
Solved. The issue is in the line,
:formula_1 => '"Jim", "Tom","Jack"'
I've changed it to,
:formula_1 => '"Jim, Tom, Jack"'
Related
I am using axlsx gem for the excel sheets in rails. I have a dropdown for source values. However,
it's working fine in Libre Office, but not in Google sheet. Also, I don't understand why Err 509 is there in the dropdown.
Here's the code:
source = Source.all.pluck(:name)
source = source.join(', ')
sheet.add_data_validation("F2:F10", {
:type => :list,
:formula1 => source,
:showDropDown => false,
:showInputMessage => true,
:promptTitle => 'Select source',
:prompt => 'Please select a valid source'
})
The gems are:
gem 'caxlsx'
gem 'caxlsx_rails'
I installed gem rich in my Rails 4.1.5 project. I'm using Active Admin. In my file of admin I have this line that calls rich:
f.input :content, :as => :rich, :config => { :height => '200px' }, :label => 'Conteúdo'
But when I open Active_admin, the rich don't appears (should appear right below the first field):
My gemfile:
gem 'rich', :git => 'https://github.com/kreativgebiet/rich.git'
In my application.rb I have this lines:
config.assets.prefix = '/lince/assets'
config.relative_url_root = '/lince'
config.action_controller.relative_url_root = '/lince'
When I try without this lines, rich works fine.
Anyone can help me? I can't understand why this not working.
Thanks.
rich has not been updated in years. I recommend you look at other WYSIWYG editors
Issue: Net::HTTP calls failing when using jruby with a OpenSSL::SSLError Socket Closed, but working fine using MRI.
Side Note: Calls to many servers work, however this app is calling to a cisco sensor. Again, it works via MRI but not Jruby. I've tried a number of different things to no avail. I've tried jruby 1.6.7, 1.7, and the recently released 1.7.1.dev. I've also tried jruby-openssl-0.7.4, 0.7.7, and 0.8.0.pre3. I've even tried running the script with from Ruby 1.8, and 1.9.
Failing At https://github.com/jruby/jruby/blob/master/src/org/jruby/ext/openssl/SSLSocket.java#L404 ?
Similar Issue in research: http://jira.codehaus.org/browse/JRUBY-6346
Small Back Trace Excerpt
org/jruby/ext/openssl/Utils.java:79:in newError'
org/jruby/ext/openssl/SSL.java:92:innewSSLError'
org/jruby/ext/openssl/SSLSocket.java:192:in connectCommon'
org/jruby/ext/openssl/SSLSocket.java:162:inconnect'
org/jruby/runtime/callsite/CachingCallSite.java:306:in cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:136:incall'
org/jruby/ast/CallNoArgNode.java:64:in interpret'
org/jruby/ast/NewlineNode.java:105:ininterpret'
I have scoured google with no luck. Any help would be greatly appreciated.
It should also be noted that I am running OSX Mountain Lion 10.8.2.
[UPDATE]
I have ran out of time to debug this and used the following workaround:
Gemfile
gem 'typhoeus'
Test method
def send_post(url, body)
response = Typhoeus::Request.post(url,
:method => :post,
:disable_ssl_host_verification => true,
:disable_ssl_peer_verification => true,
:username => #auth[:username],
:password => #auth[:password],
:headers => {
'Accept' => 'text/xml',
'Content-type' => 'application/binary',
'Connection' => 'keepalive',
'Accept-Charset' => 'iso-8859-1,*,utf-8',
'Pragma' => 'no-cache',
'Cache-Control' => 'no-cache',
},
:body => body
)
response
end
When using MassiveRecord over thrift to save a record into HBase, I get a strange "abort" error.
Here is some code that will reproduce the error on Mac OS X, with hbase (0.92.0 and 0.94.0) install via homebrew.
require 'massive_record'
MassiveRecord::ORM::Base.connection_configuration = { :host => 'hbase' }
class Woot < MassiveRecord::ORM::Table
default_scope select(:data)
column_family :data do
field :name, :string
end
end
woot = Woot.new( :name => 'rawr' )
woot.save
This always causes the process to halt, leaving the message
[1] 8756 abort ruby massive_woot.rb
Retrieving works just fine, but I can't seem to save the records.
Here is what the schema looks like:
>> describe 'woots'
DESCRIPTION ENABLED
{NAME => 'woots', FAMILIES => [{NAME => 'data', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', C true
OMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCA
CHE => 'true'}]}
1 row(s) in 0.0190 seconds
This turned out to be a versioning issue. MassiveRecord v0.2.2 depends on thrift 0.6.0 (specified by an "= 0.6.0" version in the Gemfile).
I solved this for now by pulling off the "develop" branch of MassiveRecord from github.
1 error prohibited this {{model}} from being saved
There were problems with the following fields:
* {{attribute}} {{message}}
I am getting this error and code I am using is:
validates_format_of :user_id , :with => /\A(([0-9]{4})-[A-Z]{2}$)\Z/ , :message => "should be in the format 1111-TT", :allow_nil => true, :allow_blank => true
Any idea what's causing this?
I had this same problem using Rails 2 and i18n 0.5.0. Uninstall i18n 0.5.0 or specify the older version (I'm using 0.4.1) in your environment.