Message-ID: <1134304051.9735.1711700757320.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_9734_1213912593.1711700757320" ------=_Part_9734_1213912593.1711700757320 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
When the client and server are running the same language, to corre= ctly display Unicode characters in an Excel spreadsheet, set the charset pr= operty in the script that will display the spreadsheet to either:
For a complete list of charset values, see Character Set Recognition.
Client and Server are not Running the Same Language
The ExcelWriter methods AnsiToUnicode and UnicodeToAnsi allow you to cor= rectly display non-Latin alphabet strings, both when getting a value from a= spreadsheet and displaying it in the browser, and when inserting a string = from the client in a spreadsheet generated on the server. AnsiToUnicode and= UnicodeToAnsi are methods of both ExcelApplication and ExcelTe= mplate.
If a client submits a non-Latin alphabet string to a server running a la= nguage different from the language of the client's HTML page, to display th= e string correctly in an Excel spreadsheet the string must be converted to = Unicode. ExcelWriter's AnsiToUnicode method takes a non-Latin alphabet stri= ng and its language's code page and returns a Unicode string:
UnicodeString =3D AnsiToUnicode(AnsiString, CodePage)=20
To correctly display a non-Latin alphabet string in your ExcelWriter gen= erated spreadsheet where the server's language and the string language are = different:
Set the client-side HTML script's charset property to the string lan= guage's charset. For example, to set the charset to Hebrew, use:
<META HTTP-EQUIV=3D"content-type" CONTENT=3D"t= ext/html;charset=3Dwindows-1255">=20
Use AnsiToUnicode to convert the string to Unicode. The following ex= ample gets a Hebrew string from an HTML form, converts the string to Unicod= e, and assign the string to cell E7:
Set xlw =3D Server.CreateObject("Softartisans.ExcelWriter&q= uot;) HebrewString =3D xlw.ansitounicode(Request.Form("FirstName"), 125= 5) ws.cells("E7").value =3D HebrewString %>=20
Note: If your ExcelWriter script will receive strings f= rom the client in only one language, use that language's code page and char= set. However, to correctly display values in any language, use the UTF-8 ch= arset and 65001 code page.
For a complete list of charset values, see, Character Set Recognition.
To get a non-Latin alphabet string from a spreadsheet, and display the s= tring correctly in the browser from a server running a language different f= rom the language of the client's HTML page, you must:
UnicodeToAnsi takes a Unicode string and the string language's code page= and returns an Ansi string:
AnsiString =3D UnicodeToAnsi(UnicodeString, CodePage)=20
In the following example, Cell E7 contains a Hebrew string represented i= n Unicode. The script converts the string from Unicode to Ansi, and display= s the converted string in the browser. The Hebrew characters will be displa= yed correctly.
<META HTTP-EQUIV=3D"content-type" CONTENT=3D"t= ext/html;charset=3Dwindows-1255"> <% Set xlw =3D Server.CreateObject("Softartisans.ExcelWriter")... response.write xlw.unicodetoansi(order.cells("E7").value, 1255)=20
Note: If your ExcelWriter script will get and display s= trings only in one language, use that language's code page and charset. How= ever, to correctly display values in any language, use the UTF-8 charset an= d 65001 code page.
For a complete list of charset values, see, Character Set Recognition.