FW_ExceltoDbf version in FW 2102

Re: FW_ExceltoDbf version in FW 2102

Postby Marc Venken » Mon Mar 29, 2021 1:13 pm

Thank you for the feedback !
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1429
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: FW_ExceltoDbf version in FW 2102

Postby nageswaragunupudi » Mon Mar 29, 2021 1:57 pm

Can you please implement this change?

file fwh\source\function\dbffunc2.prg
function FW_ExcelToDBF(...)

Please locate this code:
Code: Select all  Expand view
  if lHasHeaders
      aHead    := oRange:Rows( 1 ):Value
      if ValType( aHead ) == 'A'
         aHead    := ArrTranspose( aHead )[ 1 ]
      endif
      nRows--
      oRange   := oRange:OffSet( 1, 0 ):Resize( nRows )
   endif
 


Please replace this block with this code.
Code: Select all  Expand view
  if lHasHeaders
      aHead    := xlRangeValue( oRange:Rows( 1 ) )[ 1 ]
      nRows--
      oRange   := oRange:OffSet( 1, 0 ):Resize( nRows )
   endif
 


After making this change test with both old and new versions of Harbour.
Regards

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

Re: FW_ExceltoDbf version in FW 2102

Postby Marc Venken » Mon Mar 29, 2021 9:18 pm

nageswaragunupudi wrote:Can you please implement this change?

file fwh\source\function\dbffunc2.prg
function FW_ExcelToDBF(...)

Please locate this code:
Code: Select all  Expand view
  if lHasHeaders
      aHead    := oRange:Rows( 1 ):Value
      if ValType( aHead ) == 'A'
         aHead    := ArrTranspose( aHead )[ 1 ]
      endif
      nRows--
      oRange   := oRange:OffSet( 1, 0 ):Resize( nRows )
   endif
 


Please replace this block with this code.
Code: Select all  Expand view
  if lHasHeaders
      aHead    := xlRangeValue( oRange:Rows( 1 ) )[ 1 ]
      nRows--
      oRange   := oRange:OffSet( 1, 0 ):Resize( nRows )
   endif
 


After making this change test with both old and new versions of Harbour.


Both are working now
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1429
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: FW_ExceltoDbf version in FW 2102

Postby Marc Venken » Wed Apr 07, 2021 10:21 pm

We know that we get a runtime error if the range in the exel file is not good defined. empty colums/rows are the cause, already mentioned in the forum.

I would like to trap the error so that the program will popup a message that the range in the exel file should be better determent.

Now should I do it in my own errorsys.prg or should the FW-Team process it in the source of the function for the future ?

I've seen some function to determent the range in the exel file with OLE objects. Will these functions return the last element with text into it or also the empty colums?

Application
===========
Path and name: C:\programmas\readexel\TEST.EXE (32 bits)
Size: 4,431,872 bytes
Compiler version: Harbour 3.2.0dev (r2008190002)
FiveWin version: FWH 21.02
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 11 secs
Error occurred at: 08/04/2021, 00:09:14
Error description: (DOS Error -2147352567) WINOLE/1007 (0x800A03EC): OFFSET
Args:
[ 1] = N 1
[ 2] = N 0

Stack Calls
===========
Called from: => TOLEAUTO:OFFSET( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:SETEXCELRANGE( 6488 )
Called from: .\source\classes\XBROWSE.PRG => XBRWSETDATASOURCE( 17467 )
Called from: .\source\classes\XBROWSE.PRG => XBROWSENEW( 17243 )
Called from: .\TEST1.PRG => READDATA( 116 )
Called from: .\TEST1.PRG => MAIN( 21 )
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1429
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: FW_ExceltoDbf version in FW 2102

Postby Marc Venken » Wed Apr 07, 2021 10:44 pm

Using the function the last day's I noticed this :

When the function 'thinks' that a exel column is numeric, it will process it according and put '.00' behind it.

10016.00 10016040.00 Strovels Flex 933 ZWART - 40 8713458590055.00 64039113.00
23.00 23110.00 Grisport veters zw-blauw 120 - 110 8713458100162.00 56090000.00 0.49 0.82 0.99 0.00 http://www.allshoes.nl/_uploads/23/hiresonwhite.jpg Accessoires Discontinued Fournituren

Column 1 = code
2 = reference
4 = EAN code
6-8 are prices

Maybe FW can enhance with a extra parameter (Convert to text)

.t. convert all to txt when there is no decimal attribute like comma or point that determent the data is numeric, so data like 1,2 and 4 will have NO decimal's when the are converted
.f. Let the function do the best of it, like it is now. (standard)

For now my solution is after the conversion to change the data with // strtran(code,'.00','')
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1429
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 71 guests