Coordinates Excel-grid.

Coordinates Excel-grid.

Postby Marc Vanzegbroeck » Thu Oct 15, 2020 11:27 am

Hi,

I want to draw some shapes like this in excel (like a bar-graph).
Image

I want the height of the shapes the same of the grid. How can I calculate the coordinates?
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Coordinates Excel-grid.

Postby MaxP » Mon Oct 19, 2020 3:27 pm

Hi Marc,

try this

Code: Select all  Expand view
#include "Fivewin.ch"

#define msoShapeRectangle       1

FUNCTION MAIN()
        LOCAL   oExcel, oWorkBooks, oSheet, oCell1, oCell2
       
        TRY
                oExcel := TOleAuto():New( "Excel.Application" )
        CATCH
                oExcel := NIL
        END
       
        IF oExcel <> NIL
                oWorkBooks := oExcel:WorkBooks

                IF oWorkBooks <> NIL
                        oWorkBooks:Add()
                        oSheet := oExcel:ActiveSheet                          
                       
                        oCell1 := oSheet:Cells( 4, 2 )
                       
                        oCell2 := oSheet:Cells( 4, 3 )
                       
                        oSheet:Shapes:AddShape( msoShapeRectangle, oCell1:Left, oCell1:Top, oCell1:Width + oCell2:Width, oCell1:Height )
                                               
                        oExcel:Visible := .T.
                ENDIF
        ENDIF
RETURN NIL


Best regards,
Massimo
User avatar
MaxP
 
Posts: 84
Joined: Thu Jul 12, 2007 2:02 pm

Re: Coordinates Excel-grid.

Postby Marc Vanzegbroeck » Mon Oct 19, 2020 4:22 pm

Thank you Massimo.

It's just what I needed.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], karinha and 15 guests