Cell colorings don't work while using to_spreadsheet Rails gem
up vote
0
down vote
favorite
I used this erb template (test_excel.html.erb) for generating PDF using wicked_pdf gem. PDF generation worked like a charm.
Now, I tried using this same template to generate a spreadsheet using the gem "to_spreadsheet" - https://github.com/glebm/to_spreadsheet
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row" style="padding-bottom: 30px">
<table style="width: 32%; display: inline-table; float:left; background-color:#EAEAEA; margin-right: 10px">
<thead>
<tr style="background-color:#BFBFBF; border: 1pt solid #A6A6A6">
<th style="background-color:#BFBFBF; border: 1pt solid #A6A6A6">Entity</th>
<th>Company Name</th>
</tr>
</thead>
</table>
</div>
</div>
</body>
</html>
This is my controller function that uses the above template:
def show_xlsx
init_report_data
respond_to do |format|
format.html
format.xlsx {render xlsx: :summary3, filename: "Forecast Excel"}
end
end
With the above code, I am able to generate a spreadsheet perfectly fine, but the coloring schemes in the erb template don't reflect on the spreadsheet (but they get applied to PDFs just fine).
This is the PDF that I get with the above template using wicked_pdf gem:

And this is the excel that's generated with the same erb template using to_spreadsheet gem:

What am i missing here? How do I retain the color scheme for spreadsheets as well?
Please help!
ruby-on-rails spreadsheet erb wicked-pdf
add a comment |
up vote
0
down vote
favorite
I used this erb template (test_excel.html.erb) for generating PDF using wicked_pdf gem. PDF generation worked like a charm.
Now, I tried using this same template to generate a spreadsheet using the gem "to_spreadsheet" - https://github.com/glebm/to_spreadsheet
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row" style="padding-bottom: 30px">
<table style="width: 32%; display: inline-table; float:left; background-color:#EAEAEA; margin-right: 10px">
<thead>
<tr style="background-color:#BFBFBF; border: 1pt solid #A6A6A6">
<th style="background-color:#BFBFBF; border: 1pt solid #A6A6A6">Entity</th>
<th>Company Name</th>
</tr>
</thead>
</table>
</div>
</div>
</body>
</html>
This is my controller function that uses the above template:
def show_xlsx
init_report_data
respond_to do |format|
format.html
format.xlsx {render xlsx: :summary3, filename: "Forecast Excel"}
end
end
With the above code, I am able to generate a spreadsheet perfectly fine, but the coloring schemes in the erb template don't reflect on the spreadsheet (but they get applied to PDFs just fine).
This is the PDF that I get with the above template using wicked_pdf gem:

And this is the excel that's generated with the same erb template using to_spreadsheet gem:

What am i missing here? How do I retain the color scheme for spreadsheets as well?
Please help!
ruby-on-rails spreadsheet erb wicked-pdf
@pavelmikhailyuk - would you be able to help me with this issue please? Thanks much!
– Biju
Nov 7 at 16:53
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I used this erb template (test_excel.html.erb) for generating PDF using wicked_pdf gem. PDF generation worked like a charm.
Now, I tried using this same template to generate a spreadsheet using the gem "to_spreadsheet" - https://github.com/glebm/to_spreadsheet
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row" style="padding-bottom: 30px">
<table style="width: 32%; display: inline-table; float:left; background-color:#EAEAEA; margin-right: 10px">
<thead>
<tr style="background-color:#BFBFBF; border: 1pt solid #A6A6A6">
<th style="background-color:#BFBFBF; border: 1pt solid #A6A6A6">Entity</th>
<th>Company Name</th>
</tr>
</thead>
</table>
</div>
</div>
</body>
</html>
This is my controller function that uses the above template:
def show_xlsx
init_report_data
respond_to do |format|
format.html
format.xlsx {render xlsx: :summary3, filename: "Forecast Excel"}
end
end
With the above code, I am able to generate a spreadsheet perfectly fine, but the coloring schemes in the erb template don't reflect on the spreadsheet (but they get applied to PDFs just fine).
This is the PDF that I get with the above template using wicked_pdf gem:

And this is the excel that's generated with the same erb template using to_spreadsheet gem:

What am i missing here? How do I retain the color scheme for spreadsheets as well?
Please help!
ruby-on-rails spreadsheet erb wicked-pdf
I used this erb template (test_excel.html.erb) for generating PDF using wicked_pdf gem. PDF generation worked like a charm.
Now, I tried using this same template to generate a spreadsheet using the gem "to_spreadsheet" - https://github.com/glebm/to_spreadsheet
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row" style="padding-bottom: 30px">
<table style="width: 32%; display: inline-table; float:left; background-color:#EAEAEA; margin-right: 10px">
<thead>
<tr style="background-color:#BFBFBF; border: 1pt solid #A6A6A6">
<th style="background-color:#BFBFBF; border: 1pt solid #A6A6A6">Entity</th>
<th>Company Name</th>
</tr>
</thead>
</table>
</div>
</div>
</body>
</html>
This is my controller function that uses the above template:
def show_xlsx
init_report_data
respond_to do |format|
format.html
format.xlsx {render xlsx: :summary3, filename: "Forecast Excel"}
end
end
With the above code, I am able to generate a spreadsheet perfectly fine, but the coloring schemes in the erb template don't reflect on the spreadsheet (but they get applied to PDFs just fine).
This is the PDF that I get with the above template using wicked_pdf gem:

And this is the excel that's generated with the same erb template using to_spreadsheet gem:

What am i missing here? How do I retain the color scheme for spreadsheets as well?
Please help!
ruby-on-rails spreadsheet erb wicked-pdf
ruby-on-rails spreadsheet erb wicked-pdf
edited Nov 7 at 12:54
asked Nov 7 at 12:48
Biju
497
497
@pavelmikhailyuk - would you be able to help me with this issue please? Thanks much!
– Biju
Nov 7 at 16:53
add a comment |
@pavelmikhailyuk - would you be able to help me with this issue please? Thanks much!
– Biju
Nov 7 at 16:53
@pavelmikhailyuk - would you be able to help me with this issue please? Thanks much!
– Biju
Nov 7 at 16:53
@pavelmikhailyuk - would you be able to help me with this issue please? Thanks much!
– Biju
Nov 7 at 16:53
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53189772%2fcell-colorings-dont-work-while-using-to-spreadsheet-rails-gem%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
@pavelmikhailyuk - would you be able to help me with this issue please? Thanks much!
– Biju
Nov 7 at 16:53