Problem setting text containing apostrophe in a portion

Hi

I’m using an expression like
TextFrame.Paragraphs[0].Portions[0].Text = string

where string is some text containing an apostrophe (’). However when the slide containing the portion is viewed inthe final presentation, the apostrophe has been replaced with a square. Is this an encoding issue? Do you have fix?

Regards
Mike Cook

Finally come up with a fix.

The apostrophe was actually a Microsoft Word apostrophe or 0x2019 in Unicode. The same problem will probably be encountered with Word quotes.

I've reproduced the relevant portion of a static helper class I've written to fix this. Any comments welcome.


using System;
using System.Text;

namespace OfficeExport
{

internal sealed class OfficeExportUtility
{
readonly static byte[] SINGLE_HIGH_TURNED_COMMA_QUOTE = new byte[]{24,32};
readonly static byte[] SINGLE_HIGH_COMMA_QUOTE = new byte[]{25,32};
readonly static byte[] SINGLE_OPENING_QUOTE = new byte[]{27,32};
readonly static byte[] DOUBLE_HIGH_TURNED_COMMA_QUOTE = new byte[]{28,32};
readonly static byte[] DOUBLE_HIGH_COMMA_QUOTE = new byte[]{29,32};
readonly static byte[] ELLIPSIS = new byte[]{38,32};

public OfficeExportUtility(){}

internal static string ReplaceWordCharacters(string s)
{
string sReplace = new string(Encoding.Unicode.GetChars(SINGLE_HIGH_TURNED_COMMA_QUOTE));
s = s.Replace(sReplace,"'");
sReplace = new string(Encoding.Unicode.GetChars(SINGLE_HIGH_COMMA_QUOTE));
s = s.Replace(sReplace,"'");
sReplace = new string(Encoding.Unicode.GetChars(SINGLE_OPENING_QUOTE));
s = s.Replace(sReplace,"'");
sReplace = new string(Encoding.Unicode.GetChars(DOUBLE_HIGH_TURNED_COMMA_QUOTE));
s = s.Replace(sReplace,"\"");
sReplace = new string(Encoding.Unicode.GetChars(DOUBLE_HIGH_COMMA_QUOTE));
s = s.Replace(sReplace,"\"");
sReplace = new string(Encoding.Unicode.GetChars(ELLIPSIS));
s = s.Replace(sReplace,"...");
return s;
}
}
}

Dear Mike,

PPT file has 2 different records for unicode and for non-unicode text.
So if you use some own templates you can insert any unicode character to the text and MS PowerPoint will save it as unicode. After that you will have possibility insert unicode characters to the text frame.
Another way is convert unicode characters to ascii. For example apostrophe 0x2019 to 0x27.

Later we will write converter for these ppt records and all strings will be saved as unicode.