/ / एक्सेल एक्सपोर्ट के लिए HTML पर CSS कैसे लागू करें - php, html, एक्सेल, लार्वा-5.1

एक्सेल निर्यात करने के लिए एचटीएमएल पर सीएसएस कैसे लागू करें - PHP, एचटीएमएल, एक्सेल, लार्वेल-5.1

मैं पीएचपी हेडर का उपयोग करके एक्सेल प्रारूप में HTML निर्यात करने की कोशिश कर रहा हूं, लेकिन सीएसएस स्टाइल तत्वों पर लागू नहीं हो रहा है (एक्सेल फ़ाइल में निर्यात करते समय), मैं बूटस्ट्रैप क्लासेस को लागू करने का भी प्रयास करता हूं, लेकिन कोई भाग्य

ध्यान दें: बूटस्ट्रैप कक्षाओं को लागू करते समय, मैंने अपने html में bootstrap.css को शामिल किया

क्या सीएसएस लागू करने के लिए कोई रास्ता उपलब्ध है?

का उपयोग कर हेड

    header("Content-type: application/excel");
header("Content-Disposition: attachment; filename="$filename"");

HTML तत्वों का नमूना लें

<table width="100%" border="1" class="table table-striped table-bordered">
<thead>
<tr>
<td colspan="9" style="font-weight: bold; font-size: 16px; text-align: center;"><h2>Push Notification </h2></td>
</tr>
<tr><td colspan="9"></td></tr>
</thead>

<tbody>
<tr class="heading">
<th colspan="2" ></th>
<th style="width:2% !important">S.no</th>
<th style="width:10% !important">Date</th>
<th style="width:10% !important">App</th>
<th style="width:20%">Category</th>
<th colspan="2" style="width:50%">Message</th>
</tr>

@if($push_notifications->count() > 0)
<?php $counter = 1; ?>
@foreach($push_notifications as $notification)
<tr @if(($counter %2) ==1) bcolor="#c9c9c9" @endif>
<td colspan="2"></td>
<td style="width:2% !important">{!!$counter!!}</td>
<td style="width:10% !important">{!!$notification->date!!}</td>
<td style="width:10% !important">{!!$notification->notificationAppType->name!!}</td>
<td style="width:20%">{!!$notification->notificationCategory->name!!}</td>
<td colspan="2" style="width:50%">{!!htmlentities($notification->message, ENT_QUOTES)!!}</td>
</tr>
<?php $counter++; ?>
@endforeach

@else
<tr>
<td colspan="9">No record available</td>
</tr>
@endif
</tbody>
</table>

उत्तर:

उत्तर № 1 के लिए -1

संक्षिप्त उत्तर है नहीं, आप एक्सेल में css लागू नहीं कर सकते.

हालाँकि, आप कुछ स्वरूपण को लागू कर सकते हैंएक्सेल फ़ाइलों का पाठ, लेकिन फ़ॉर्मेटिंग की मात्रा उस लाइब्रेरी द्वारा सीमित होती है, जिसका उपयोग आप एक्सेल फ़ाइल जनरेट करने के लिए करते हैं और एक्सेल स्वयं को क्या स्वरूपित करते हैं।