none
How to get entities/symbol from <w:sym> element RRS feed

  • Question

  • Hello Everyone,

    I am creating one application using open XML (c#), where I am creating XML from all the paragraphs of the word. Problem starts when inside <w:r>, <w:sym> element comes, which contains the font information and its referenced character code. So, I am missing this content in the generated XML.

    <w:r>
     <w:rPr>
       <w:rFonts w:hint="eastAsia"/>
     </w:rPr>
     <w:sym w:font="CommercialPi BT" w:char="F05A"/>
    </w:r>

    I am not been able to get the exact character/symbol or its equivalent entity values based on its character code and referenced font. Previously, I had the same issue, so I created one XSLT that basically generates the entities based on the font and character code, but for every font its not possible to create XSLT. Here is the way, I was generating the entities:

     <xsl:choose>
          <xsl:when test="@font='Symbol' or @font='MT Symbol'">
            <xsl:choose>
              <xsl:when test="@char='F022'">&#x2200;</xsl:when>
              <xsl:when test="@char='F024'">&#x2203;</xsl:when>
              <xsl:when test="@char='F025'">&#x0025;</xsl:when>
              <xsl:when test="@char='F026'">&#x0026;</xsl:when>
              <xsl:when test="@char='F027'">&#x220B;</xsl:when>
            </xsl:choose>
          </xsl:when>
     </xsl:choose>


    Please let me know, if anyone have any idea, how to fetch the symbol/entity of the referenced code for all the fonts using character code and referenced font information.

    Thanks, 


    Shahab Abbasi

    Tuesday, December 29, 2015 7:00 AM

Answers

  • Hi Shahab,

    The symbol character code specifies the hexadecimal code for the Unicode character value of the symbol. The real symbol content depends on the character code and the font you were using.

    It is easy to develop a form application to show the content for the character code with specific font. For example, we can developing a Form Application to use a textbox control to display the character. Here is an code sample that display the Unicode value(F03A) with Wingdings font for your reference:

    textBox1.Font =new Font( "Wingdings",8);
    textBox1.Text += "\uf03a";

    You can get more detail about symbol char from link below:
    SymbolChar Class

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, December 30, 2015 3:27 AM
    Moderator

All replies

  • Hi Shahab,

    The symbol character code specifies the hexadecimal code for the Unicode character value of the symbol. The real symbol content depends on the character code and the font you were using.

    It is easy to develop a form application to show the content for the character code with specific font. For example, we can developing a Form Application to use a textbox control to display the character. Here is an code sample that display the Unicode value(F03A) with Wingdings font for your reference:

    textBox1.Font =new Font( "Wingdings",8);
    textBox1.Text += "\uf03a";

    You can get more detail about symbol char from link below:
    SymbolChar Class

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, December 30, 2015 3:27 AM
    Moderator
  • Thanks for the reply,

    I tried using code that you mentioned, but I am getting some problems. Here, I want to confirm that, can we use the same character code that I am receiving in the XML file, which is "F05A" in the below example?

    <w:sym w:font="CommercialPi BT" w:char="F05A"/>

    Manually, when I am putting the Unicode Value in the textbox1.Text, then it shows the result, but when I am trying to do it pro grammatically, then I am not getting results, as TextBox1.Text property doesn't support multiple back slashes in the string, which I am getting in the string after appending "\u" value to the char code string. After appending the character code with "\u", I am getting string as "\\uf05a".  Please, let me know, if you can help me in that.

    Thanks,


    Shahab Abbasi

    Wednesday, December 30, 2015 11:58 AM
  • Hi Shahab,

    Yes, we can also use that the character code if the computer also install the "CommercialPi BT" font. And base on the description, you were using multiple back slashes. We are not need to use multiple back slashes.

    And if you still have problem about using the TextBox control, I suggest that you reopen a new thread in Windows Forms General forum.

    Hope it is helpful.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 4, 2016 5:28 AM
    Moderator