Insert an image on header

Elite237

New Member
Hi all

Somebody can suggest me a solution please: I want insert an image in the header of Excel, but I don't know how do it.

I am using this line to insert a text:
chWorkSheet:pageSetup:LeftHeader = "Hola". and without problems. But with images, how could be? the versión of my Excel is 2010 Standard. The versión of Progress is 10.2B

Thanks

Regards
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
Try this (I chose center, but I suppose you could also do left or right):
Code:
chWorkSheet:PageSetup:CenterHeaderPicture:Filename = 
  "C:\users\robf\pictures\2012GTI.jpg".
 

Elite237

New Member
Hi Rob. Thanks for reply. I tried with your code:

chWorkSheet:pageSetup:LeftHeaderPicture:FILENAME = "C:\nom_v10\cam_carm\Iconos\Fondo_OCEANIC.JPG".

but not inserted the image.

Other idea?

Cheers
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
OK, I was being lazy and just using the macro recorder. That usually works when all the methods, properties, and events of the Object Model are available from COM, but... :(

According to the Progress COM Object Viewer (proobjvw.exe), LeftHeaderPicture (and other similar properties of PageSetup) are read-only, unfortunately:
Code:
Progress Syntax            (Property READ-ONLY)
Property Get:   [ Com-Handle-Var = ] <com-handle>:LeftHeaderPicture.

You can get/set headers and footers, but for some reason there is no setter for header or footer pictures.

There is another approach you could take that might work, although it's not exactly elegant. Leave room in your worksheet so you can insert your picture into cell A1 (or somewhere in row 1). Then do something like the following:
Code:
chWorkSheet:Pictures:Insert("C:\pics\mypic.jpg").
PageSetup.PrintTitleRows = "$1:$1".

That will cause the picture to appear at the top left of every page.
 

Elite237

New Member
Hi Rob. Looking for in the MSDN page. I found that:

It is required that "&G" be a part of the LeftHeader property string in order for the image to show up in the left header.

And my problem was resolved thanks to you.

Finally my code is:

chWorkSheet:pageSetup:LeftHeaderPicture:FILENAME = "C:\nom_v10\cam_carm\Iconos\GrupoR2.bmp".
chWorkSheet:pageSetup:LeftHeader = "&G".

Thanks Rob
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
Yeah, I discovered the same thing. And when I tried that in the procedure editor it bombed. Oh well. Glad you figured it out. :)
 
Top