FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour tsbrowse metod toExcel (SOLUCIONADO)
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
tsbrowse metod toExcel (SOLUCIONADO)
Posted: Tue Nov 04, 2014 10:39 PM

Estimados

Alguien tiene la clase tsbrowse en el metodo toexcel sin toleauto, ya que con harbour 3.2 genera error aletorio
he pasodo a oExcel := CREATEOBJECT( "Excel.Application" )
pero igual sale error

Error description: (DOS Error -2147352562) WINOLE/1007 Error de argumento: SET
Args:
[ 1] = C HorizontalAlignment
[ 2] = N 7

Stack Calls

Called from: => TOLEAUTO:SET( 0 )
Called from: ..\Source\Classes\tsbrowse.prg => TSBROWSE:EXCELOLE( 3982 )

Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tsbrowse metod toExcel
Posted: Thu Nov 06, 2014 01:24 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Re: tsbrowse metod toExcel
Posted: Sat Nov 08, 2014 01:14 AM

gracias, pero utiliza toleauto

Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tsbrowse metod toExcel
Posted: Mon Nov 10, 2014 12:09 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tsbrowse metod toExcel
Posted: Mon Nov 10, 2014 12:23 PM

Ejiste un sbexcel.prg en el \samples de TsBrowse?

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tsbrowse metod toExcel
Posted: Mon Nov 10, 2014 12:30 PM
Code (fw): Select all Collapse
* TSBrowse testing Excel conections - c:\tsbrowse\samples\TESTXLS.PRG

#include "FiveWin.ch"
#include "\TSBrowse\Include\TSBrowse.ch"

#define CLR_PINK   nRGB( 255, 128, 128)
#define CLR_NBLUE  nRGB( 128, 128, 192)

Static oWnd, oBrw

Request DBFCDX

//--------------------------------------------------------------------------------------------------------------------//

Function Main()

   Local oBmp, oBar, oFont, oFont1, oBrush, oCol, cTitle, lGrid

   If File( "Employee.cdx" )
      FErase( "Employee.cdx" )
   EndIf

   Use Employee Shared New Via "DBFCDX"
   Index On First+Last Tag Name

   Define Font oFont Name "Arial" Size 0, -13
   Define Font oFont1 Name "Arial" Size 0, -13 NESCAPEMENT 900
   Define Brush oBrush Resource "CoverBack"
   Define BitMap oBmp Resource "Selector"
   Define Window oWnd TITLE "TSBrowse/Excel conectivity.    One Click From TSBrowse To Excel   And more..." ;
          Brush oBrush ;
          MENU BuildMenu()

   If Right( FWVERSION, 4 ) >= "7.12"
      Define ButtonBar oBar OF oWnd Size 50, 50 3D 2007
   Else
      Define ButtonBar oBar OF oWnd Size 50, 50 3D
   EndIf

   cTitle := "Database: " + Trim( StrCapFirst( Alias()  ) ) + ".dbf"

   bExtern := {|oSheet| oSheet:Columns( 10 ):Set( "NumberFormat", "#,##0.00" ) }
   Define Button OF oBar Resource "Excel" ;
          Action oBrw:ExcelOle( "Test.xls", .T.,, cTitle,,, bExtern ) ;
          ToolTip "Export Browse to Excel"

   lGrid   := .T.
   Define Button OF oBar Resource "Print" ;
          Action oBrw:Report( cTitle,,,,,,,, lGrid ) ;
          ToolTip "Export Browse to Excel"

   Define Button OF oBar Resource "Exit" ;
          Action oWnd:End() ;
          ToolTip "Exit"

   @ 50, 0 Browse oBrw Alias "Employee" Of oWnd Size oWnd:nWidth, oWnd:nHeight Pixel ;
           Font oFont AutoCols Transparent Selector oBmp Editable

   Add Super Header To oBrw From Column 2 To Column 3 Color CLR_BLUE, { CLR_NBLUE, CLR_WHITE } ;
       Title "Name" 3DLook

   Add Super Header To oBrw FROM Column 4 TO Column 6 Color CLR_BLUE, { CLR_NBLUE, CLR_WHITE } ;
       Title "Address" 3DLook

   With Object oBrw
      :nHeightCell += 4
      :nHeightHead += 3
      :nHeightSuper += 3
      :SetColor( { CLR_HEADF, CLR_HEADB, CLR_FOCUSF, CLR_FOCUSB }, { CLR_BLUE, { CLR_WHITE, CLR_NBLUE, 2 }, ;
                 CLR_BLACK, -1 } )
      :ChangeFont( oFont1, 9, 2 )
      :aColumns[ 9 ]:nHAlign := DT_VERT
   End With

   oWnd:oClient := oBrw

   If Right( FWVERSION, 4 ) >= "7.12"
      Set Message Of oWnd Clock Date Keyboard Noinset 2007
   Else
      SET Message Of oWnd Clock Date Keyboard Noinset
   EndIf

   Activate Window oWnd Maximized

   oFont:End()
   oFont1:End()
   oBrush:End()
   oBmp:End()
   DbCloseAll()

Return Nil

//--------------------------------------------------------------------------------------------------------------------//

Static Function BuildMenu()

   Local oMenu

   If Right( FWVERSION, 4 ) >= "7.12"
      MENU oMenu
   Else
      MENU oMenu
   EndIf

      MENUITEM "TSBrowse"
         MENU
            MENUITEM "Excel" Resource "Excel16" ;
            Action oBrw:ExcelOle( "Test.xls", .T.,, "Here you are" )
            MENUITEM "Exit" Resource "Exit16" ;
            Action oWnd:End()
         ENDMENU
      MENUITEM "&Exit" Action oWnd:End()
      MENUITEM "&Help" Action WinExec( "Start ..\doc\Help.htm", 0 )
   ENDMENU

Return oMenu
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Re: tsbrowse metod toExcel
Posted: Mon Nov 10, 2014 11:20 PM

Estimados muchas gracias por sus comentarios

el problema que a mi me funciona bien pero en mis clientes casca, bueno echando un vistacito la foro encontre la solucion

1.-cambiar toleauto por createobject
oExcel := CREATEOBJECT( "Excel.Application" )

2.- cambiar esta lineas oSheet:Range( "A1:" + cLet + "1" ):Set( "HorizontalAlignment", xlHAlignCenterAcrossSelection )
por oSheet:Range( "A1:" + cLet + "1" ):HorizontalAlignment := xlHAlignCenterAcrossSelection

hasta ahora no ha habido quejas,,

gracias

Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl

Continue the discussion