views:

242

answers:

0

I need to copy text from one PowerPoint presentation to another. However, I have problems copying special symbols, such as smileys, which appear in the target presentation as empty boxes. Looking at the Open XML file in the original presentation, I can see that the Run containing the smiley has a "SymbolFont" attribute:

< a:sym typeface="Wingdings" />

However, in VBA, Shape.TextFrame2.TextRange2.Font (the Font of that Run) shows Arial.

How can I determine the SymbolFont of a text Run using VBA or C# (not XML)? Then I could specify that SymbolFont in the target presentation.

Perhaps there other ideas for copying the text not using XML?

Note that this problem happens not only with Smileys; other special characters may show different SymbolFonts, such as:

<a:symTypeface = "Symbol", PitchFamily = 18, CharacterSet = 2>

Code example:

getRuns(TextRange2 paragraph)
{
    foreach(TextRange2 run in paragraph.get_Runs(-1,-1))
    _myRuns.Add(new MyRun {_text=run.Text, _font=run.Font} );
}

copyRunsToParagraph(TextRange2 paragraph)
{
    foreach(MyRun run in _myRuns)
        paragraph=paragraph.InsertAfter(run._text);
}

Note: Run.Font seems to return only the Latin font, not the Symbol font, e.g., Arial but not Wingdings. As I wrote, different symbols may have different SymbolFonts, so always using Wingdings does not work.

Thanks, Arie