#!usr/bin/perl -wl use Font::TTFMetrics; my $font = Font::TTFMetrics->new('c:\windows\fonts\arial.ttf'); my $font_size = 10; my $dpi = 96; my $units_per_em = $font->get_units_per_em(); my $font_width = $font->string_width("Some sort of long string"); # The following expression is from the TTFMetrics docs. my $pixel_width = $font_width *$font_size *$dpi /(72 *$units_per_em); # The following expression is from the Spreadsheet::WriteExcel internals. my $cell_width = ($pixel_width -5) /7; # For cell widths > 1 print $cell_width;