FW_ExceltoDbf version in FW 2102
- Marc Venken
- Posts: 1485
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: FW_ExceltoDbf version in FW 2102
Thank you for the feedback !
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: FW_ExceltoDbf version in FW 2102
Can you please implement this change?
file fwh\source\function\dbffunc2.prg
function FW_ExcelToDBF(...)
Please locate this code:
Please replace this block with this code.
After making this change test with both old and new versions of Harbour.
file fwh\source\function\dbffunc2.prg
function FW_ExcelToDBF(...)
Please locate this code:
Code: Select all | Expand
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
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
G. N. Rao.
Hyderabad, India
- Marc Venken
- Posts: 1485
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: FW_ExceltoDbf version in FW 2102
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
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
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.08 with Harbour
Using: FWH 23.08 with Harbour
- Marc Venken
- Posts: 1485
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: FW_ExceltoDbf version in FW 2102
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 )
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.08 with Harbour
Using: FWH 23.08 with Harbour
- Marc Venken
- Posts: 1485
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: FW_ExceltoDbf version in FW 2102
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','')
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.08 with Harbour
Using: FWH 23.08 with Harbour