error al personalizar hoja de excel despues de toexcel()

error al personalizar hoja de excel despues de toexcel()

Postby artu01 » Tue Nov 22, 2022 11:10 pm

Mr. RAO
a la hoja excel que exporto desde xbrowse quiero personalizarla , la primera exporta, pero luego lo hace pero con este error:
Image

Este es mi codigo:
Code: Select all  Expand view  RUN

    REDEFINE XBROWSE oBrwDet                             ;        
        DATASOURCE oRs2                                  ;
        COLUMNS "id","numero", "bruto","neto","brupi","fsali" ;
              ,"parte","pneto"                           ;
        FIELDSIZES 50,60,100,100,100,70,60,100           ;
        HEADERS "id"                                     ;
              ,"CAJA"                                    ;
              ,"BRUTO FAB."                              ;
              ,"NETO FAB."                               ;
              ,"BRUTO PYSA"                              ;
              ,"F.SALIDA  "                              ;
              ,"PARTE"                                   ;
              ,"NETO"                                    ;
        PICTURES ,,'9,999.999','9,999.999', '9,999.999',,,'9,999.999' ;
        ID 4025 OF oDlgDet                               ;
        AUTOSORT LINES CELL NOBORDER UPDATE

        oBrwDet:nStretchCol    := STRETCHCOL_WIDEST
        oBrwDet:nMarqueeStyle    = MARQSTYLE_HIGHLROW
        oBrwDet:bClrSel     := {|| {  CLR_WHITE, GetSysColor(13 ) } }   //ESTO HACE QUE NO SALGA LINEA NEGRA
        oBrwDet:lSeekWild   := .t.
       
{CLR_BLACK, CLR_WHITE} ) }                 
        oBrwDet:aCols[ 5 ]:bClrStd := {|| iif (oRs2:recordcount()>0, { iif( oRs2:Fields("brupi"):value>oRs2:Fields("bruto"):value, CLR_HRED, CLR_BLACK), CLR_WHITE },{CLR_BLACK, CLR_WHITE} ) }                

        if oRs2:recordcount()>0
          WITH OBJECT oBrwDet:aCols[ 6 ]
            :bStrData         := {|| iif( empty(oRs2:Fields("fsali"):Value), ' ',oRs2:Fields("fsali"):Value) }
          END WITH
        endif

          oBrwDet:lHScroll := .t.
          oBrwDet:lVScroll := .t.
          oBrwDet:aCols[1]:lHide:=.t.  //para ocultar columnas


        REDEFINE BTNBMP oBtn ID 4014 OF oDlgDet UPDATE PIXEL 2007 NOBORDER CENTER  ;          
       ACTION (  oExcel:=oBrwDet:ToExcel() , oExcel:Columns(2):autofit() )      
       oBtn:cTooltip := "Exportar Lote"  
 

si cambio mi codigo y lo dejo asi no tengo error
Code: Select all  Expand view  RUN

...
REDEFINE BTNBMP oBtn ID 4014 OF oDlgDet UPDATE PIXEL 2007 NOBORDER CENTER  ;          
ACTION (  oExcel:=oBrwDet:ToExcel()  )      
oBtn:cTooltip := "Exportar Lote"  
 


Podria decirme que estoy haciendo mal?
he notado que si antes de exportar cierro la hoja excel que estuviese abierta no hay error.
Gracias
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: error al personalizar hoja de excel despues de toexcel()

Postby hmpaquito » Wed Nov 23, 2022 10:40 am

Hola,

Vendría muy bien una imagen de la parte inicial del archivo de error. Ahi se ve la variable que provocó el error

Salu2
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: error al personalizar hoja de excel despues de toexcel()

Postby artu01 » Wed Nov 23, 2022 3:31 pm

Gracias, detallo error:

Application
===========
Path and name: Z:\b1\cajas.exe (32 bits)
Size: 4,676,096 bytes
Compiler version: Harbour 3.2.0dev (r1703231115)
FiveWin version: FWH 17.12
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 24 secs
Error occurred at: 22/11/2022, 17:56:50
Error description: Error BASE/1004 No exported method: COLUMNS
Args:
[ 1] = A { ... } length: 2
[ 2] = N 2

Stack Calls
===========
Called from: => COLUMNS( 0 )
Called from: .\dlgguia.PRG => (b)NUEVODET( 0 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 688 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 928 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1721 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1883 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3356 )
Called from: => DIALOGBOX( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 296 )
Called from: .\dlgguia.PRG => NUEVODET( 0 )
Called from: .\dlgguia.PRG => PROCMTN( 0 )
Called from: .\dlgguia.PRG => (b)GUIA( 0 )
Called from: .\source\classes\BUTTON.PRG => TBUTTON:CLICK( 179 )
Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT( 1685 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3356 )
Called from: => SENDMESSAGE( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND( 424 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 922 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3356 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1037 )
Called from: .\mcajas.PRG => MSIS:XSHELL( 0 )
Called from: .\cajas.PRG => CAJAS( 0 )
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: error al personalizar hoja de excel despues de toexcel()

Postby karinha » Wed Nov 23, 2022 3:39 pm

Algo errado aqui:

Code: Select all  Expand view  RUN

Called from: .\dlgguia.PRG => (b)NUEVODET( 0 )
 


Que FLAGS usas para compilar que no aparece la lynea del error en el .PRG?
Regards, saloudos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: error al personalizar hoja de excel despues de toexcel()

Postby artu01 » Wed Nov 23, 2022 11:35 pm

Este es mi archivo .mak
#Borland make sample, (c) FiveTech Software 2005-2009

HBDIR=c:\1712\harbour
BCDIR=c:\1712\bcc7
FWDIR=c:\1712\fwh

#change these paths as needed
.path.OBJ = .\obj
.path.PRG = .\
.path.CH = $(FWDIR)\include;$(HBDIR)\include
.path.C = .\
.path.rc = .\

#important: Use Uppercase for filenames extensions, in the next two rules!

PRG = \
cajas.PRG \
tcajas.PRG \
mcajas.PRG \
rddsys.PRG \
password.PRG \
libsis.PRG \
especial.PRG \
brwartic.PRG \
brwtipca.PRG \
brwclie.PRG \
brwfactu.PRG \
brwtabla.PRG \
brwconpa.PRG \
brwtipno.PRG \
brwmate.PRG \
brwcolor.PRG \
brwubi.PRG \
brwgeo.PRG \
brwerr.PRG \
brwpatro.PRG \
brwperio.PRG \
brwprove.PRG \
dlgguia.PRG \
dlgigv.PRG \
m2011.PRG \
rfactura.PRG \
rfacbol.PRG \
rpedido.PRG \
ringresom.PRG \
rsalida.PRG \
rsalidam.PRG \
ringsal.PRG \
ringsalv.PRG \
rconsol.PRG \
rlote.PRG \
rmsali.PRG \
rartfec.PRG \
rfecart.PRG \
rlotev.PRG \
rvtaxm.PRG \
rdecrec.PRG \
rstock.PRG \
rstockp.PRG \
rmovim.PRG \
rsalproy.PRG \
tdosprn.PRG \
txtview.PRG

#rpruexc.PRG \

PROJECT : Cajas.exe

Cajas.exe : $(PRG:.PRG=.obj)
echo off
echo $(BCDIR)\lib\c0w32.obj + > b32.bc
echo obj\cajas.obj \
obj\tcajas.obj \
obj\mcajas.obj \
obj\rddsys.obj \
obj\password.obj \
obj\libsis.obj \
obj\especial.obj \
obj\brwartic.obj \
obj\brwtipca.obj \
obj\brwclie.obj \
obj\brwfactu.obj \
obj\brwtabla.obj \
obj\brwconpa.obj \
obj\brwtipno.obj \
obj\brwmate.obj \
obj\brwcolor.obj \
obj\brwubi.obj \
obj\brwgeo.obj \
obj\brwerr.obj \
obj\brwpatro.obj \
obj\brwperio.obj \
obj\brwprove.obj \
obj\dlgguia.obj \
obj\dlgigv.obj \
obj\m2011.obj \
obj\rfactura.obj \
obj\rfacbol.obj \
obj\rpedido.obj \
obj\ringresom.obj \
obj\rartfec.obj \
obj\rmsali.obj \
obj\rfecart.obj \
obj\rlotev.obj \
obj\rvtaxm.obj \
obj\rdecrec.obj \
obj\rsalida.obj \
obj\rsalidam.obj \
obj\ringsal.obj \
obj\ringsalv.obj \
obj\rconsol.obj \
obj\rlote.obj \
obj\rstock.obj \
obj\rstockp.obj \
obj\rmovim.obj \
obj\rsalproy.obj \
obj\tdosprn.obj \
obj\txtview.obj , + >> b32.bc
# obj\rpruexc.obj \


#echo $(OBJS), + >> b32.bc
echo cajas.exe, + >> b32.bc
echo cajas.map, + >> b32.bc
echo $(FWDIR)\lib\FiveH.lib $(FWDIR)\lib\FiveHC.lib + >> b32.bc
echo $(HBDIR)\lib\hbrtl.lib + >> b32.bc
echo $(HBDIR)\lib\hbvm.lib + >> b32.bc
echo $(HBDIR)\lib\gtgui.lib + >> b32.bc
echo $(HBDIR)\lib\hblang.lib + >> b32.bc
echo $(HBDIR)\lib\hbmacro.lib + >> b32.bc
echo $(HBDIR)\lib\hbrdd.lib + >> b32.bc
echo $(HBDIR)\lib\rddntx.lib + >> b32.bc
echo $(HBDIR)\lib\rddcdx.lib + >> b32.bc
echo $(HBDIR)\lib\rddfpt.lib + >> b32.bc
echo $(HBDIR)\lib\hbsix.lib + >> b32.bc
echo $(HBDIR)\lib\hbdebug.lib + >> b32.bc
echo $(HBDIR)\lib\hbcommon.lib + >> b32.bc
echo $(HBDIR)\lib\hbpp.lib + >> b32.bc
echo $(HBDIR)\lib\hbwin.lib + >> b32.bc
echo $(HBDIR)\lib\hbcpage.lib + >> b32.bc
echo $(HBDIR)\lib\hbct.lib + >> b32.bc
echo $(HBDIR)\lib\xhb.lib + >> b32.bc
echo $(HBDIR)\lib\hbcplr.lib + >> b32.bc
echo $(HBDIR)\lib\hbpcre.lib + >> b32.bc
echo $(HBDIR)\lib\hbziparc.lib + >> b32.bc
echo $(HBDIR)\lib\hbmzip.lib + >> b32.bc
echo $(HBDIR)\lib\hbzlib.lib + >> b32.bc
echo $(HBDIR)\lib\minizip.lib + >> b32.bc
echo $(HBDIR)\lib\hbusrrdd.lib + >> b32.bc
echo $(HBDIR)\lib\hbtip.lib + >> b32.bc

rem Uncomment these two lines to use Advantage RDD
rem echo $(HBDIR)\lib\rddads.lib + >> b32.bc
rem echo $(HBDIR)\lib\Ace32.lib + >> b32.bc

echo $(BCDIR)\lib\cw32.lib + >> b32.bc
echo $(BCDIR)\lib\import32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\odbc32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\nddeapi.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\iphlpapi.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\msimg32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\psapi.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\rasapi32.lib+ >> b32.bc
echo $(BCDIR)\lib\psdk\shell32.lib, >> b32.bc

IF EXIST Cajas.res echo Cajas.res >> b32.bc
$(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s @b32.bc >log-prg.txt
del b32.bc

.prg.obj:
$(HBDIR)\bin\harbour $< /L /N /W /Oobj\ /I$(FWDIR)\include;$(HBDIR)\include >log-prg.txt
$(BCDIR)\bin\bcc32 -c -tWM -I$(HBDIR)\include -oobj\$& obj\$&.c

Cajas.res : Cajas.rc
# $(BCDIR)\bin\brc32.exe -r Xbincflt.rc
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: error al personalizar hoja de excel despues de toexcel()

Postby karinha » Thu Nov 24, 2022 12:29 pm

Buén dia.

Cambie aqui para generar el ERROR.LOG correcto:

Code: Select all  Expand view  RUN

.prg.obj:
$(HBDIR)\bin\harbour $< /M /N /W /Oobj\ /I$(FWDIR)\include;$(HBDIR)\include >log-prg.txt
 


Ó:

Code: Select all  Expand view  RUN

.prg.obj:
$(HBDIR)\bin\harbour $< /N /W /Oobj\ /I$(FWDIR)\include;$(HBDIR)\include >log-prg.txt
 


/l suppress line number information

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

Re: error al personalizar hoja de excel despues de toexcel()

Postby karinha » Thu Nov 24, 2022 12:44 pm

Code: Select all  Expand view  RUN

xHarbour 1.2.3 Intl. (SimpLex) (Build 20201212)
Copyright 1999-2020, http://www.xharbour.org http://www.harbour-project.org/

Syntax:  C:\XHBBCC74\bin\harbour.exe <file[s][.prg]> [options]

Options:  /a               automatic memvar declaration
          /b               debug info
          /build           display detailed version info
          /credits         display credits
          /d<id>[=<val>]   #define <id>
          /es[<level>]     set exit severity
          /ex              create public function list (.xbx)
          /g<type>         output type generated is <type> (see below)
          /gc[<type>]      output type: C source (.c) (default)
                           <type>: 0=compact 1=normal 2=verbose (default)
                                   3=generate real C code
          /go              output type: Platform dependant object module
          /gh              output type: Harbour Portable Object (.hrb)
          /i<path>         #include file search path
          /j[<file>]       output i18n support [to <file>] to .hil
          /k               compilation mode (type -k? for more data)
          /l               suppress line number information
          /m               compile module only
          /n[<type>]       no implicit starting procedure (default)
                           <type>: 0=no implicit starting procedure
                                   1=no starting procedure at all
                                   2=force application starting procedure
          /o<path>         object file drive and/or path
          /p[o<path>]      generate pre-processed output (.ppo) file in <path>
          /pt[o<path>]     generate pre-processor trace (.ppt) file in <path>
          /q               quiet
          /q0              quiet and don't display program header
          /s               syntax check only
          /u[[+]<file>]    use command def set in <file> (or none)
          /undef:<id>      #undef <id>
          /v               variables are assumed M->
          /vd              external functions are assumed as dynamic functions
          /w[<level>]      set warning level number (0..3, default 1)
          /x[<prefix>]     set symbol init function name prefix (for .c only)
          /z               suppress shortcutting (.and. & .or.)
          @<file>          compile list of modules in <file>


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

Re: error al personalizar hoja de excel despues de toexcel()

Postby nageswaragunupudi » Sat Nov 26, 2022 6:00 pm

In the xbrowse.prg
Please insert
Code: Select all  Expand view  RUN
SysRefresh() // insert now
return oSheet

just before return oSheet
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: error al personalizar hoja de excel despues de toexcel()

Postby artu01 » Tue Nov 29, 2022 10:49 pm

Mr. Rao:
hice el cambio en el xbrowse.prg
Code: Select all  Expand view  RUN

#ifndef __XHARBOUR__
   else
      //
      //SysRefresh()
      //
      // This requires explanation.
      // With xHarbour there is no problem. Problem is with Harbour only
      // return value of this function is oSheet which is an Object. xHarbour returns as object
      // If SysRefresh() is called here, Harbour returns oSheet as an object
      // if not it returns an Array of two numeric elements.
      // I am unable to understand this phenomenon.
      // Till we understand what is happening, keep SysRefresh() here for
      // Harbour build.
      // 2015-06-02
#endif
   endif
   SysRefresh()
return oSheet
 



Ahora verifico con un msgalert() que es lo que devuelve y da como como resultado 'O'
Code: Select all  Expand view  RUN

REDEFINE BTNBMP oBtn ID 4014 OF oDlgDet UPDATE PIXEL 2007 NOBORDER CENTER  ;           //38
ACTION (  oExcel:=oBrwDet:ToExcel(),msgalert(valtype(oExcel)), oExcel:Columns(1):hidden:=.t., oexcel:Columns(2):autofit() )      
oBtn:cTooltip := "Exportar Lote"    

 

He notado que la sgte instruccion oExcel:Columns(1):hidden:=.t. o cualquier otra instruccion oExcel:xxx corre siempre y cuando el excel este abierto
si esta cerrado el excel bota el mismo de error de siempre
Application
===========
Path and name: Z:\b1\cajas.exe (32 bits)
Size: 4,681,728 bytes
Compiler version: Harbour 3.2.0dev (r1703231115)
FiveWin version: FWH 17.12
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 2 mins 26 secs
Error occurred at: 29/11/2022, 17:14:17
Error description: (DOS Error -2147418111) WINOLE/1009 No exported method: COLUMNS
Args:
[ 1] = N 1

Stack Calls
===========
Called from: => TOLEAUTO:COLUMNS( 0 )
Called from: .\dlgguia.PRG => (b)NUEVODET( 539 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 688 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 928 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1721 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1883 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3356 )
Called from: => DIALOGBOX( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 296 )
Called from: .\dlgguia.PRG => NUEVODET( 642 )
Called from: .\dlgguia.PRG => PROCMTN( 199 )
Called from: .\dlgguia.PRG => (b)GUIA( 136 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:LDBLCLICK( 1997 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:LDBLCLICK( 1744 )
Called from: .\xbrowse.PRG => TXBROWSE:LDBLCLICK( 4737 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1731 )
Called from: .\xbrowse.PRG => TXBROWSE:HANDLEEVENT( 10297 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3356 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1037 )
Called from: .\mcajas.PRG => MSIS:XSHELL( 0 )
Called from: .\cajas.PRG => CAJAS( 0 )


Adjunto mi fuente xbrowse.prg para ser descargado
https://www.transfernow.net/dl/20221129 ... F/aE00CpV0
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: error al personalizar hoja de excel despues de toexcel()

Postby artu01 » Tue Nov 29, 2022 11:07 pm

Sorry Mr. Rao:
le saque la instruccion msgalert(..) y ya funciona
Code: Select all  Expand view  RUN

REDEFINE BTNBMP oBtn ID 4014 OF oDlgDet UPDATE PIXEL 2007 NOBORDER CENTER  ;           //38
ACTION (  oExcel:=oBrwDet:ToExcel(),oExcel:Columns(1):hidden:=.t., oexcel:Columns(2):autofit(),oExcel:Cells(1,10):Value :='TOTALES :', oExcel:Cells(1,10):Font:Bold := .t. )      
oBtn:cTooltip := "Exportar Lote"    

 


Thank you!
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 98 guests