Inp_xls.xls=Inp_xls.dbf=>Out_xls.xls:Out_xls.xls=Inp_xls.xls

This forum is for eXpress++ general support.
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:

Inp_xls.xls=Inp_xls.dbf=>Out_xls.xls:Out_xls.xls=Inp_xls.xls

#1 Post by Eugene Lutsenko »

I would like to receive the following result. If you convert xls to dbf, and then back to the dbf to xls, then the source and destination xls files must be identical.

Inp_xls.xls => Inp_xls.dbf => Out_xls.xls
Out_xls.xls === Inp_xls.xls

I tried to do it, but for some reason the final xls-file is not written with the name "Out_xls.xls"

Example here. Roger text functions have not changed.

http://lc.kubagro.ru/Dima/xls-dbf-xls.rar

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

Re: Inp_xls.xls=Inp_xls.dbf=>Out_xls.xls:Out_xls.xls=Inp_xls

#2 Post by rdonnay »

This will take some time to figure out.
I'm travelling this week and I have a heavy work schedule.

Maybe someone on this forum can help you.
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: Inp_xls.xls=Inp_xls.dbf=>Out_xls.xls:Out_xls.xls=Inp_xls

#3 Post by Eugene Lutsenko »

I'm happy for you, Roger! I wish you a pleasant journey and happy returning!

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

Re: Inp_xls.xls=Inp_xls.dbf=>Out_xls.xls:Out_xls.xls=Inp_xls

#4 Post by Eugene Lutsenko »

Anybody can convert xls in dbf and back so that the result was the same file that was?

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

Re: Inp_xls.xls=Inp_xls.dbf=>Out_xls.xls:Out_xls.xls=Inp_xls

#5 Post by Auge_Ohr »

Xbase++ User are working with DBF not with XLS.
if you want to work with XLS you have to learn EXCEL or ask in EXCEL-Forum ...
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: Inp_xls.xls=Inp_xls.dbf=>Out_xls.xls:Out_xls.xls=Inp_xls

#6 Post by Eugene Lutsenko »

Auge_Ohr wrote:Xbase++ User are working with DBF not with XLS.
if you want to work with XLS you have to learn EXCEL or ask in EXCEL-Forum ...
I know how to use Excel. And I know that Alaska is working with DBF. But I think that one does not interfere. I just need some results of the system, written in Alaska, for users to submit to the XLS-files. I can do it, but somehow ugly.
http://lc.kubagro.ru/Dima/xls-dbf-xls.rar
I want to be able to do it better. That's why I asked about it on this forum.

Wolfgang Ciriack
Posts: 479
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Inp_xls.xls=Inp_xls.dbf=>Out_xls.xls:Out_xls.xls=Inp_xls

#7 Post by Wolfgang Ciriack »

You can simply open every .DBF with Excel, if you rename the .Dbf in .xls.
_______________________
Best Regards
Wolfgang

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

Re: Inp_xls.xls=Inp_xls.dbf=>Out_xls.xls:Out_xls.xls=Inp_xls

#8 Post by Eugene Lutsenko »

It's you I've reported before. Works fine. But the fact is that I would like to generate the column headings in the xls-file does not match with the names of the fields. I gave an example http://lc.kubagro.ru/Dima/xls-dbf-xls.rar of how I wanted to do it. The idea is to download the xls-file in dbf, process it in the program on the desired algorithm and then write it back again in the in xls-file. Thus it is necessary to use the names of columns and rows, that were in xls-file.

Wolfgang Ciriack
Posts: 479
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Inp_xls.xls=Inp_xls.dbf=>Out_xls.xls:Out_xls.xls=Inp_xls

#9 Post by Wolfgang Ciriack »

So then build your own function, f.e.

Code: Select all

oExcel:= CreateObject( "EXCEL.APPLICATION" )
IF !( oExcel == NIL )
    oWorkBook := oExcel:workbooks:open(v_datei)
    aValues := oWorkBook:workSheets(1):usedRange:value
    l:=len(aValues)
    ** NIL -Values entfernen
    for i:=1 to l
         for ii:=1 to len(aValues[i])
            if aValues[i][ii]=NIL
               aValues[i][ii]:=""
            endif
         next
    next
    oWorkBook:close()
    sleep(100)
    oExcel:quit()
    oExcel:destroy()
    oWorkBook:=nil
    oExcel:=nil
    *** all Data are now in aValues and you can
    *** put Array-Data to dbf
    
    for i:=1 to l
       if i=1
          ** header colums
          aHeaders:=aValues[i]
       else
          ** data
          ** convert Data of fields to the disired format
          f1:=ConvXls("C",aValues[i][1])
          .....
      endif
   next
endif
**************************************
function ConvXls(zutyp, xwert)
local retw:=xwert, isttyp:=ValType(xwert)

do case
case zutyp==isttyp
   retw:=xwert
case zutyp="C"
   if isttyp="N"
      retw:=alltrim(str(xwert,10,0))
   elseif isttyp="D"
      retw:=dtoc(xwert)
   endif
case zutyp="D"
   if isttyp="N"
      retw:=blank(date())
   elseif isttyp="C"
      retw:=ctod(xwert)
   endif
case zutyp="N"
   if isttyp="C"
      retw:=val(alltrim(xwert))
   elseif isttyp="D"
      retw:=0
   endif
endcase
return retw
_______________________
Best Regards
Wolfgang

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: Inp_xls.xls=Inp_xls.dbf=>Out_xls.xls:Out_xls.xls=Inp_xls

#10 Post by GeneB »

Look at 'User Contributions' topic 'Importing Excel to Dbf'.
You might get some ideas.

http://bb.donnay-software.com/donnay/vi ... ?f=7&t=238

Post Reply