none
Word displays barcode font incorrectly RRS feed

  • Question

  • Word doesn't display a commonly used code128 barcode font correctly.  This is a standard free to use font that's published all over internet at various sites.

    In Word the font will add a space character (ascii 32) to the end of everything by default.  Note this DOESN'T happen in any other program I've tested including Excel or Wordpad.

    For those interested you can test this yourself quite easily by downloading and installing the font (code128.ttf) from this site http://www.jtbarton.com/Barcodes/Code128.aspx (click on the picture of the barcode in the middle of the page)

    I'm not expecting this to be fixed any time soon but if anyone with knowledge in this domain has any suggestions at all I'd appreciate it.

    Thanks.

    Wednesday, August 22, 2012 4:52 AM

Answers

  • What you are seeing is not the addition of a barcoded space, but the fact of you having applied the barcode character to the paragraph break. For some strange reason, with that font, the pilcrow symbol (ie ¶) displays when Word is set to display all formatting, but a different character displays otherwise. The same applies to manual line breaks. In each case, the font reverts to displaying the equivalent of a space. This behaviour has nothing to do with Word, per se - it may be that Code128 is intended to display such characters when they're encoded - or it may be that the font you're using is defective in that regard. If you don't want that behaviour, the simplest workaround with the font you're using is to ensure paragraph breaks and manual line breaks are formatted in a different font.

    Cheers
    Paul Edstein
    [MS MVP - Word]

    • Marked as answer by Chris43 Wednesday, August 22, 2012 4:13 PM
    Wednesday, August 22, 2012 2:08 PM

All replies

  • When I create a barcode using that font, it looks exactly the same in Word (both typed and within a QUOTE field), Excel and NotePad. Perhaps the problem you're having is that you're actually barcoding a space that follows the intended string.

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Wednesday, August 22, 2012 10:47 AM
  • Hi Paul,

    I can replicate this issue on three different computers (with both Word 2007 and 2010).  If you do the following you should be able to replicate it:

    - Open a blank word page and change the font size to say 100 (only so you can actually see it) and then change the font to Code128

    You should see a barcode character (space char) was inserted without you actually typing anything in, and it can't be removed.  Now do the same in Excel and WordPad (or notepad) and you'll notice upon selecting the font there will be no character inserted.

    I've resolved this for now by changing the last character of the barcode to font size 1 so it's effectively invisible, but it's still a bit messy.. in any case if it's a problem with the font itself Excel and Word shouldn't really provide different results.

    Thanks


    • Edited by Chris43 Wednesday, August 22, 2012 11:07 AM
    Wednesday, August 22, 2012 11:07 AM
  • I'm pretty sure that's the carriage return character.

    For most fonts its invisible, but if you select past the last letter on a line of text (which is usually a full stop) you can see a similar area highlighted.

    Edit: I see what you mean about it not happening with Excel (when you press alt-enter). However, it is visible in WordPad if you select the carriage returns.

    I'm afraid off the top of my head I don't have a better idea for hiding it than what you're already doing. Macropod?

    Edit2: Definitely Unicode 13, the carriage return character. The font just displays it as a space.
    • Edited by JosephFox Wednesday, August 22, 2012 12:53 PM
    Wednesday, August 22, 2012 12:45 PM
  • My advice would be to turn on the display of non-printing characters so that the paragraph marks (and anything else, such as spaces and tabs) are clearly visible on the screen. Then you can avoid selecting things you don't want when applying the font.

    In Word 2007, 2010 that would be the backwards "P" looking button on the Home tab, in the Paragraph group.


    Cindy Meister, VSTO/Word MVP

    Wednesday, August 22, 2012 2:03 PM
    Moderator
  • What you are seeing is not the addition of a barcoded space, but the fact of you having applied the barcode character to the paragraph break. For some strange reason, with that font, the pilcrow symbol (ie ¶) displays when Word is set to display all formatting, but a different character displays otherwise. The same applies to manual line breaks. In each case, the font reverts to displaying the equivalent of a space. This behaviour has nothing to do with Word, per se - it may be that Code128 is intended to display such characters when they're encoded - or it may be that the font you're using is defective in that regard. If you don't want that behaviour, the simplest workaround with the font you're using is to ensure paragraph breaks and manual line breaks are formatted in a different font.

    Cheers
    Paul Edstein
    [MS MVP - Word]

    • Marked as answer by Chris43 Wednesday, August 22, 2012 4:13 PM
    Wednesday, August 22, 2012 2:08 PM
  • Thanks Paul/Joseph/Cindy.  Selecting the pilcrow and changing that to a standard font seemed to do the trick!

    Cheers.

    Wednesday, August 22, 2012 4:16 PM
  • Try this font encoder that is able to integrate barcode font into Word. http://www.keepautomation.com/font_tools/activex_dll_font_encoder.html
    • Proposed as answer by SanMuel Friday, November 1, 2013 1:40 PM
    • Unproposed as answer by SanMuel Friday, November 1, 2013 1:40 PM
    Monday, April 22, 2013 3:03 AM
  • I am trying to use your code128.ttf font in the MicrosoftWord, but is not fine work: not include the START, CHECK AND STOP caracter. 
    Can you Help me?
    Thanks.
    Friday, November 1, 2013 1:41 PM
  • I agreed the pilcrow symbol is doing something to the font, but I have written a program in vb6 which generate code128 barcode using TTF font in word. Without any modifications for 4 years, it had worked happily without the issues.

    Until recently, i added some Arabic and Vietnamese fonts and one day when i tried to use the same program, it gave me the issues described by this thread.

    So i swapped computers and the output is fine from my unmodified code128 generation program.

    It could be some problem with the original fonts (a ttf file) as you said but i also find it strange that adding another fonttype could have such significant affects by my code generation program.

    It is very difficult to troubleshoot something you didn't design.

    To this date, i still can't figure out the implementation/modification solutions to my code128 program with the same computer which i have used for 4 years. The quick fix was just use another computer. However, the interaction between words, fonttype and my program remains a mystery.

    Maybe Sherlock Holmes could help me!


    • Edited by Gerson008 Thursday, January 9, 2014 2:42 AM
    Thursday, January 9, 2014 2:33 AM
  • In all likelihood, your barcode font is being applied to something it shouldn't be. An unintended interaction with one of the new fonts is one possible explanation.

    Cheers
    Paul Edstein
    [MS MVP - Word]


    • Edited by macropodMVP Thursday, January 9, 2014 3:33 AM
    Thursday, January 9, 2014 3:30 AM
  • Hi Chris43,

    Could you please share a Step-by-step guide of how you solved it? I also have same issue, tried show/hide pilcrow and hidden characters but this doesn't solve my problem. Also don't know what to change to standar font...

    Thanks!

    Wednesday, December 3, 2014 9:02 PM
  • There is no step-by-step guide for this - there is only ONE step - select the pilcrow and change its font to something different.

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Wednesday, December 3, 2014 9:41 PM
  • Hi,

    For anyone stuck with this issue like i was, i found a solution. The missing information is a prefix, a stop code and a suffix.

    The prefix/start character is: Ì

    The Check character is: O

    The Suffix/stop character is: Î

    The end result would look like this: ÌCODE-128OÎ

    You will have to manually paste these special characters in to your Excel/Word document as Office doesn't seem to apply these characters to (at least) Code 128.

    Wednesday, April 13, 2016 2:03 AM
  • If you read the discussion in this thread, you will see that the issue under discussion does not concern the omission of any start/stop/check characters but the inclusion of an extra character after the end of the barcode that should not have the barcode font applied.

    Your difficulties would appear to relate to whatever process you're using the generate the barcode. The start/stop characters are always additional to whatever is being encoded and the check character should not be fixed but should vary according to the content being encoded.

    Note also that this thread concerns Word 2010 & earlier. If you're using Word 2013 and the DISPLAYBARCODE field, see: https://msdn.microsoft.com/en-us/library/hh745901%28v=office.12%29.aspx?f=255&MSPPError=-2147217396


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Wednesday, April 13, 2016 2:24 AM
  • I am having the same problem, it is is not being caused by the font. It renders correctly in word 2010. It also works when written left to right and when rotated in a text box. 

    However if you try to type it into the cell of a table and rotate the text, it add additional spaces between the characters which can't be removed. 

    This is quite a serious problem for us as we have over 100 templates that have this barcode and we use it to record all documents sent out so a quick fix would be appreciated. 

    Wednesday, June 29, 2016 3:46 PM

  • This is quite a serious problem for us as we have over 100 templates that have this barcode and we use it to record all documents sent out so a quick fix would be appreciated. 

    If you don't mind using a 3rd party library, you can try this as an alternative - Create barcode in Word in  C#, VB.NET
    Friday, July 22, 2016 8:02 AM
  • I had the same problem. I have solved by editing the font code128 with TypeLight program, copying the Glyph 32 in the Glyph 134 and editing the Glyph 32 leaving it Blank (without bars, but mapped). 

    Then in .Net code I replace in the barcode result the Chr(32) with Chr(134). Works for me and Word 2010 not show this ascii 32 with bars.

    I hope this will help you.

    Regards

    Friday, October 14, 2016 4:05 PM