Show code in...     

  

 

Object Model ExcelApplication Worksheets Worksheet Cells Cell Range
Charts Chart SeriesCollection Series 3DProperties Axis ChartFrame Line Area
PivotField PivotFields PivotTable PivotTables
Style Characters Font Pictures Picture DocumentProperties PageSetup


ExcelApplication Object Reference

AnsiToUnicode Method


Syntax:
[VBScript]
Function AnsiToUnicode(inAnsi As String, CodePage As Long) As String
Description:
If a client submits a non-Latin alphabet string to a server running a language different from the language of the client's HTML page, to display the string correctly in an Excel spreadsheet the string must be converted to Unicode.

The AnsiToUnicode method takes a non-Latin alphabet string and its language's code page and returns a Unicode string. If the client HTML script's charset property is set to the string's language, and the string is converted to Unicode using AnsiToUnicode, the string will be displayed correctly in the generated spreadsheet.

For a complete list of charset and code page values see, Character Set Recognition.

Example:

The following lines get a Hebrew string from an HTML form, convert the string to Unicode, and assign the string to cell E7. The example uses a specific language code page; to correctly display strings in any language, use code page 65001.

[VBScript]
HebrewString = xlw.AnsiToUnicode(Request.Form("FirstName"), 1255)
ws.Cells("E7").Value = HebrewString

Top


Copyright © 2005, SoftArtisans, Inc.