FlexCel Studio for VCL/LCL
ContentsIndex
PreviousUpNext
CalcImgDimentions Function

Calculates the image dimensions in pixels given an Excel anchor.

Pascal
procedure CalcImgDimentions(const Workbook: TExcelFile; const Anchor: TClientAnchor; var w: extended; var h: extended); overload;
C++
CalcImgDimentions(const TExcelFile Workbook, const TClientAnchor Anchor, extended w, extended h);
Parameters 
Description 
const Workbook: TExcelFile 
File where the image is located. 
const Anchor: TClientAnchor 
Excel anchor indicating the columns and rows where the image is located. 
var w: extended 
Returns the width in pixels for the image 
var h: extended 
Returns the height in pixels from the image. 

This method is the reverse of CalcImgCells, and it gives you a way to calculate the width and height of an image in pixels. 

 

There are two very similar overloads for this method, one returns the pixels as integers, the other as floating numbers. Even when pixels are integer numbers, the floating point version might be good if you are manipulating the magnitudes (for example adding them), to avoid rounding errors. You can round to pixels at the end of the operations, not on each step.

Copyright (c) 2002-2008 TMS Software. All rights reserved.
What do you think about this topic? Send feedback!