当前位置: 动力学知识库 > 问答 > 编程问答 >

wpf - rtf discrepency in italic (wordpad/msword)

问题描述:

i'm trying to figure this out for a few weeks, and i think i may have boiled down the problem

for now the issue is only in Hebrew text (though ill use Latin chars for simplicity)

if i have in a wpf richtextbox

p*q* (the q is italic)

and then copy it to ms word, i see both chars as non italic

now heres whats funny:

  1. in ms word both chars show up as normal
  2. when i click on the "q" the "I" (italics button) in words ribbon light up to indicate that this character is italics, its just not evident in the main window
  3. in wordpad it shows up just fine

so next logical step was to disseminate the rtf, so heres the original rtf emitted to the clipboard by wpf

{\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2{\fonttbl{\f0\fcharset0 Times New Roman;}{\f2\fcharset0 Segoe UI;}}{\colortbl\red0\green0\blue0;\red255\green255\blue255;}\loch\hich\dbch\pard\plain\ltrpar\itap0{\lang1033\rtlpar\fs24\f2\cf0 \cf0\qr{\f2 \rtlpar{\lang1037\rtlch \u1488?}{\lang1037\i\rtlch \u1489?}\li0\ri0\sa0\sb0\fi0\qr\sl454\slmult0\par}}}

opening this up in msword gives the problematic result

making one small change fixes the issue, if i remove the first "rtlch",like this:

{\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2{\fonttbl{\f0\fcharset0 Times New Roman;}{\f2\fcharset0 Segoe UI;}}{\colortbl\red0\green0\blue0;\red255\green255\blue255;}\loch\hich\dbch\pard\plain\ltrpar\itap0{\lang1033\rtlpar\fs24\f2\cf0 \cf0\qr{\f2 \rtlpar{\lang1037 \u1488?}{\lang1037\i\rtlch \u1489?}\li0\ri0\sa0\sb0\fi0\qr\sl454\slmult0\par}}}

so whats going on here? and more importantly, how do i go about fixing it? can i just manually remove all the "rtlch" from the rtf? im not sure of the implications

thank you !!

分享给朋友:
您可能感兴趣的文章:
随机阅读: