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 | < | < | < | < |
GREATER THAN | > | > | > | > |
LESS THAN OR EQUAL TO | ≤ | ≤ | ≤ | ≤ |
GREATER THAN OR EQUAL TO | ≥ | ≥ | ≥ | ≥ |
PLUS OR MINUS | ± | ± | ± | ± |
NOT EQUALS | ≠ | ≠ | ≠ | ≠ |
DIVISION SIGN | ÷ | ÷ | ÷ | ÷ |
TIMES X | × | × | × | × |
MINUS | − | − | − | − |
DIVISION SLASH | ∕ | -- | ∕ | ∕ |
FRACTION SLASH | ⁄ | &frasl | ⁄ | ⁄ |
SQUARE ROOT RADICAL | √ | √ | √ | √ |
CUBE ROOT | ? | -- | ∛ | ∛ |
FOURTH ROOT | ? | -- | ∜ | ∜ |
INFINITY | ∞ | ∞ | ∞ | ∞ |
ALEF INFINITY SYMBOL | ℵ | ℵ | ℵ | ℵ |
FUNCTION ITALIC F | ƒ | ƒ | ƒ | ƒ |
PRIME (single quote) | ′ | ′ | ′ | ′ |
DOUBLE PRIME (double quote) | ″ | ″ | ″ | ″ |
TRIPLE PRIME (triple quote) | ? | -- | ‴ | ‴ |
THEREFORE (Triangular Dots) | ∴ | ∴ | ∴ | ∴ |
DOT OPERATOR | ⋅ | ⋅ | ⋅ | ⋅ |
SUPERSCRIPT TWO | ¹ | ¹ | ¹ | ¹ |
SUPERSCRIPT TWO | ² | ² | ² | ² |
SUPERSCRIPT THREE | ³ | ³ | ³ | ³ |
LEFT ANGLE BRACKET | 〈 | ⟨ | 〈 | 〈 |
RIGHT ANGLE BRACKET | 〉 | ⟩ | 〉 | 〉 |
LEFT CEILING BRACKET | ⌈ | ⌈ | ⌈ | ⌈ |
RIGHT CEILING BRACKET | ⌉ | ⌉ | ⌉ | ⌉ |
LEFT FLOOR BRACKET | ⌊ | ⌈ | ⌊ | ⌊ |
RIGHT FLOOR BRACKET | ⌋ | ⌉ | ⌋ | ⌋ |
CIRCLED PLUS (Direct Sum) | ⊕ | ⊕ | ⊕ | ⊕ |
CIRCLED TIMES (Vector Product) | ⊗ | ⊗ | ⊗ | ⊗ |
Superscript Chart(上标)
Character Name | Character | Num Entity | Hex Entity |
---|---|---|---|
SUPERSCRIPT ZERO | ? | ⁰ | ⁰ |
SUPERSCRIPT ONE Entity Code = ¹ |
¹ | ¹ | ¹ |
SUPERSCRIPT TWO Entity Code = ² |
² | ² | ² |
SUPERSCRIPT THREE Entity Code = ³ |
³ | ³ | ³ |
SUPERSCRIPT FOUR | ? | ⁴ | ⁴ |
SUPERSCRIPT FIVE | ? | ⁵ | ⁵ |
SUPERSCRIPT SIX | ? | ⁶ | ⁶ |
SUPERSCRIPT SEVEN | ? | ⁷ | ⁷ |
SUPERSCRIPT EIGHT | ? | ⁸ | ⁸ |
SUPERSCRIPT NINE | ? | ⁹ | ⁹ |
SUPERSCRIPT PLUS SIGN | ? | ⁺ | ⁺ |
SUPERSCRIPT MINUS | ? | ⁻ | ⁻ |
SUPERSCRIPT EQUALS SIGN | ? | ⁼ | ⁼ |
SUPERSCRIPT LEFT PARENTHESIS | ? | ⁽ | ⁽ |
SUPERSCRIPT RIGHT PARENTHESIS | ? | ⁾ | ⁾ |
SUPERSCRIPT LATIN SMALL LETTER I | ? | ⁱ | ⁱ |
SUPERSCRIPT LATIN SMALL LETTER N | ? | ⁿ | ⁿ |
Subscript Codes(下标)
Character Name | Character | Num Entity | Hex Entity |
---|---|---|---|
SUBSCRIPT ZERO | ? | ₀ | ₀ |
SUBSCRIPT ONE | ? | ₁ | ₁ |
SUBSCRIPT TWO | ? | ₂ | ₂ |
SUBSCRIPT THREE | ? | ₃ | ₃ |
SUBSCRIPT FOUR | ? | ₄ | ₄ |
SUBSCRIPT FIVE | ? | ₅ | ₅ |
SUBSCRIPT SIX | ? | ₆ | ₆ |
SUBSCRIPT SEVEN | ? | ₇ | ₇ |
SUBSCRIPT EIGHT | ? | ₈ | ₈ |
SUBSCRIPT NINE | ? | ₉ | ₉ |
SUBSCRIPT PLUS SIGN | ? | ₊ | ₊ |
SUBSCRIPT MINUS | ? | ₋ | ₋ |
SUBSCRIPT EQUALS SIGN | ? | ₌ | ₌ |
SUBSCRIPT LEFT PARENTHESIS | ? | ₍ | ₍ |
SUBSCRIPT RIGHT PARENTHESIS | ? | ₎ | ₎ |
LATIN SUBSCRIPT SMALL LETTER A | ? | ₐ | ₐ |
LATIN SUBSCRIPT SMALL LETTER E | ? | ₑ | ₑ |
LATIN SUBSCRIPT SMALL LETTER O | ? | ₒ | ₒ |
LATIN SUBSCRIPT SMALL LETTER I | ? | ᵢ | ᵢ |
LATIN SUBSCRIPT SMALL LETTER R | ? | ᵣ | ᵣ |
LATIN SUBSCRIPT SMALL LETTER U | ? | ᵤ | ᵤ |
LATIN SUBSCRIPT SMALL LETTER V | ? | ᵥ | ᵥ |
LATIN SUBSCRIPT SMALL LETTER X | ? | ₓ | ₓ |
GREEK SUBSCRIPT SMALL LETTER BETA | ? | ᵦ | ᵦ |
GREEK SUBSCRIPT SMALL LETTER GAMMA | ? | ᵧ | ᵧ |
GREEK SUBSCRIPT SMALL LETTER RHO | ? | ᵨ | ᵨ |
GREEK SUBSCRIPT SMALL LETTER PHI | ? | ᵩ | ᵩ |
GREEK SUBSCRIPT SMALL LETTER CHI | ? | ᵪ | ᵪ |
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 | ¼ | ¼ | ¼ | ¼ |
VULGAR FRACTION 1/2 | ½ | ½ | ½ | ½ |
VULGAR FRACTION 3/4 | ¾ | ¾ | ¾ | ¾ |
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) | μ | μ | μ | μ |
LOWER CASE SIGMA (Standard Deviation) | σ | σ | σ | σ |
LOWER CASE CHI | χ | χ | χ | χ |
CAPITAL PI N-ARY PRODUCT | ∏ | ∏ | ∑ | ∑ |
N-ARY COPRODUCT (upside down capital pi) | ? | -- | ∐ | ∐ |
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 (̄: 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.
Character Name | Character | HTML Code |
---|---|---|
X-Bar (Average) | x? | x̄ |
P-Hat | p? | 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 | ° | ° | ° | ° |
MICRO MU SYMBOL | µ | µ | µ | µ |
SINGLE PRIME (feet, degree minutes) | ′ | ′ | ′ | ߰ |
DOUBLE PRIME (feet, degree minutes) | ″ | ″ | ′ | ߰ |
PER MILLE (1/1000th) | ‰ | ‰ | ‰ | ߮ |
Calculus
Common Calculus Entity Codes
Character Name | Character | Entity | Num Entity | Hex Entity |
---|---|---|---|---|
INTEGRAL | ∫ | ∫ | ∫ | ∫ |
PARTIAL DIFFERENTIAL | ∂ | ∂ | ∂ | ࢚ |
INCREMENT (Difference or capital Delta) | Δ | Δ | ∆ | ∆ |
NABLA (Backward Difference, Grad or upside down triangle) | ∇ | ∇ | ∇ | ∇ |
Additional Integral Symbols
These symbols have numeric entity codes only.
Character Name | Character | Num Entity | Hex Entity |
---|---|---|---|
DOUBLE INTEGRAL | ? | ∬ | ∬ |
TRIPLE INTEGRAL | ? | ∭ | ∭ |
QUADRUPLE INTEGRAL | ? | ⨌ | ⨌ |
CONTOUR INTEGRAL | ∮ | ∮ | ∮ |
SURFACE INTEGRAL | ? | ∯ | ∯ |
VOLUME INTEGRAL | ? | ∰ | ∰ |
CLOCKWISE INTEGRAL | ? | ∱ | ∱ |
ANTICCLOCKWISE INTEGRAL | ? | ⨑ | ⨑ |
CLOCKWISE CONTOUR INTEGRAL | ? | ∲ | ∲ |
ANTICLOCKWISE CONTOUR INTEGRAL | ? | ∳ | ∳ |
Letter Symbols
Character Name | Character | Entity | Num Entity | Hex Entity |
---|---|---|---|---|
INFINITY (Sideways 8) | ∞ | ∞ | ∞ | ∞ |
ALEF INFINITY SYMBOL | ℵ | ℵ | ℵ | ℵ |
WEIERSTRASS POWER SET (Script Capital P) | ℘ | ℘ | ℘ | ℘ |
IMAGINARY NUMBER (Blackletter I) | ℑ | ℑ | ′ | ′ |
REAL NUMBER (Blackletter I) | ℜ | ℜ | ′ | ′ |
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) | ∀ | ∀ | ∀ | ∀ |
COMPLEMENT (Thin C) | ? | -- | ∁ | ∁ |
THERE EXISTS (Backwards E) | ∃ | ∃ | ∃ | ∃ |
THERE DOES NOT EXIST (Backwards E with slash) | ? | -- | ∄ | ∄ |
EMPTY SET (O slash) | ∅ | ∅ | ∅ | ∅ |
NOT SYMBOL (Corner) | ¬ | ¬ | ¬ | ¬ |
TILDE (Alternate Not Symbol) | ˜ | ˜ | -- | -- |
LOGICAL AND (Wedge or Upside down V Symbol) | ∧ | ∧ | ∧ | ∧ |
LOGICAL OR (V Symbol) | ∨ | ∨ | ∨ | ∨ |
XOR | ? | -- | ⊻ | ⊻ |
NAND | ? | -- | ⊼ | ⊼ |
NOR | ? | -- | ⊽ | ⊽ |
INTERSECTION (Cap or Upside Down U) | ∩ | ∩ | ∩ | ∩ |
UNION (Cup or U Symbol) | ∪ | ∪ | ∪ | ∪ |
ELEMENT OF | ∈ | ∈ | ∈ | ∈ |
NOT AN ELEMENT OF | ∉ | ∉ | ∉ | ∉ |
SMALL ELEMENT OF | ? | -- | ∊ | ∊ |
CONTAINS AS MEMBER | ∋ | ∋ | ∋ | ∋ |
DOES NOT CONTAIN AS MEMBER | ? | -- | ∌ | ∌ |
SMALL CONTAINS AS MEMBER | ? | -- | ∍ | ∍ |
SET MINUS | ? | -- | ∖ | ∖ |
SUBSET OF (Sideways U with cap to left) | ⊂ | ⊂ | ⊂ | ⊂ |
SUPERSET OF (Sideways U with cap to right) | ⊃ | ⊃ | ⊃ | ⊃ |
NOT A SUBSET OF (Subset with Slash) | ⊄ | ⊄ | ⊄ | ⊄ |
NOT A SUPERSET OF (Superset with slash) | ? | -- | ⊅ | ⊅ |
SUBSET OF OR EQUAL TO (Subset with line below) | ⊆ | ⊆ | ⊆ | ⊆ |
SUPERSET OF OR EQUAL TO (Superset with line below) | ⊇ | ⊇ | ⊇ | ⊇ |
NEITHER A SUBSET OF NOR EQUAL TO | ? | -- | ⊈ | ⊈ |
NEITHER A SUPERSET OF NOR EQUAL TO | ? | -- | ⊉ | ⊉ |
SUBSET OF WITH NOT EQUAL TO | ? | -- | ⊊ | ⊊ |
SUPERSET OF WITH NOT EQUAL TO | ? | -- | ⊋ | ⊋ |
DIAMOND OPERATOR (Possibility) |
? | -- | ⋄ | ⋄ |
ASYMPTOTICALLY EQUAL TO One to one Correspondence |
? | -- | ≃ | ≃ |
NOT ASYMPTOTICALLY EQUAL TO | ? | -- | ≄ | ≄ |
MULTISET (U with arrow) | ? | -- | ⊌ | ⊌ |
MULTISET MULTIPLICATION (U with dot in center) | ? | -- | ⊍ | ⊍ |
MULTISET UNION (U with plus in center) | ? | -- | ⊎ | ⊎ |
DOUBLE SUBSET | ? | -- | ⋐ | ⋐ |
DOUBLE SUPERSET | ? | -- | ⋑ | ⋑ |
DOUBLE INTERSECTION | ? | -- | ⋒ | ⋒ |
DOUBLE UNION | ? | -- | ⋓ | ⋓ |
N-ARY LOGICAL AND | ? | -- | ⋀ | ⋀ |
N-ARY LOGICAL OR | ? | -- | ⋁ | ⋁ |
N-ARY INTERSECTION&cu | ? | -- | ⋂ | ⋂ |
N-ARY UNION | ? | -- | ⋃ | ⋃ |
CURLY LOGICAL OR | ? | -- | ⋎ | ⋎ |
CURLY LOGICAL AND | ? | -- | ⋏ | ⋏ |
CIRCLED PLUS (Direct Sum) | ⊕ | ⊕ | ⊕ | ⊕ |
CIRCLED TIMES (Vector Product) | ⊗ | ⊗ | ⊗ | ⊗ |
CIRCLED MINUS | ? | -- | ⊖ | ⊖ |
CIRCLED DIVISION SLASH | ? | -- | ⊘ | ⊘ |
Other Element Of Symbols
ELEMENT OF WITH LONG HORIZONTAL STROKE | ? | ⋲ | ⋲ |
ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE | ? | ⋳ | ⋳ |
SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE | ? | ⋴ | ⋴ |
ELEMENT OF WITH DOT ABOVE | ? | ⋵ | ⋵ |
ELEMENT OF WITH OVERBAR | ? | ⋶ | ⋶ |
SMALL ELEMENT OF WITH OVERBAR | ? | ⋷ | ⋷ |
ELEMENT OF WITH UNDERBAR | ? | ⋸ | ⋸ |
ELEMENT OF WITH TWO HORIZONTAL STROKES | ? | ⋹ | ⋹ |
CONTAINS WITH LONG HORIZONTAL STROKE | ? | ⋺ | ⋺ |
CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE | ? | ⋻ | ⋻ |
SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE | ? | ⋼ | ⋼ |
CONTAINS WITH OVERBAR | ? | ⋽ | ⋽ |
SMALL CONTAINS WITH OVERBAR | ? | ⋾ | ⋾ |
NOTATION BAG MEMBERSHIP | ? | ⋿ | ⋿ |
Geometric Symbols
Note: The entity code for the Angle Symbol (∠) is ∠ and the code for the perpendicular angle (⊥) is⊥.
Otherwise, these symbols have numeric codes only.
Angles and Lines
Character Name | Character | Num Entity | Hex Entity |
---|---|---|---|
RIGHT ANGLE | ∟ | ∟ | ∟ |
ANGLE Entity Code = ∠ |
∠ | ∠ | ∠ |
MEASURED ANGLE | ? | ∡ | ∡ |
SPHERICAL ANGLE | ? | ∢ | ∢ |
DIVIDES | ∣ | ∣ | ∣ |
DOES NOT DIVIDE | ? | ∤ | ∤ |
PARALLEL TO | ∥ | ∥ | ∥ |
NOT PARALLEL TO | ? | ∦ | ∦ |
RIGHT ANGLE WITH ARC | ? | ⊾ | ⊾ |
RIGHT TRIANGLE | ⊿ | ⊿ | ⊿ |
UP TACK (Perpendicular) Entity Code = ⊥ |
⊥ | ⊥ | ⊥ |
RIGHT TACK | ? | ⊢ | ⊢ |
LEFT TACK | ? | ⊣ | ⊣ |
DOWN TACK | ? | ⊤ | ⊤ |
Logical Proofs
Note: The entity code for the Therefore Symbol (∴) is ∴. Otherwise, these symbols have numeric codes only.
Character Name | Character | Num Entity | Hex Entity |
---|---|---|---|
THEREFORE (Triangular Dots) Entity Code = ∴ |
∴ | ∴ | ∴ |
BECAUSE (Upside down Triangular Dots) | ∵ | ∵ | ∵ |
PROPORTIONAL TO Entity Code = ∝ |
∝ | ∝ | ∝ |
END OF PROOF (solid rectangle) | ? | ∎ | ∎ |
Common Equivalence and Proportion Operators
Common Equivalence Operators
Character Name | Character | Entity | Num Entity | Hex Entity |
---|---|---|---|---|
NOT EQUALS | ≠ | ≠ | ≠ | ≠ |
APPROXIMATELY EQUAL | ≅ | ≅ | ≅ | ≅ |
ALMOST EQUAL (ASYMPTOTIC) | ≈ | ≈ | ≈ | ≈ |
NOT ALMOST EQUAL TO | ? | -- | ≉ | ≉ |
TILDE SIMILAR TO | ∼ | ∼ | ∼ | ∼ |
IDENTICAL TO (three lines) | ≡ | ≡ | ≡ | ≡ |
NOT IDENTICAL TO | ? | -- | ≢ | ≢ |
Other Equivalence Symbols
STRICTLY EQUIVALENT TO | ? | ≣ | ≣ |
NOT IDENTICAL TO | ? | ≢ | ≢ |
LESS-THAN OVER EQUAL TO | ≦ | ≦ | ≦ |
GREATER-THAN OVER EQUAL TO | ≧ | ≧ | ≧ |
LESS-THAN BUT NOT EQUAL TO | ? | ≨ | ≨ |
GREATER-THAN BUT NOT EQUAL TO | ? | ≩ | ≩ |
MUCH LESS-THAN | ? | ≪ | ≪ |
MUCH GREATER-THAN | ? | ≫ | ≫ |
BETWEEN | ? | ≬ | ≬ |
NOT EQUIVALENT TO | ? | ≭ | ≭ |
NOT LESS-THAN | ≮ | ≮ | ≮ |
NOT GREATER-THAN | ≯ | ≯ | ≯ |
NEITHER LESS-THAN NOR EQUAL TO | ? | ≰ | ≰ |
NEITHER GREATER-THAN NOR EQUAL TO | ? | ≱ | ≱ |
LESS-THAN OR EQUIVALENT TO | ? | ≲ | ≲ |
GREATER-THAN OR EQUIVALENT TO | ? | ≳ | ≳ |
NEITHER LESS-THAN NOR EQUIVALENT TO | ? | ≴ | ≴ |
NEITHER GREATER-THAN NOR EQUIVALENT TO | ? | ≵ | ≵ |
LESS-THAN OR GREATER-THAN | ? | ≶ | ≶ |
GREATER-THAN OR LESS-THAN | ? | ≷ | ≷ |
NEITHER LESS-THAN NOR GREATERTHAN | ? | ≸ | ≸ |
NEITHER GREATER-THAN NOR LESSTHAN | ? | ≹ | ≹ |
NOT TILDE | ? | ≁ | ≁ |
MINUS TILDE | ? | ≂ | ≂ |
ASYMPTOTICALLY EQUAL TO | ? | ≃ | ≃ |
NOT ASYMPTOTICALLY EQUAL TO | ? | ≄ | ≄ |
APPROXIMATELY BUT NOT ACTUALLY EQUAL TO | ? | ≆ | ≆ |
NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO | ? | ≇ | ≇ |
NOT ALMOST EQUAL TO | ? | ≉ | ≉ |
ALMOST EQUAL OR EQUAL TO | ? | ≊ | ≊ |
TRIPLE TILDE | ? | ≋ | ≋ |
ALL EQUAL TO | ≌ | ≌ | ≌ |
原文地址:http://blog.csdn.net/snowdust/article/details/5895593