FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Insertar imágen de recurso en Excel
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Insertar imágen de recurso en Excel
Posted: Thu Mar 09, 2023 08:32 PM
Estimados,

Se puede?
Code (fw): Select all Collapse
 oSheet:Pictures:Insert("RECURSO") //Sólo permite con imágenes en disco
Saludos,



Adhemar C.
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Insertar imágen de recurso en Excel
Posted: Fri Mar 10, 2023 02:58 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: Insertar imágen de recurso en Excel
Posted: Fri Mar 10, 2023 05:09 PM
Gracias estimado Joao

Lo he logrado así.
Code (fw): Select all Collapse
    FW_SaveImage( "LOGO", ViaFiles+"logo.png" )
    cLogo:=ViaFiles+"Logo.png"
    oSheet:Range( "R1:R1" ):Select()
    oSheet:Pictures:Insert(cLogo)
Claro que quisiera que fuera directamente :(
Saludos,



Adhemar C.
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Insertar imágen de recurso en Excel
Posted: Mon Mar 13, 2023 07:08 AM
hi

i have ask ChatGPT

how can i insert a Bitmap into Excel sheet via activex ?
You can insert a Bitmap into an Excel sheet via ActiveX by using the InsertPicture method of the Range object.

This method takes two parameters: the path to the Bitmap file and an optional parameter for the PictureType.
For example:
Range("A1").InsertPicture "C:\MyBitmap.bmp", xlBitmap
---

how can i insert a Bitmap into a Cell of a Excel sheet via activex ?
You can insert a Bitmap into a Cell of an Excel sheet via ActiveX by using the InsertPicture method of the Range object. The syntax for this method is:

Range.InsertPicture(Filename, LinkToFile, SaveWithDocument, Left, Top, Width, Height, Anchor).

The Filename parameter is the path to the Bitmap file you want to insert.
The LinkToFile parameter is a Boolean value that determines whether the Bitmap is linked to the file or not.
The SaveWithDocument parameter is a Boolean value that determines whether the Bitmap is saved with the document or not.
The Left, Top, Width, and Height parameters are the coordinates and size of the Bitmap.
The Anchor parameter is an object that determines where the Bitmap is anchored in the cell.
please try it and lt use know if it work
greeting,

Jimmy
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: Insertar imágen de recurso en Excel
Posted: Mon Mar 13, 2023 08:18 PM
Jimmy

It doesn't work :(
Saludos,



Adhemar C.
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Insertar imágen de recurso en Excel
Posted: Tue Mar 14, 2023 01:46 AM
hi,

ChatGPT will (most) not give you running CODE ... it give you Idea and a new Direction

i have never try to put a Bitmap into a Excel Sheet but "Insert" seems me not the Way
after ChatGPT give me a Answer i have search for "InsertPicture" and it does exist
Graphic Object (Excel)

Contains properties that apply to header and footer picture objects.

Collapse sectionRemarks
There are several properties of the PageSetup object that return the Graphic object.

Use the CenterFooterPicture , CenterHeaderPicture , LeftFooterPicture , LeftHeaderPicture , RightFooterPicture , or RightHeaderPicture properties to return a Graphic object.

NoteNote
It is required that "&G" is a part of the LeftFooter string in order for the image to show up in the left footer.

Collapse sectionExample
The following example adds a picture titled: Sample.jpg from the C:\ drive to the left section of the footer. This example assumes that a file called Sample.jpg exists on the C:\ drive.
Code (fw): Select all Collapse
VBA  Copy codeCopy code 
Sub InsertPicture() 
 
 With ActiveSheet.PageSetup.LeftFooterPicture 
 .FileName = "C:\Sample.jpg" 
 .Height = 275.25 
 .Width = 463.5 
 .Brightness = 0.36 
 .ColorType = msoPictureGrayscale 
 .Contrast = 0.39 
 .CropBottom = -14.4 
 .CropLeft = -28.8 
 .CropRight = -14.4 
 .CropTop = 21.6 
 End With 
 
 ' Enable the image to show up in the left footer. 
 ActiveSheet.PageSetup.LeftFooter = "&G" 
 
End Sub

but it seems to have limitation to "Header" and "Footer"
so i´m not sure if it is the right Way for you
greeting,

Jimmy
Posts: 537
Joined: Mon Jan 16, 2006 03:42 PM
Re: Insertar imágen de recurso en Excel
Posted: Tue Mar 14, 2023 11:50 AM

yo lo hago asi

LOCAL cLogo:="c:\systema\bus\ima\logo.bmp"

   oSheet:Shapes:AddPicture( cLogo, .F., .T., 0, 0, 130, 50 )

saludos

Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: Insertar imágen de recurso en Excel
Posted: Tue Mar 14, 2023 12:42 PM

Gracias estimado jbrita

Es lo mismo

La idea es insertar la imagen directamente desde el recurso.

Saludos,



Adhemar C.

Continue the discussion