Export Picture to Excel with Auto-scale

KeeperRUKeeperRU Posts: 43Member
Hi,

I try to use something like this:
xlSheet.Shapes.AddPicture(FilePathAndName, 1, 1, 20, 20, 100, 100);

but problem with 2 last parameters, because my pictures have different size.
Which method may i use to export pictures without declare width and height?
(original size)

Comments

  • KeeperRUKeeperRU Posts: 43Member
    Or how can I get image size (in the BLOB field)?

    to put it in function:
    xlSheet.Shapes.AddPicture(FilePathAndName, 1, 1, 20, 20, WIDTH, HEIGHT)
  • LambaLamba Posts: 254Member
    Can u plz explain how u flowed the image in a Report's excel, from the start
  • KeeperRUKeeperRU Posts: 43Member
    That simple:
    ItemPicture.CALCFIELDS(Picture);
    IF ItemPicture.Picture.HASVALUE THEN BEGIN
      FilePath := ENVIRON('TEMP') + '\IMG.bmp';
      ItemPicture.Picture.EXPORT(FilePath);
      XlsBuf.ExportPicture(FilePath, 1, 1, 0, 493, 370, 250);
    END;
    

    Where XlsBuf is Record of (Excel Buffer).
    In Excel Buffer I create Function "ExportPicture":
    XlWrkSht.Shapes.AddPicture(FilePathAndName, Param2, Param3, Param4, Param5, Param6, Param7);
    
    Where XlWrkSht is Excel Automation.

    This method requred to determine this parameters (Param6 - WIDTH, Param7 - Height), but my pictures have very different sizes and I need auto-scale
  • LambaLamba Posts: 254Member
    I Keeper RU,
    I have a customized report in the series 50000,
    the report prints a image in classic.
    The export to excel functionality is completed.
    How could i get the same image that is printing for classic, in the excel sheet
  • KeeperRUKeeperRU Posts: 43Member
    Lamba wrote:
    I Keeper RU,
    I have a customized report in the series 50000,
    the report prints a image in classic.
    The export to excel functionality is completed.
    How could i get the same image that is printing for classic, in the excel sheet

    I have described above, all the necessary code.

    In "Excel Buffer" (table) I create Function "ExportPicture" (with 7 parameters):
    XlWrkSht.Shapes.AddPicture(FilePathAndName, Param2, Param3, Param4, Param5, Param6, Param7);

    In the report I call this function:
    XlsBuf.ExportPicture(FilePath, 1, 1, 0, 493, 370, 250);
Sign In or Register to comment.