Excel and FiveWin

Excel and FiveWin

Postby driessen » Mon May 08, 2023 12:15 pm

Hello,

I'm very sorry but I might have asked this question before. Unfortunately I can't find it anymore.

But can someone tell me how to add or delete lines in an Excel worksheet?

Thank you very much in advance for any help.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1399
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Excel and FiveWin

Postby Detlef » Mon May 08, 2023 2:53 pm

Hi Michel,

please, try this for example row #4:

Code: Select all  Expand view
   oSheet := oExcel:Get( "ActiveSheet" )

   oSheet:Rows( 4 ):Delete()
   oSheet:Rows( 4 ):Insert() 

Regards,
Detlef
User avatar
Detlef
 
Posts: 205
Joined: Mon Feb 07, 2022 9:54 pm

Re: Excel and FiveWin

Postby karinha » Mon May 08, 2023 3:11 pm

See if it helps:

Code: Select all  Expand view

// C:\FWH..\SAMPLES\EXCELPRV.PRG

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL oPrn, oFont, nRow, nCol

   USE STATES NEW SHARED

   STATES->( StatesReport() )

   CLOSE STATES

RETURN NIL

STATIC FUNCTION StatesReport()

   LOCAL oPrn, oFont, nRow

   GO TOP

   PRINT oPrn PREVIEW

   // AQUI LIGA O EXCEL.
   oPrn:bToExcel  := {|| ( Alias() )->( StatesToExcel() ) }

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 10 OF oPrn

   PAGE

   nRow  := 1

   WHILE .NOT. Eof()

      SYSREFRESH()

      @ nRow, 5.0 PRINT TO oPrn TEXT FIELD->CODE SIZE  1, 0.4 CM FONT oFont

      @ nRow, 6.0 PRINT TO oPrn TEXT FIELD->NAME SIZE 10, 0.4 CM FONT oFont

      nRow  += 0.5

      SKIP

   ENDDO

   ENDPAGE

   ENDPRINT

   RELEASE FONT oFont

   GO TOP

RETURN NIL

STATIC FUNCTION StatesToExcel()

   LOCAL oExcel, oBook, oSheet, nRow

   oExcel   := ExcelObj()
   oExcel:ScreenUpdating := .F.
   oBook    := oExcel:WorkBooks:Add()
   oSheet   := oExcel:ActiveSheet

   GO TOP

   nRow  := 1

   WHILE .NOT. Eof()

      SYSREFRESH()

      oSheet:Cells( nRow, 1 ):Value := FIELD->CODE

      oSheet:Cells( nRow, 2 ):Value := FIELD->NAME

      nRow++

      SKIP

   ENDDO

   GO TOP

   oSheet:Columns( 1 ):AutoFit()
   oSheet:Columns( 2 ):AutoFit()

   oExcel:ScreenUpdating := .T.
   oExcel:Visible := .T.

RETURN NIL

// FIN / END
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7351
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Excel and FiveWin - Solved

Postby driessen » Mon May 08, 2023 3:27 pm

Thanks a lot for your help.

Problem solved.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1399
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

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