Search code examples
c#visual-studio-2015crystal-reports

Workaround for Crystal Reports soft hyphen bug


I'm completely new to crystal reports 2013 and am running into the soft hyphen bug (as described in more detail in following SAP Thread). In short: the soft hyphen character won't show up in the generated Crystal report file (but I need this exact character for a barcode validation but it's only shown in the generated PDF).

Since I need the Crystal report file instead of a PDF file, I'm looking for a workaround. I also tried the bug fix mentioned in the link above, but I have to do this fix on many systems, so it's not the best solution yet.

I thought about following workaround: if a Crystal report file is going to be created, the program should generate an image of the bar code text and replace the barcode text with the generated image in the appropriate formula field.

What I want to know is:

  1. Is this workaround even possible?
  2. If not: are there any other, better, workarounds?
  3. If not: do you know a working bugfix?

EDIT:

I tried a few things since I posted my question:

  1. I thought, maybe it's a machine related problem. I'm working on a Windows 8.1 Enterprise, which is a German version. So I tried to recreate this exact problem on an English windows 8.1 OS. Unfortunately, I got the same incorrect barcode. So it doesn't seem to be a machine-related problem.

  2. I generated, programmatically with C#, a string with the "Code128" Font and saved it as a .png file on my machine. It also rendered the soft hyphen as another character (Unicode 172).

The problem is that the barcode128 formula generates a checksum sign and for the exact string, I got a problem with validating, it generates the 173 char. So I can't directly influence the use of the soft hyphen since I need it for the validation.


Solution

  • Finally i've got the answer. It was a problem with my barcode font "Code128.ttf".

    I don't know that much about fonts, but after a while, i decided to change the ascii code of the barcode character. So i opened the font in an editing software for fonts and saw, that there's actually no sign deposited for the soft hyphen. That's a little tricky since the windows character table and other programs are showing an alternate character for the soft hyphen. In my case, it was the Yen character (ascii code 165).

    Either you use another barcode 128 font, or you have to use a font editing software to get the actual character layout.