Claudiu Toma
Posts: 42
Joined: 2007-09-04
|
Issue:
I have an XLL add-in (XLLAddin project created w/ addin express version:
Add-in Express?Â?Ô?? 2007 for .NET v3.8.1886).
with a function that returns a string like for instance:
è??Ã?ê (in case you cannot see these chars type ALT-0232 ALT-0193 ALT-0194 ALT-0195 ALT-0218 ALT-0234 in Excel).
Office 2003 doesn't display these chars correctly in the cell. It displays "?" question marks instead.
1. I can insert these chars in Excel 2003 just fine from my Excel COM Add-In by setting the current cell's Value and the chars displays OK, however if this same string comes from the XLL add-in formula it will show "?" instead.
The reason for this seems to be Excel converting the string from Unicode encoding C# to ASCII enconding, loosing all these characters in the process therefore showing "?" instead.
I read this post here:
http://msdn2.microsoft.com/en-us/library/aa730920.aspx
Strings
For the first time, Excel 2007 gives XLLs direct access to wide character Unicode...
2. Can we return an array of bytes instead of a string (C#) in the XLL, so that the C# UDF function to have a return value of type byte[] instead of string? It looks like it's not supported? so that in my C# UDF instead of returning
...
return sRet; //where sret has those è??Ã?ê chars
I would do something like:
byte[] myTranslation = Encoding.Default.GetBytes(sRet);
or
byte[] myTranslation = Encoding.ASCII.GetBytes(sRet);
returning an array of bytes instead of a string to try a workaround that Office's encoding conversion issue in the formula.
2. Doing an automation add-in might help since the limitation is not there, but automation add-ins are only supported starting with Office XP (2002), and we need to support Office 2000.
3. I know of a previous post on a similar case but I didn't see a resolution on the issue:
http://www.add-in-express.com/forum/read.php?FID=5&TID=2796&MID=13214&phrase_id=733771#message13214
Any suggestions?
Your insight is greatly appreciated on the issue since supporting
Office 2000 is critical to this project.
Thanks,
|
|
Claudiu Toma
Posts: 42
Joined: 2007-09-04
|
Forgot to mention that it works fine in Office 2007.
|
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Claudiu.
I am afraid I can't say more than I described in the topic above.
|
|