Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Aishan's avatar

Display excel sheet from right to left after exporting html table

Below is my Java script code to export my table result into excel file format but I need the header font be bold and also the page displays from right to left in excel file, since the language is Arabic.

<script>

        function ExportToExcel(type, fn, dl) {
            var elt = document.getElementById('tblexp');
            var wb = XLSX.utils.table_to_book(elt, { sheet: "sheet1" });
            return dl ?
                XLSX.write(wb, { bookType: type, bookSST: true, type: 'base64' }) :
                XLSX.writeFile(wb, fn || ('MySheetName.' + (type || 'xlsx')));
        }

    </script>

<div class="input-group"><button class=" btn btn-secondary" onclick="ExportToExcel('xlsx')">Export table to excel</button></div>

0 likes
3 replies

Please or to participate in this conversation.