#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    8
    Rep Power
    0

    Arabic / Other languages POI Excel Writing


    I have been trying to export data with Arabic characters into excel sheet using
    POI, but just get junk characters as below

    #F' EF #-/ 9ED'! (FC 'D%E'1'* /(J 'DH7FJ H#1 'D'3*A3'1 9F

    Any suggestions/examples on this please?

    sample code below

    <cfimport taglib="./poi/" prefix="poi" />

    <cfset variable.fname="FILES\Cdr-#DATEFORMAT(now(),'DD-MM-YY')#.xls">

    <cfsilent>

    <poi:document file="#ExpandPath( variable.fname )#"

    style=" font-family: Arial; font-size: 10pt ; color: black ; whitespace: nowrap ; ">



    <poi:classes>

    <poi:class

    name="title"

    style="font-family: Arial ; color: white ; background-color: black ; font-size: 18pt ; text-align: center ;"

    />



    <poi:class

    name="header"

    style="font-family: Arial ; background-color: green ; color: white ; font-size: 14pt ;"

    />

    <poi:class

    name="header2"

    style="font-family: Arial ; background-color: red ; color: white ; font-size: 12pt ;"

    />

    <poi:sheets>

    <poi:sheet name="report1" style="margin-left:0.5; margin-right:0.5;">

    <poi:columns>

    <poi:column style="text-align: left ; width:200px ;" />

    <poi:column style="text-align: left ; width:100px ;" />

    <poi:column style="text-align: left ; width:500px;" />

    <poi:column style="text-align: left ; width:300px ;" />



    </poi:columns>



    <!--- <poi:row >

    <poi:cell type="string" value="" colspan="4"/>

    </poi:row> --->



    <poi:row >

    <poi:cell value="Account" />

    <poi:cell value="Name" />

    <poi:cell value="Balance" />

    </poi:row>



    <cfloop query="info">

    <poi:row >

    <poi:cell type="string" value="#gfcpnc#" />

    <poi:cell type="string" value="#g3nm1#" />

    <poi:cell type="string" value="#g3nm1a#" />

    </poi:row>

    </cfloop>



    </poi:sheet>

    </poi:sheets>

    </poi:document>

    </cfsilent>
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,265
    Rep Power
    968
    Sorry, I've never used the POI JSP tag library. If you just display the content on a web page (and not in an Excel file), do the right characters show up?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    8
    Rep Power
    0
    Originally Posted by kiteless
    Sorry, I've never used the POI JSP tag library. If you just display the content on a web page (and not in an Excel file), do the right characters show up?
    yes they do, even in PDF using cfdocument
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,265
    Rep Power
    968
    OK then I'd say that means it is an encoding issue either in POI or in the Excel file. I'd see if you can find anything on specifying the encoding in POI. I've never needed to write anything other than English characters so that's just a guess, but it sounds like its not creating it with UTF-8 encoding.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    8
    Rep Power
    0
    I tried doing that before I posted my question, the forum was my last resort. Couldn't find anything
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    8
    Rep Power
    0
    Originally Posted by safo2000
    I tried doing that before I posted my question, the forum was my last resort. Couldn't find anything
    i just got back to this issue today and found out after some research that upgrading your POI to a newer version (say 3.7) will solve the problem at hand.


IMN logo majestic logo threadwatch logo seochat tools logo