2

Is there a way to embed a font to the xls and use it with PHPExcel?

I want custom font because I want to use barcode font in the excel. I tried to embed a barcode image but random dot appears when printing and the barcode scanner cannot read it.

fkingan
  • 321
  • 2
  • 7
  • 15

1 Answers1

1

There isn't. Excel relies on the range of fonts that exist on the client PC where the Excel document is opened. Where a font doesn't exist, it will fall back to members of the font family that exist on that client PC. In the case of a font referenced in an xls file where no member of that font family exists on the client PC, it simply cannot be rendered. This is standard MS Excel behaviour, not specific to PHPExcel-generated files.

The only alternative I can suggest is generating an image file of the barcode, and embedding that image in the xls file.

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
  • 2
    Another alternative is simply offering the font as a download in the same location as the Excel file. Not glamorous, but if you absolutely need to have this font on your users system, then this may work for you. – Warren Sergent Feb 11 '12 at 10:46