c#中字符串显示上标和下标解决办法

  由于工作的需求,需要在word中插入带入带有上标和下标的字符串,比如这样的一个字符串:SO?²?(mg/L)。在网上搜了好久,终是摸索出点思路。

  解决办法:使用转义字符加Unicode的HexEntity就可以实现了。比如定义一个SO?²?(mg/L)这样的字符串如下:"SO\x2084\x00B2\x207B(mg/L)"。其中x2084为 ?(注意:此处为4的下标) 的Unicode HexEntity,x00B2为 ²(注意:此处为2的上标) 的Unicode HexEntity,x207B为 ?(注意:此处为-的上标) 的Unicode HexEntity。

  

  一些常用字符如下:

Common Arithmetic & Alebgra


Character Name

Character Entity Num 
Entity
Hex 
Entity
LESS THAN < &lt; < <
GREATER THAN > &gt; > >
LESS THAN OR EQUAL TO &le;
GREATER THAN OR EQUAL TO &ge;
PLUS OR MINUS ± &plusmn; ± ±
NOT EQUALS &ne;
DIVISION SIGN ÷ &divide; ÷ ÷
TIMES X × &times; × ×
MINUS &minus;
DIVISION SLASH --
FRACTION SLASH &frasl
SQUARE ROOT RADICAL &radic;
CUBE ROOT ? -- &#x221B
FOURTH ROOT ? -- &#x221C
INFINITY &infin;
ALEF INFINITY SYMBOL &alefsym;
FUNCTION ITALIC F ƒ &fnof; ƒ ƒ
PRIME (single quote) &prime;
DOUBLE PRIME (double quote) &Prime;
TRIPLE PRIME (triple quote) ? --
THEREFORE (Triangular Dots) &there4;
DOT OPERATOR &sdot; &#x22C5
SUPERSCRIPT TWO ¹ &sup1; ¹ ¹
SUPERSCRIPT TWO ² &sup2; ² ²
SUPERSCRIPT THREE ³ &sup3; ³ ³
LEFT ANGLE BRACKET &lang;
RIGHT ANGLE BRACKET &rang;
LEFT CEILING BRACKET &lceil;
RIGHT CEILING BRACKET &rceil;
LEFT FLOOR BRACKET &lceil;
RIGHT FLOOR BRACKET &rceil;
CIRCLED PLUS (Direct Sum) &oplus; &#x2295
CIRCLED TIMES (Vector Product) &otimes; &#x2297

Superscript Chart(上标)

Character Name Character Num 
Entity
Hex 
Entity
SUPERSCRIPT ZERO ? &#x2070
SUPERSCRIPT ONE 
Entity Code = &sup1;
¹ ¹ &#x00B9
SUPERSCRIPT TWO 
Entity Code = &sup2;
² ² &#x00B2
SUPERSCRIPT THREE 
Entity Code = &sup3;
³ ³ &#x00B3
SUPERSCRIPT FOUR ? &#x2074
SUPERSCRIPT FIVE ? &#x2075
SUPERSCRIPT SIX ? &#x2076
SUPERSCRIPT SEVEN ? &#x2077
SUPERSCRIPT EIGHT ? &#x2078
SUPERSCRIPT NINE ? &#x2079
SUPERSCRIPT PLUS SIGN ? &#x207A
SUPERSCRIPT MINUS ? &#x207B
SUPERSCRIPT EQUALS SIGN ? &#x207C
SUPERSCRIPT LEFT PARENTHESIS ? &#x207D
SUPERSCRIPT RIGHT PARENTHESIS ? &#x207E
SUPERSCRIPT LATIN SMALL LETTER I ? &#x2071
SUPERSCRIPT LATIN SMALL LETTER N ? &#x207F

Subscript Codes(下标)

Character Name Character Num 
Entity
Hex 
Entity
SUBSCRIPT ZERO ? &#x2080
SUBSCRIPT ONE ? &#x2081
SUBSCRIPT TWO ? &#x2082
SUBSCRIPT THREE ? &#x2083
SUBSCRIPT FOUR ? &#x2084
SUBSCRIPT FIVE ? &#x2085
SUBSCRIPT SIX ? &#x2086
SUBSCRIPT SEVEN ? &#x2087
SUBSCRIPT EIGHT ? &#x2088
SUBSCRIPT NINE ? &#x2089
SUBSCRIPT PLUS SIGN ? &#x208A
SUBSCRIPT MINUS ? &#x208B
SUBSCRIPT EQUALS SIGN ? &#x208C
SUBSCRIPT LEFT PARENTHESIS ? &#x208D
SUBSCRIPT RIGHT PARENTHESIS ? &#x208E
LATIN SUBSCRIPT SMALL LETTER A ? &#x2090
LATIN SUBSCRIPT SMALL LETTER E ? &#x2091
LATIN SUBSCRIPT SMALL LETTER O ? &#x2092
LATIN SUBSCRIPT SMALL LETTER I ? &#x1D62
LATIN SUBSCRIPT SMALL LETTER R ? &#x1D63
LATIN SUBSCRIPT SMALL LETTER U ? &#x1D64
LATIN SUBSCRIPT SMALL LETTER V ? &#x1D65
LATIN SUBSCRIPT SMALL LETTER X ? &#x2093
GREEK SUBSCRIPT SMALL LETTER BETA ? &#x1D66
GREEK SUBSCRIPT SMALL LETTER GAMMA ? &#x1D67
GREEK SUBSCRIPT SMALL LETTER RHO ? &#x1D68
GREEK SUBSCRIPT SMALL LETTER PHI ? &#x1D69
GREEK SUBSCRIPT SMALL LETTER CHI ? &#x1D6A

Superscript and Subscript

Check these references for other methods to implement superscript/subscript and extra fractions

Fractions

These codes display fractions set to be all within one line with smaller number, but they can be replaced by other ways of typing a fraction (e.g. "1/2"). 
-- means no HTML entity code exists and that a numeric code must be used.

Character Name Character Entity Num 
Entity
Hex 
Entity
VULGAR FRACTION 1/4 ¼ &frac14; ¼ ¼
VULGAR FRACTION 1/2 ½ &frac12; ½ ½
VULGAR FRACTION 3/4 ¾ &frac34; ¾ ¾
VULGAR FRACTION 1/3 ? --
VULGAR FRACTION 2/3 ? --
VULGAR FRACTION 1/5 ? --
VULGAR FRACTION 2/5 ? --
VULGAR FRACTION 3/5 ? --
VULGAR FRACTION 4/5 ? --
VULGAR FRACTION 1/6 ? --
VULGAR FRACTION 5/6 ? --
VULGAR FRACTION 1/8 ? --
VULGAR FRACTION 3/8 ? --
VULGAR FRACTION 5/8 ? --
VULGAR FRACTION 7/8 ? --

Common Statistics

-- means no HTML entity code exists and that a numeric code must be used.

Character Name Character Entity Num 
Entity
Hex 
Entity
LOWER CASE MU (Mean) μ &mu; μ μ
LOWER CASE SIGMA (Standard Deviation) σ &sigma; σ σ
LOWER CASE CHI χ &chi; χ χ
CAPITAL PI N-ARY PRODUCT &prod;
N-ARY COPRODUCT (upside down capital pi) ? -- &#x2210

X-Bar, P-Hat and D-Bar

Some codes like that for x? (X-bar) are actually a combination of two codes - the base letter x plus a code for the line above (&#772: or  ?). Capital letter may need to be reduced in size to accomodate the placement of the combining diacritic.

Note on Safari: These symbols use combining characters and may not be correctly Safari 2 or other older browsers.

Statistical Symbol Codes
Character Name Character HTML Code
X-Bar (Average) x?
P-Hat p?
D-Bar D? <span style="font-size:80%">D</span>̄

Measurement Symbols

Common Symbols

Character Name Character Entity Num 
Entity
Hex 
Entity
DEGREE SYMBOL ° &deg; ° °
MICRO MU SYMBOL µ &micro; µ µ
SINGLE PRIME (feet, degree minutes) &prime; ߰
DOUBLE PRIME (feet, degree minutes) &Prime; ߰
PER MILLE (1/1000th) &permil; ߮

Calculus

Common Calculus Entity Codes

Character Name Character Entity Num 
Entity
Hex 
Entity
INTEGRAL &int;
PARTIAL DIFFERENTIAL &part;
INCREMENT (Difference or capital Delta) Δ &Delta; &#x2206
NABLA (Backward Difference, Grad or upside down triangle) &nabla; &#x2207

Additional Integral Symbols

These symbols have numeric entity codes only.

Character Name Character Num 
Entity
Hex 
Entity
DOUBLE INTEGRAL ? &#x222C
TRIPLE INTEGRAL ? &#x222D
QUADRUPLE INTEGRAL ? &#x2A0C
CONTOUR INTEGRAL &#x222E
SURFACE INTEGRAL ? &#x222F
VOLUME INTEGRAL ? &#x2230
CLOCKWISE INTEGRAL ? &#x2231
ANTICCLOCKWISE INTEGRAL ? &#x2A11
CLOCKWISE CONTOUR INTEGRAL ? &#x2232
ANTICLOCKWISE CONTOUR INTEGRAL ? &#x2233

Letter Symbols

Character Name Character Entity Num 
Entity
Hex 
Entity
INFINITY (Sideways 8) &infin;
ALEF INFINITY SYMBOL &alefsym;
WEIERSTRASS POWER SET (Script Capital P) &weierp;
IMAGINARY NUMBER (Blackletter I) &image;
REAL NUMBER (Blackletter I) &real;
DOUBLE-STRUCK REAL NUMBER (Double R) ? --
COMPLEX NUMBERS (Double C) ? --
NATURAL NUMBERS (Double N) ? --
PRIME NUMBERS (Double P) ? --
RATIONAL NUMBERS (Double Q) ? --
INTEGERS (Double Z) ? --
Character Name Character Entity Num 
Entity
Hex 
Entity
FOR ALL (Upside-down A) &forall; &#x2200
COMPLEMENT (Thin C) ? -- &#x2201
THERE EXISTS (Backwards E) &exist; &#x2203
THERE DOES NOT EXIST (Backwards E with slash) ? -- &#x2204
EMPTY SET (O slash) &empty; &#x2205
NOT SYMBOL (Corner) ¬ &not; ¬ ¬
TILDE (Alternate Not Symbol) ˜ &tilde; -- --
LOGICAL AND (Wedge or Upside down V Symbol) &and; &#x2227
LOGICAL OR (V Symbol) &or; &#x2228
XOR ? -- &#x22BB
NAND ? -- &#x22BC
NOR ? -- &#x22BD
INTERSECTION (Cap or Upside Down U) &cap; &#x2229
UNION (Cup or U Symbol) &cup; &#x222A
ELEMENT OF &isin; &#x2208
NOT AN ELEMENT OF &notin; &#x2209
SMALL ELEMENT OF ? -- &#x220A
CONTAINS AS MEMBER &ni; &#x220B
DOES NOT CONTAIN AS MEMBER ? -- &#x220C
SMALL CONTAINS AS MEMBER ? -- &#x220D
SET MINUS ? -- &#x2216
SUBSET OF (Sideways U with cap to left) &sub; &#x2282
SUPERSET OF (Sideways U with cap to right) &sup; &#x2283
NOT A SUBSET OF (Subset with Slash) &nsub; &#x2284
NOT A SUPERSET OF (Superset with slash) ? -- &#x2285
SUBSET OF OR EQUAL TO (Subset with line below) &sube; &#x2286
SUPERSET OF OR EQUAL TO (Superset with line below) &supe; &#x2287
NEITHER A SUBSET OF NOR EQUAL TO ? -- &#x2288
NEITHER A SUPERSET OF NOR EQUAL TO ? -- &#x2289
SUBSET OF WITH NOT EQUAL TO ? -- &#x228A
SUPERSET OF WITH NOT EQUAL TO ? -- &#x228B
DIAMOND OPERATOR 
(Possibility)
? -- &#x22C4
ASYMPTOTICALLY EQUAL TO 
One to one Correspondence
? -- &#x2243
NOT ASYMPTOTICALLY EQUAL TO ? -- &#x2244
MULTISET (U with arrow) ? -- &#x228C
MULTISET MULTIPLICATION (U with dot in center) ? -- &#x228D
MULTISET UNION (U with plus in center) ? -- &#x228E
DOUBLE SUBSET ? -- &#x22D0
DOUBLE SUPERSET ? -- &#x22D1
DOUBLE INTERSECTION ? -- &#x22D2
DOUBLE UNION ? -- &#x22D3
N-ARY LOGICAL AND ? -- &#x22C0
N-ARY LOGICAL OR ? -- &#x22C1
N-ARY INTERSECTION&cu ? -- &#x22C2
N-ARY UNION ? -- &#x22C3
CURLY LOGICAL OR ? -- &#x22CE
CURLY LOGICAL AND ? -- &#x22CF
CIRCLED PLUS (Direct Sum) &oplus; &#x2295
CIRCLED TIMES (Vector Product) &otimes; &#x2297
CIRCLED MINUS ? -- &#x2296
CIRCLED DIVISION SLASH ? -- &#x2298

Other Element Of Symbols

ELEMENT OF WITH LONG HORIZONTAL STROKE ? &#x22F2
ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE ? &#x22F3
SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE ? &#x22F4
ELEMENT OF WITH DOT ABOVE ? &#x22F5
ELEMENT OF WITH OVERBAR ? &#x22F6
SMALL ELEMENT OF WITH OVERBAR ? &#x22F7
ELEMENT OF WITH UNDERBAR ? &#x22F8
ELEMENT OF WITH TWO HORIZONTAL STROKES ? &#x22F9
CONTAINS WITH LONG HORIZONTAL STROKE ? &#x22FA
CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE ? &#x22FB
SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE ? &#x22FC
CONTAINS WITH OVERBAR ? &#x22FD
SMALL CONTAINS WITH OVERBAR ? &#x22FE
NOTATION BAG MEMBERSHIP ? &#x22FF

Geometric Symbols

Note: The entity code for the Angle Symbol (∠) is &ang; and the code for the perpendicular angle (⊥) is&perp;
Otherwise, these symbols have numeric codes only.

Angles and Lines

Character Name Character Num 
Entity
Hex 
Entity
RIGHT ANGLE &#x221F
ANGLE 
Entity Code = &ang;
&#x2220
MEASURED ANGLE ? &#x2221
SPHERICAL ANGLE ? &#x2222
DIVIDES &#x2223
DOES NOT DIVIDE ? &#x2224
PARALLEL TO &#x2225
NOT PARALLEL TO ? &#x2226
RIGHT ANGLE WITH ARC ? &#x22BE
RIGHT TRIANGLE &#x22BF
UP TACK (Perpendicular) 
Entity Code = &perp;
&#x22A5
RIGHT TACK ? &#x22A2
LEFT TACK ? &#x22A3
DOWN TACK ? &#x22A4

Logical Proofs

Note: The entity code for the Therefore Symbol (∴) is &there4;. Otherwise, these symbols have numeric codes only.

Character Name Character Num 
Entity
Hex 
Entity
THEREFORE (Triangular Dots) 
Entity Code = &there4;
BECAUSE (Upside down Triangular Dots) &#x2235
PROPORTIONAL TO 
Entity Code = &prop;
&#x221D
END OF PROOF (solid rectangle) ? &#x220E

Common Equivalence and Proportion Operators

Common Equivalence Operators

Character Name Character Entity Num 
Entity
Hex 
Entity
NOT EQUALS &ne;
APPROXIMATELY EQUAL &cong;
ALMOST EQUAL (ASYMPTOTIC) &asymp;
NOT ALMOST EQUAL TO ? -- &#x2249
TILDE SIMILAR TO &sim;
IDENTICAL TO (three lines) &equiv;
NOT IDENTICAL TO ? -- &#x2262

Other Equivalence Symbols

STRICTLY EQUIVALENT TO ? &#x2263
NOT IDENTICAL TO ? &#x2262
LESS-THAN OVER EQUAL TO &#x2266
GREATER-THAN OVER EQUAL TO &#x2267
LESS-THAN BUT NOT EQUAL TO ? &#x2268
GREATER-THAN BUT NOT EQUAL TO ? &#x2269
MUCH LESS-THAN ? &#x226A
MUCH GREATER-THAN ? &#x226B
BETWEEN ? &#x226C
NOT EQUIVALENT TO ? &#x226D
NOT LESS-THAN &#x226E
NOT GREATER-THAN &#x226F
NEITHER LESS-THAN NOR EQUAL TO ? &#x2270
NEITHER GREATER-THAN NOR EQUAL TO ? &#x2271
LESS-THAN OR EQUIVALENT TO ? &#x2272
GREATER-THAN OR EQUIVALENT TO ? &#x2273
NEITHER LESS-THAN NOR EQUIVALENT TO ? &#x2274
NEITHER GREATER-THAN NOR EQUIVALENT TO ? &#x2275
LESS-THAN OR GREATER-THAN ? &#x2276
GREATER-THAN OR LESS-THAN ? &#x2277
NEITHER LESS-THAN NOR GREATERTHAN ? &#x2278
NEITHER GREATER-THAN NOR LESSTHAN ? &#x2279
NOT TILDE ? &#x2241
MINUS TILDE ? &#x2242
ASYMPTOTICALLY EQUAL TO ? &#x2243
NOT ASYMPTOTICALLY EQUAL TO ? &#x2244
APPROXIMATELY BUT NOT ACTUALLY EQUAL TO ? &#x2246
NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO ? &#x2247
NOT ALMOST EQUAL TO ? &#x2249
ALMOST EQUAL OR EQUAL TO ? &#x224A
TRIPLE TILDE ? &#x224B
ALL EQUAL TO &#x224C

原文地址:http://blog.csdn.net/snowdust/article/details/5895593

时间: 2024-11-08 22:13:38

c#中字符串显示上标和下标解决办法的相关文章

Excel在任务栏中只显示一个窗口的解决办法

Excel在任务栏中只显示一个窗口的解决办法 以前朋友遇到过这个问题,这次自己又遇到了,习惯了以前的那种在任务栏中显示全部窗口,方便用Alt+Tab键进行切换. 如果同时打开许多Excel工作簿,在桌面任务栏中通常会显示多个工作簿窗口按钮.如果任务栏只中显示了一个Excel窗口按钮,所有的工作簿窗口只出现在Excel程序窗口内部,可能是相关的设置被改动了,可以通过下面方法改回设置: 在Excel 2003中单击菜单“工具→选项”,选择“视图”选项卡,选择“任务栏中的窗口”. 在Excel 200

项目中遇到的某些问题及解决办法(一)

简介 该博文记录了一些平时在工作中遇到的问题及解决办法,某些问题有解决办法,某些问题暂时没有解决办法,如果有大神知道的,请多多指点. 如果某些问题有更好的解决办法,也请指教. 正文 1.在一个方法中用泛型操作两个不同的类型(Type). 难点:需要实现一个方法,进入参数一个泛型,返回信息一个泛型.但是一个方法中泛型只支持一种类型. 解决办法:将进入和返回放在一个类型中,用特性将进入参数和返回参数区分开. 2.微信三方登录,需要在PC桌面应用端+API服务实现. 难点:微信官网只提供了网页三方登录

android 自定义adapter和线程结合 + ListView中按钮滑动后状态丢失解决办法

adapter+线程 1.很多时候自定义adapter的数据都是来源于服务器的,所以在获取服务器的时候就需要异步获取,这里就需要开线程了(线程池)去获取服务器的数据了.但这样有的时候adapter的中没有数据. 如下面的代码: 这就是在initData中异步获取服务器的数据,然后实例化adatper,再将adapter赋给listView. 2.initData()中的代码是: 这里线程要睡眠5秒钟,是为了模仿网络的耗时操作 3.Handler: 在Handler中接收到数据后给list赋值后,

20170514002Oracle 11g R2安装过程中遇到的报错及解决办法

Oracle 11g R2安装过程中遇到的报错及解决办法 1.提示Check if the DISPLAYvariable is set.    Failed<<<< 解决方案: #xhost +  //切换到root用户输入 #su – Oracle  //切换到oracle用户 $./runInstaller  //执行安装程序 xhost 是用来控制X server访问权限的. 通常当你从hostA登陆到hostB上运行hostB上的应用程序时, 做为应用程序来说,hostA

php中curl不支持https的解决办法

在php程序中使用curl去访问https站点时,报错:Protocol https not supported or disabled in libcurl 该错误信息表示php当时编译时使用的curl库不支持https, 验证方法为你的curl安装目录/bin/curl  -V  显示如下:Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp这表示curl是不支持 https的 为了支持https,需要下载源

Eclipse导入MyEclipse工程(web项目显示为java项目解决办法)

在直接Import MyEclipse的项目文件导入到Eclipse之后,需要在项目所放的workspace内修改引入项目目录下的.project文件,修改如下: 1.在eclipse中新建一个WEB项目将根目录下下的.project文件覆盖到导出的项目同样目录下, 2.打开导入项目的.project文件,修改下<name>test</name>中间的值即可 之后,刷新项目工程文件.继而,右键项目-->Properties-->选择Project Facets,勾选Dy

checkbox属性checked=&quot;checked&quot;已有,但却不显示打勾的解决办法

checkbox属性checked="checked"已有,但却不显示打勾的解决办法 #### 查阅其他网站  发现主要是因为Jquery的版本问题 1.attr(): 获取匹配的元素集合中的第一个元素的属性的值 或 设置每一个匹配元素的一个或多个属性. 在jQuery 1.6中,当属性没有被设置时候,.attr()方法将返回undefined.若要检索和更改DOM属性,比如元素的checked, selected, 或 disabled状态,请使用.prop()方法. 2.remov

Easyui Datagrid rownumbers行号四位、五位显示不完全的解决办法

Easyui Datagrid rownumbers行号四位.五位显示不完全的解决办法(引) 方法一: 相信很多人在使用easyui的时候都遇到过这个问题,当我们设置成显示Rownumber的时候,你会发现,如果Rownumber越来越大,达到三位数或者四位数的时候,Rownumber就显示不全了.这个问题纠结了不知道多少人,在群里和论坛里面都的都被问到无数次了. 以前也一直没有太认真考虑过要解决这个问题,恰好最近有点时间,就研究了一下,其实要解决也很简单,扩展一个方法就行了. 首先,从data

iOS开发- iOS7显示偏差(UITableView下移)解决办法

之前碰到过一个问题. 就是利用storyboard拖动出来的控件, 在iOS7上跑老是莫名的下移. 比如这样(红色区域为多余的) 解决办法: iOS7在Conttoller中新增了这个属性: automaticallyAdjustsScrollViewInsets,当设置为YES时(默认YES),如果视图里面存在唯一一个UIScrollView或其子类View,那么它会自动设置相应的内边距,这样可以让scroll占据整个视图,又不会让导航栏遮盖. 我们设置automaticallyAdjusts