FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour bug in Report:ToExcel() [fixed provided]
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
bug in Report:ToExcel() [fixed provided]
Posted: Wed Dec 31, 2014 09:00 AM
Hello,

When exporting a Report to Excel, which is a great new feature, when the DBF has an empty Date, it generates a RTE:

Error description: (DOS Error -2147352567) WINOLE/1006 (0x800A03EC): _VALUE
Args:
[ 1] = D / /


Thank you very much.
Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: bug in Report:ToExcel()
Posted: Wed Dec 31, 2014 11:07 AM
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: bug in Report:ToExcel()
Posted: Wed Dec 31, 2014 11:28 AM

Unfortunately it seems that Harbour developers won't fix that bug. :-(

EMG

Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
Re: bug in Report:ToExcel()
Posted: Wed Dec 31, 2014 11:44 AM

Hello,

I guess in METHOD ToExcel( bProgress ) CLASS TReport is posible to detect when there is an empty date in the dbf and not export that for instance, leaving the Excel´s spreadsheet cell in blank.

Thank you.

Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: bug in Report:ToExcel()
Posted: Wed Dec 31, 2014 04:16 PM
Yes. You are right. We need to skip writing empty dates and also dates where year < 1900.

We shall provide the fix after testing with Harbour. Meanwhile you may try this

Please locate this code
Code (fw): Select all Collapse
               if Len( oCol:aData ) >= nLine .and. !oCol:lImage
                  aValues[ nCol ]   := Eval( oCol:aData[ nLine ] )
                  if ValType( aValues[ nCol ] ) == 'C'
                     aValues[ nCol ]   := Trim( aValues[ nCol ] )
                  endif
               else
                  aValues[ nCol ]   := nil
               endif

Please modify as:
Code (fw): Select all Collapse
   if Len( oCol:aData ) >= nLine .and. !oCol:lImage
      aValues[ nCol ]   := Eval( oCol:aData[ nLine ] )
      if ValType( aValues[ nCol ] ) == 'C'
         aValues[ nCol ]   := Trim( aValues[ nCol ] )
      elseif ValType( aValues[ nCol ] ) $ "DT" .and. Year( aValues[ nCol ] ) < 1900
         aValues[ nCol ]   := nil // If nil also gives error please try AdoNull() instead of nil
      endif
   else
      aValues[ nCol ]   := nil
   endif
Regards



G. N. Rao.

Hyderabad, India
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
Re: bug in Report:ToExcel()
Posted: Wed Dec 31, 2014 06:07 PM

Mr. Nages,

Your fix seems to be working fine.

Thank you very much and happy new year.

Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40

Continue the discussion