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:



PDF



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



Excel



What am i missing here? How do I retain the color scheme for spreadsheets as well?



Please help!










share|improve this question
























  • @pavelmikhailyuk - would you be able to help me with this issue please? Thanks much!
    – Biju
    Nov 7 at 16:53















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:



PDF



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



Excel



What am i missing here? How do I retain the color scheme for spreadsheets as well?



Please help!










share|improve this question
























  • @pavelmikhailyuk - would you be able to help me with this issue please? Thanks much!
    – Biju
    Nov 7 at 16:53













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:



PDF



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



Excel



What am i missing here? How do I retain the color scheme for spreadsheets as well?



Please help!










share|improve this question















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:



PDF



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



Excel



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • @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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

Academy of Television Arts & Sciences

L'Équipe

1995 France bombings