OleExcel

OleExcel

Postby Euclides » Fri Aug 01, 2008 3:13 pm

Hi to all!
I am working with Excel sheets an could not translate some VB commands.

- To change the row height
Rows("15:15").Select
Selection.RowHeight = 39

- There is a rectangle defined and I need to write on it.
ActiveSheet.Shapes("Rectangle 5").Select
Selection.Characters.Text = "X"
With Selection.Characters(Start:=1, Length:=3).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

TIA & Regards, Euclides
User avatar
Euclides
 
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm

Postby gkuhnert » Fri Aug 01, 2008 5:11 pm

Euclides,

maybe you need something like this:

Code: Select all  Expand view  RUN
    oSheet:Rows("15,16"):Rowheight := 35
    oSheet:Rows("11"):Rowheight := 20

    oSelect := ActiveSheet.Shapes("Rectangle 5")
    oSelect:Characters():Text = "X"
    oSelFont:=oSelect:Characters(Start:=1, Length:=3):Font()
    oSelFont:Name := "Arial"
    oSelFont:FontStyle := "Normal"
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Postby Euclides » Tue Aug 05, 2008 2:02 pm

Hi Gilbert, thanks for the replay and sorry for the delay :-))

1 - I quit using SHAPES.

oSelect:=oSheet:Shapes("Rectangle 5")
gives error
Error 1643324/3 DISP_E_MEMBERNOTFOUND: SHAPES

I will write on the cells. is not so fancy but works.

2 - oSheet:Rows("15"):Rowheight := 35
changes the row height, but:
uVar := oSheet:Rows("15"):Rowheight
always returns "*"
there is a way to check the Height of the Row?

TIA and regards, Euclides
User avatar
Euclides
 
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm

Postby Enrico Maria Giordano » Tue Aug 05, 2008 3:11 pm

I don't know if this is useful for you but here it is a working sample I found on my samples directory:

Code: Select all  Expand view  RUN
FUNCTION MAIN()

    LOCAL oExcel, oSheet

    oExcel = CreateObject( "Excel.Application" )

    oExcel:WorkBooks:Add()

    oSheet = oExcel:ActiveSheet

    oSheet:Shapes:AddPicture( "E:\XHARBOUR\SFONDO.JPG", .F., .T., 0, 0, 200, 150 )

    oSheet:Shapes[ 1 ]:IncrementTop( 50 )
    oSheet:Shapes[ 1 ]:IncrementLeft( 50 )

    oSheet:Shapes[ 1 ]:Height = 50
    oSheet:Shapes[ 1 ]:Width = 50

    oExcel:Visible = .T.

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby gkuhnert » Wed Aug 06, 2008 7:18 am

Euclides,

as oSheet:Rows() can contain several rows, there isn't a defined rowheight.
but oSheet:Cells( 1, 15):rowheight seems to work fine, as it only contains this particular cell.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Postby Euclides » Wed Aug 06, 2008 12:43 pm

Thanks Enrico and Gilbert
The project is almost ready.
I only have to find a way to write text into the shapes.
Regards and thanks again.
Euclides
User avatar
Euclides
 
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 66 guests