Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

farsi(persian) codepage for SheetJS #26

Open
arshi79 opened this issue May 8, 2021 · 0 comments
Open

farsi(persian) codepage for SheetJS #26

arshi79 opened this issue May 8, 2021 · 0 comments

Comments

@arshi79
Copy link

arshi79 commented May 8, 2021

hi
I'm trying to convert an excel file(input type file) to html table. my code does work but it shows most of the letters in unreadable format because most of my excel cells are in farsi and farsi letters are special characters. I know that some arabic codepages cover farsi letters (such as 1256) but my code doesn't show letters correctly even after i use codepage
please help

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="jquery.min.js"></script>
    <script lang="javascript" src="xlsx.full.min.js"></script>
    <script src="JavaScript.js" type="text/javascript"></script>
    <script src="cpexcel.js"></script>
    <script src="cptable.js"></script>
    <script src="1256.js"></script>
    <meta charset="UTF-8" />
</head>
<body>
    <div id="navbar"><span>Red Stapler - SheetJS </span></div>
<div id="wrapper">
        <input type="file" id="input-excel" />
</div>
<script>
        $('#input-excel').change(function(e){
                var reader = new FileReader();
                reader.readAsArrayBuffer(e.target.files[0]);
                reader.onload = function(e) {
                    var data = new Uint8Array(reader.result);
                    var wb = XLSX.read(data, { type: 'array', codepage: 1256,charset:'UTF-8'});
                    var htmlstr = XLSX.write(wb, { sheetIndex:1 , type: 'binary', bookType: 'html',});
                        $('#wrapper')[0].innerHTML += htmlstr;
                }
        });
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant