Question about the function: DC_WorkArea2Excel()

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:

Question about the function: DC_WorkArea2Excel()

#1 Post by Eugene Lutsenko »

Hi, Roger! Hello everybody!

Don't know why the function: DC_WorkArea2Excel() creates a dbf file instead of an Excel file?

Code: Select all

          mNameLangXls = 'LangTransl_' + aISO639_1[j] + '.XLS'
          aFields := { 'TextOrig' }
          DC_WorkArea2Excel(mNameLangXls,,,,aFields)         // Преобразовать БД mNameLangDB в XLS-файл
[/size]

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

Re: Question about the function: DC_WorkArea2Excel()

#2 Post by rdonnay »

How do you know that it's a DBF file?

Does it have a DBF extension?
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 about the function: DC_WorkArea2Excel()

#3 Post by Eugene Lutsenko »

Yes, we get files with names like LangTransl_en.DBF. Online translator of Excel tables: https://www.onlinedoctranslator.com/translationform does not accept these files.

Most likely, these xls files are not clear where they are written. I didn't find them

Code: Select all

   FOR j=1 TO LEN(aISO639_1)

       IF aISO639_1[j] <> 'ru'
       
          mNameLangDB  = 'LangTr_' + aISO639_1[j]
          mNameLangXls = 'LangTransl_' + aISO639_1[j] + '.XLS'

          aStructure := { { "TextOrig", "C", mLF, 0 } }
          DbCreate((mNameLangDB), aStructure )

          CLoseAll()            // Закрытие всех баз данных с ожиданием завершения операций          
          USE (mNameLangDB) EXCLUSIVE NEW
          SELECT (mNameLangDB)
          
          FOR i=1 TO LEN(aLangRu)
              APPEND BLANK
              REPLACE TextOrig WITH aLangRu[i]
          NEXT
          
          aFields := { 'TextOrig' }
          DC_WorkArea2Excel(mNameLangXls,,,,aFields)         // Преобразовать БД mNameLangDB в XLS-файл

      ENDIF
   NEXT
[/size]
Attachments
LangTransl_en.zip
(60.33 KiB) Downloaded 570 times

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

Re: Question about the function: DC_WorkArea2Excel()

#4 Post by rdonnay »

DC_WorkArea2Excel() uses the Excel ActiveX control that is installed on your computer to create the XLS file.

I don't know of any way that it can be told to create a DBF instead of an XLS.

I will need a small sample program from you that demonstrates this problem.
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 about the function: DC_WorkArea2Excel()

#5 Post by Eugene Lutsenko »

I made different short names for dbf and xls files and saw that there are no xls files anywhere. the impression is that they are not generated and not recorded. Although the function's progress bar shows that they are being formed.

Example do. I'll send it soon
Attachments
sample.zip
(1.76 MiB) Downloaded 585 times

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

Re: Question about the function: DC_WorkArea2Excel()

#6 Post by rdonnay »

Your sample correctly creates an XLS file on my computer.

My guess is that you have Excel configured in a way that it creates a DBF.
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 about the function: DC_WorkArea2Excel()

#7 Post by Eugene Lutsenko »

rdonnay wrote:Your sample correctly creates an XLS file on my computer.

My guess is that you have Excel configured in a way that it creates a DBF.
May be. I configured Excel to OPEN dbf files. And he can be using this setting to create them? I'll check it out

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 about the function: DC_WorkArea2Excel()

#8 Post by Eugene Lutsenko »

Changed this setting to a different program. It didn't change anything. I also have two versions of Excel on my computer: 2003 and 2010.

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

Re: Question about the function: DC_WorkArea2Excel()

#9 Post by rdonnay »

Attached is the XLS file that was created.

This is a mystery to me.
I can't find anything on a Google search to explain this, except for this: https://docs.microsoft.com/en-us/office ... fileformat

Try this:
Change _DCFUNCT.PRG as follows:

Line 91: Was #DEFINE xlWorkbookNormal -4143
Line 91: Is #DEFINE xlWorkbookNormal 16

Rebuild DCLIPX.DLL by running BUILD20.BAT or BUILD19_SL1.BAT
Attachments
Langtransl_en.zip
(82.48 KiB) Downloaded 594 times
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 about the function: DC_WorkArea2Excel()

#10 Post by Eugene Lutsenko »

Hi, Roger! You helped me figure it out. Thank you very much! When I started looking at the file you sent in Excel, I saw the files created by the program. It turned out that this function writes the result (xls files) not to the folder where the program that launched it is located, but to "My documents". In other words, it should specify not just the filename, but the full path and file name. When I did this, everything worked as it should.
Attachments
sample2.zip
(916.21 KiB) Downloaded 602 times

Post Reply