Page 1 of 2

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

Posted: Sat Feb 07, 2015 1:29 pm
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

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

Posted: Sat Feb 07, 2015 1:35 pm
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.

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

Posted: Sat Feb 07, 2015 11:21 pm
by Eugene Lutsenko
I'm happy for you, Roger! I wish you a pleasant journey and happy returning!

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

Posted: Sat Feb 21, 2015 12:55 am
by Eugene Lutsenko
Anybody can convert xls in dbf and back so that the result was the same file that was?

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

Posted: Sat Feb 21, 2015 11:22 am
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 ...

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

Posted: Sat Feb 21, 2015 2:18 pm
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.

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

Posted: Sun Feb 22, 2015 12:28 am
by Wolfgang Ciriack
You can simply open every .DBF with Excel, if you rename the .Dbf in .xls.

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

Posted: Sun Feb 22, 2015 1:10 am
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.

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

Posted: Sun Feb 22, 2015 6:42 am
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

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

Posted: Sun Feb 22, 2015 5:07 pm
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