Question on converting DBF=>XLS

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Question on converting DBF=>XLS

#1 Post by Eugene Lutsenko »

For some reason it is not converted, though the educational example works

Image

Code: Select all

DC_LoadRdds()

CLOSE ALL
USE Dost_mod  EXCLUSIVE NEW
SELECT Dost_mod

*aFields := { 'Наименование модели'               ,;
 *            'Интегральный критерий'             ,;
  *           'Вероятность верной идентификации'  ,;
   *          'Вероятность верной неидентификации',;
    *         'Средняя вер-ть верного результата' ,;
     *        'Дата'                              ,;
      *       'Время' }

   aFields := { "Type_model  ", ;
                "Int_krit    ", ;
                "P_T_Ident   ", ;  // Вероятность верной       идентификации объекта с классом с использованием модели
                "P_T_NIdent  ", ;  // Вероятность верной    не идентификации объекта с классом с использованием модели
                "P_Avr_T     ", ;  // Средняя вероятность верной идентификации или неидентификации объекта с классом с использованием модели
                "Date        ", ;
                "Time        "  }

cExcelFile := M_PathAppl + '\Dost_mod.xls'
DC_WorkArea2Excel(cExcelFile,,,,aFields)

*DC_SpawnUrl(Disk_dir+'Dost_mod.XLS')

Code: Select all

   cFileName  := "Dost_mod"
   aStructure := { { "Type_model  ", "C", 99, 0 }, ;
                   { "Int_krit    ", "C", 40, 0 }, ;
                   { "P_T_Ident   ", "N", 15, 7 }, ;  // Вероятность верной       идентификации объекта с классом с использованием модели
                   { "P_T_NIdent  ", "N", 15, 7 }, ;  // Вероятность верной    не идентификации объекта с классом с использованием модели
                   { "P_Avr_T     ", "N", 15, 7 }, ;  // Средняя вероятность верной идентификации или неидентификации объекта с классом с использованием модели
                   { "Date        ", "C", 10, 0 }, ;
                   { "Time        ", "C",  8, 0 }  }
   DbCreate( cFileName, aStructure, "DBFNTX" )

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: Question on converting DBF=>XLS

#2 Post by Auge_Ohr »

hi,

does it work if you do not use aFields ?
if yes remove "space" from aField Elements

p.s. why you have this

Code: Select all

 { "Date        ", "C", 10, 0 },
why not use Type "D" ?
greetings by OHR
Jimmy

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Question on converting DBF=>XLS

#3 Post by Eugene Lutsenko »

The educational example of c:\EXP19\Samples\Excel\export.prg well works, but not with all my databases. On some it gives out a mistake: "It is impossible to establish NumberFormat property of the class Range", an error of an operating system 2146827284. I removed in a row going gaps in all names of fields, reduced word length of numerical fields, tried to change type of "Date" given in the field and in general removed it, did everything in the folder with a short full name, but with a database which structure is given above, this mistake all the same arises. And only when I removed from not all numerical fields a mistake ceased to appear and converting passed the file in xls successfully.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Question on converting DBF=>XLS

#4 Post by Eugene Lutsenko »

Can prompt to me that I do not so.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: Question on converting DBF=>XLS

#5 Post by Auge_Ohr »

hi,

just thinking : does you DBF contain ANSI or OEM ?

activeX only work with ANSI ... and activeX Error may
have begin before you got the Error.

i think Express++ can also use a Array -> XLS
so try some of your Data in a Array if it work
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Question on converting DBF=>XLS

#6 Post by rdonnay »

If you will send me your database I will try to help.
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Question on converting DBF=>XLS

#7 Post by Eugene Lutsenko »

Somebody couldn't compile the program provided below, by means of teams:

Code: Select all

CLS
XPP %1
ALINK %1 /PM:PM
At me it turns out, but the program at execution gives a mistake, but it differs nothing from an example from xdemo.exe.
And to send the exe-file to me on an e-mail: prof.lutsenko@gmail.com.

Code: Select all

/*
This test program will export a Work Area to an Excel
Spread-Sheet.
*/
#INCLUDE "dcdialog.CH"
#INCLUDE "fileio.CH"
#pragma library( "dclip1.lib" )
#pragma library( "dclip2.lib" )
#pragma library( "dclipx.lib" )

FUNCTION Main()
LOCAL oScrn, nError, nHandle
DC_LoadRdds()

USE dost_mod VIA 'DBFNTX'
 
oScrn := DC_WaitOn( 'Exporting DOST_MOD.DBF to DOST_MOD.XLS' )
 
DC_WorkArea2Excel( DC_CurPath() + '\DOST_MOD.XLS' )
 
DC_Impl(oScrn)
 
DC_SpawnUrl( DC_CurPath() + '\DOST_MOD.XLS' )
 
Sleep(200)
 
nError := 1
DO WHILE nError > 0
  Sleep(100)
  nHandle := FOpen( DC_CurPath() + '\DOST_MOD.XLS', FO_READWRITE )
  nError := FError()
ENDDO
FClose( nHandle )
Sleep(100)
 
COPY STRUCTURE TO dost_mod2
 
USE dost_mod2 new exclusive
 
DC_Excel2WorkArea( DC_CurPath() + '\DOST_MOD.XLS' )
 
DCMSGBOX 'Done!'
 
RETURN nil
* ---------------
PROC appsys ; RETURN
The LOG-file too I provide:





--------------------------------------------------
Date : 08/29/2012
Time : 08:07:17
Procedure : AUTOMATIONOBJECT:ONERROR
Line Number : 1344
Information : Error Automation/6500
Description : ЌҐ«м§п гбв ­®ўЁвм бў®©бвў® NumberFormat Є« бб  Range
Operation : NumberFormat
Thread ID : 1
Source :
Called from : (B)INIT: _DCINIT(28)
Called from : AUTOMATIONOBJECT:ONERROR(1344)
Called from : ASCOMERROR:RAISE(324)
Called from : ASCOMERROR:RAISEERROR(593)
Called from : ASCOMERROR:RAISEONERROR(672)
Called from : AUTOMATIONOBJECT:SETNOIVAR(1146)
Called from : DC_WORKAREA2EXCEL(3990)
Called from : MAIN(19)

Status:


Work Area 1 :
Alias: DOST_MOD Record 1/20 ** Database Selected **
File Name: D:\ALASKA\AIDOS-X\Excel\Dost_mod.DBF
Dos Handle: ***
Data Driver: DBFNTX
Index Hndl Tag Name File Name Key
----- ---- ---------- ------------- -------------------------------

File(s) Open:
Handle File Name

Command Sets Loaded:

ALTERNATE OFF
ALTFILE
AUTOINDEX OFF
AUTOLOCK ON
BELL OFF
CANCEL ON
CENTURY ON
CHARSET 1
CHRKEY 290
COLLATION {...}
CONFIRM OFF
CONSOLE ON
CURSOR
DATEFORMAT mm/dd/yyyy
DCLIP D:\ALASKA\AIDOS-X\Excel\
DEBUG OFF
DEBUGFILE
DECIMALS 2
DEFAULT
DELETED OFF
DELIMCHARS ::
DELIMITERS OFF
DEVICE SCREEN
DOSKEY OFF
DOTSTACK 100
EDITOR
EPOCH 1900
ESCAPE ON
EXACT OFF
EXCLUSIVE OFF
EXIT OFF
EXTRA OFF
EXTRAFILE
FIXED OFF
FLDKEY 289
HISTORY
INCLUDE
INDEXKEY 279
INSERT OFF
INTENSITY ON
KEYSTAT ON
LEXICAL OFF
LIBS
LINKER
LINKOPT
MAKE
MARGIN 0
MAXROWS
MCENTER OFF
MCONFIRM ON
MESSAGE 0
ODIR
ODOMETER 5,00
PATH
PDIR
PEXT .PRG
PRINTER OFF
PRINTFILE
PROMPT DOS
PUBLIC OFF
QUERYKEY 272
RDD DBFNTX
RDDDICT DBFNTX
REEDIT ON
RESET OFF
SCOREBOARD ON
SCROLLBREAK OFF
SETCOLOR
SOFTSEEK OFF
SOUNDS OFF
STATUS ON
TALK OFF
TIME HH:MM:SS
TYPEAHEAD 40
UNIQUE OFF
USEDBFPROTECT OFF
USEEXCLDATA OFF
USEEXCLDICT OFF
WRAP ON
XPPOPT
XPPPATH

Memory(0) - Conventional Memory : 1216512
Memory(2) - Program Run Memory : 4173824
Memory(4) - Virtual Memory (EMS) : 393216

DOS Gateway Commands (COMM=):


<DO Procedure> Commands (PROC=):


Batch File Commands (BATC=):

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Question on converting DBF=>XLS

#8 Post by Eugene Lutsenko »

And the test Test2 database converts without problems, and on mine gives a mistake:

Image

Code: Select all

/*
This test program will export a Work Area to an Excel
Spread-Sheet.
*/
#INCLUDE "dcdialog.CH"
#INCLUDE "fileio.CH"
#pragma library( "dclip1.lib" )
#pragma library( "dclip2.lib" )
#pragma library( "dclipx.lib" )

FUNCTION Main()
LOCAL oScrn, nError, nHandle
*DC_LoadRdds()

USE Dost_mod VIA 'DBFNTX'

aFields := {}
FOR j=1 TO FCOUNT()
    AADD(aFields, FIELDNAME(j))
NEXT
 
oScrn := DC_WaitOn( 'Exporting Dost_mod.DBF to Dost_mod.XLS' )
 
DC_WorkArea2Excel( DC_CurPath() + '\Dost_mod.XLS' )
 
DC_Impl(oScrn)
 
DC_SpawnUrl( DC_CurPath() + '\Dost_mod.XLS' )
 
DCMSGBOX 'Done!'
 
RETURN nil
* ---------------
PROC appsys ; RETURN
There can be a matter in the database which I try to convert in XLS, there can be I somehow not so it is created?

Code: Select all

   cFileName  := "Dost_mod"
   aStructure := { { "Type_model", "C", 99, 0 }, ;
                   { "Int_krit"  , "C", 40, 0 }, ;
                   { "P_T_Ident" , "N", 15, 7 }, ;  // Вероятность верной       идентификации объекта с классом с использованием модели
                   { "P_T_NIdent", "N", 15, 7 }, ;  // Вероятность верной    не идентификации объекта с классом с использованием модели
                   { "P_Avr_T"   , "N", 15, 7 }, ;  // Средняя вероятность верной идентификации или неидентификации объекта с классом с использованием модели
                   { "Date"      , "C", 10, 0 }, ;
                   { "Time"      , "C",  8, 0 }  }
   DbCreate( cFileName, aStructure, "DBFNTX" )
Some databases will be transformed normally, and some cause a mistake. I will not understand in what between them a difference.

Post Reply