PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » File Formats » Spreadsheet_Excel_Writer » Bug #2862

insertBitmap scales image incorrect in Excel 2000

Details

Submitted2004-12-01 09:41 UTC
Fromthomas dot keller at inatec dot com
StatusVerified
PackageSpreadsheet_Excel_Writer
PHP Version4.3.4
OSRH9
Roadmaps(Not assigned)

Comments

[2004-12-01 09:41 UTC] thomas dot keller at inatec dot com

Description:
------------
In Excel 2000 a bitmap is always scaled incorrectly if
it is inserted via insertBitmap (and no scale/ position
attributes), regardless where I put the image.

The author of _positionImage in Worksheet.php notes that

"the SDK incorrectly states that the height should be
expressed as a percentage of 1024."

thus uses for the height a value of only 256.
I changed these values to 1024 which made the insert
work correctly for me.

Reproduce code:
---------------
$file = "/path/to/file/bitmap.bmp";
$worksheet->insertBitmap(0, 0, $file);

[2006-03-01 12:31 UTC] roh at m3 dot net

The scaling is visibly off in Excel 2003, as well, but I didn't have much luck using a factor of 1024 instead of 256.

If my calling code uses a scale of (1, 0.8) to mean (1, 1), I get acceptable results.