How can I replace a character with an unicode image?

Iman

How can I replace a - character in a text which comes from a data base into jasper field, with an image? The goal is as the illustration bellow:

goal

Something like: $F{KN_Zusatzinfo_DV_Einleitungstext}.replaceAll("- ", "[\\x254]") where the x254 is ascii code for a red square.

But the above code writes the ascii code as is in the text and does not produce the image.

Petter Friberg

The correct syntax to render a unicode symbol is \uXXXX

For example this expression:

$F{listItem}.replaceAll("-", "\u2588")

Will render this

Output

Now you like the dot to be red so we need to apply some style, lets set markup="html" on textElement and change the replace to this

$F{listItem}.replaceAll("-", "<font color=\"red\">\u2588</font>")

It will render:

Red dots

Note: You need to be careful with regex in replaceAll, I probably would us ^-, hence starts with - (to avoid replacing other - in text), furthermore the normal way would be to just add a red rectangle element on each row. Also take care of font-extensions if you are exporting to pdf, so that your font is render correctly

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I replace a unicode character in java string

From Dev

How can I replace a character from which I only have the unicode representation?

From Dev

Rails - How can I replace these special character?

From Dev

How can I get the Unicode value of a character in go?

From Dev

How can I write a 3 byte unicode character as string literal

From Dev

How can I determine font and layout information for a unicode character?

From Dev

How can I type a Unicode character (for example, em-dash —?)

From Dev

How can I type a Unicode character (for example, em-dash —?)

From Dev

How can I generate a random unicode character in Swift?

From Dev

How can I replace a unicode string in a binary file?

From Dev

how can i replace unicode String in url for getting json response?

From Dev

How can I replace image with javascript?

From Dev

how to replace unicode "&aring" with norwegian character å

From Java

How can I replace the first occurrence of a character in every word?

From Dev

How can I replace the first occurrence of a character in every word?

From Dev

How can I replace a literal \n with a newline character? (on OS X)

From Dev

How can I replace a character on specific strings on a file?

From Dev

How can i replace double quotes with escape character in java?

From Dev

How can I replace the space character in SVN dump branches name?

From Dev

How can I replace the specific character beginning and end of string?

From Dev

how can i search and replace a non-character in a string in perl?

From Dev

How can I use this unicode symbol - ⓘ - with Imagick to annotate to an image?

From Dev

How can I replace the eighteenth character before space character (without match this only match the space character )?

From Dev

How do I replace unicode character u00A0 with a space in javascript?

From Dev

How to find and replace a particular unicode character with a non-unicode character in an NSString?

From Dev

How can I replace an image being shown via JS?

From Dev

How can I replace the old image when using drawimage and repaint

From Dev

How can I replace the icon arrow of spinner in Android with an image?

From Dev

How can I replace the white rectangle within an image using ImageMagick?

Related Related

  1. 1

    How can I replace a unicode character in java string

  2. 2

    How can I replace a character from which I only have the unicode representation?

  3. 3

    Rails - How can I replace these special character?

  4. 4

    How can I get the Unicode value of a character in go?

  5. 5

    How can I write a 3 byte unicode character as string literal

  6. 6

    How can I determine font and layout information for a unicode character?

  7. 7

    How can I type a Unicode character (for example, em-dash —?)

  8. 8

    How can I type a Unicode character (for example, em-dash —?)

  9. 9

    How can I generate a random unicode character in Swift?

  10. 10

    How can I replace a unicode string in a binary file?

  11. 11

    how can i replace unicode String in url for getting json response?

  12. 12

    How can I replace image with javascript?

  13. 13

    how to replace unicode "&aring" with norwegian character å

  14. 14

    How can I replace the first occurrence of a character in every word?

  15. 15

    How can I replace the first occurrence of a character in every word?

  16. 16

    How can I replace a literal \n with a newline character? (on OS X)

  17. 17

    How can I replace a character on specific strings on a file?

  18. 18

    How can i replace double quotes with escape character in java?

  19. 19

    How can I replace the space character in SVN dump branches name?

  20. 20

    How can I replace the specific character beginning and end of string?

  21. 21

    how can i search and replace a non-character in a string in perl?

  22. 22

    How can I use this unicode symbol - ⓘ - with Imagick to annotate to an image?

  23. 23

    How can I replace the eighteenth character before space character (without match this only match the space character )?

  24. 24

    How do I replace unicode character u00A0 with a space in javascript?

  25. 25

    How to find and replace a particular unicode character with a non-unicode character in an NSString?

  26. 26

    How can I replace an image being shown via JS?

  27. 27

    How can I replace the old image when using drawimage and repaint

  28. 28

    How can I replace the icon arrow of spinner in Android with an image?

  29. 29

    How can I replace the white rectangle within an image using ImageMagick?

HotTag

Archive