Page 1 of 1
Coordinates Excel-grid.
Posted: Thu Oct 15, 2020 11:27 am
by Marc Vanzegbroeck
Hi,
I want to draw some shapes like this in excel (like a bar-graph).
I want the height of the shapes the same of the grid. How can I calculate the coordinates?
Re: Coordinates Excel-grid.
Posted: Mon Oct 19, 2020 3:27 pm
by MaxP
Hi Marc,
try this
Code: Select all
#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
Re: Coordinates Excel-grid.
Posted: Mon Oct 19, 2020 4:22 pm
by Marc Vanzegbroeck
Thank you Massimo.
It's just what I needed.