Rotating images in Flexcel

Hi,
I have to insert an image to the Excel sheet, which is no problem, but the images have to rotate -90 degrees. I am wondering how to do that because I do not come to a solution by myself...
I uses this example as a start:

    PathToImage := 'C:\880011B.Tif';
    fs := TFileStream.Create(PathToImage, fmOpenRead or fmShareDenyNone);
    try
      ImgProps := TImageProperties_Create();
      ImgProps.Anchor := TClientAnchor.Create(
       TFlxAnchorType.DontMoveAndDontResize,
        3,      //row 3  = top left
        0,      //totally at the top
        1,      //col 1 = left
        0,      //totally at the left
        10,     //row 10 = bottom right
        0,      //totally at the top
        12,     //col 12 = right corner
        0);     //totally at the left
      ImgProps.ShapeName := '880011B.Tif';
      ImgProps.  Rotate(-90);   <===  the method rotate does not exists...

      AddImage(fs, ImgProps);
    finally
      fs.Free;
    end;

Is there a possibility to do this with Flexcel ?

With kind regards,
Frans Link
Amsterdam


Hi,
You can change the object properties after adding the image.
After the AddImage(fs. ImgProps); line, add this line:


xls.SetObjectProperty(-1, '@880011B.Tif', TShapeOption.Rotation, -90.0);



Note that it is important to use 90.0 and not 90, since you need to use the overload to SetObjectProperty that takes a double. There are about 400 object properties you can change with this method, but you need to know in advance which datatype is required by the specific property.

Hi Adrian,

Thank you for your fast answer.
It works fine and I will study this SetObjectProperty because I immediately see many more applications with this.
I can learn a lot from you!

With kind regards,
Frans