DBF To Excel

You can share your experience with HMG. Share with some screenshots/project details so that others will also be benefited.

Moderator: Rathinagiri

User avatar
mol
Posts: 3047
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 172 times
Been thanked: 92 times
Contact:

Re: DBF To Excel

Post by mol » Tue Mar 31, 2009 8:51 am

it really works, when I use
oSheet:Cells:Font:Size := 12
oSheet:Cells:Font:Bold := .t.
but if I add coordinates to CELLS:
oSheet:Cells( 1, 1 ):Font:Size := 12
oSheet:Cells( 1, 1 ):Font:Bold := .t.
It doesn't work!

The difference is, that 1st example makes whole sheet bolded and blue, but I wanna bold only one cell...

Marek

User avatar
mol
Posts: 3047
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 172 times
Been thanked: 92 times
Contact:

Post by mol » Tue Mar 31, 2009 8:54 am

Sorry, for my quick post... Now it works! I don't know what I've changed...

Time for pause and coffee

User avatar
mol
Posts: 3047
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 172 times
Been thanked: 92 times
Contact:

Post by mol » Tue Mar 31, 2009 9:06 am

One problem left...
How to use SaveAs function.
Do you have any working wxample?

User avatar
mol
Posts: 3047
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 172 times
Been thanked: 92 times
Contact:

Post by mol » Tue Mar 31, 2009 9:37 am

I still use the same export to excel routine, which copy data to clipboard first (many thanks for Alex Gustow idea - it really speed up exporting process), but now, I reach error:
Error 2606804/3 DISP_E_MEMBERNOTFOUND: PASTE</p><BR>
Called from TOLEAUTO:PASTE(0)
Do you know what does it mean?
From where it is - I didn't change anything...
I'm angry when I must use something from M$...

User avatar
esgici
Posts: 4460
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 336 times
Been thanked: 103 times
Contact:

Post by esgici » Tue Mar 31, 2009 10:01 am

mol wrote:...
I'm angry when I must use something from M$...
Hi Marek

You aren't alone !

Regards

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
mol
Posts: 3047
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 172 times
Been thanked: 92 times
Contact:

Post by mol » Tue Mar 31, 2009 12:14 pm

I think, that may be problem with linker - one change in program in different place causes this error. It's very strange...

User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Post by fchirico » Wed Apr 01, 2009 3:12 am

sudip wrote:Hi,

I was looking for an application which can transfer data from grid to excel. MOL showed me an example (very well written) directly copied from his application. Thank you MOL. :)

I already used excel in my xHarbour apps. I modified slightly to make it HMG compatible. I got CopyToClipboard() function from this forum. Finally I made this application to share with you. :)

There is a file "excel.ch". Yes, I uploaded it for you in ShowExcel.zip. :)
Español:

Sudip, muchas gracias por tu trabajo!

Solo un pequeño comentario:

a la línea "cMemo += ExcelDt(mTemp)"
yo la reemplacé por "cMemo += dtoc(mTemp)"

ya que de esta forma exporta corretamente las fechas. Por ejemplo cuando están vacías u otros casos. Previamente to hice el seteo de la fecha:

SET DATE TO.... o como lo desee cada uno.


Saludos y muchas gracias.

Inglés power by Google.

Sudip, thank you very much for your work!

Just a small comment:

the line "cMemo + = ExcelDt (mTemp)
I replaced it with "cMemo + = dtoc (mTemp)

since this correctly exported date. For example, when they are empty or otherwise. Before I did the settings to the date:

SET DATE TO .... or as you like each.

Greetings and thank you very much.

Fernando Chirico.
Saludos, Fernando Chirico.

User avatar
sudip
Posts: 1444
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 4 times

Post by sudip » Wed Apr 01, 2009 11:17 am

Hi Fernando,

Thank you very much for your input. :)

It is first time I meet you :)

Previously I used dtoc(). But dtoc() depends on _SET_DATEFORMAT. If it is British (dd/mm/yy) (as it is generally used in India), then Excel has problem for dates like 25th Dec 2008. Because dtoc() will return "25/12/08" and some times it shows error and some times it think it is a Character or Numeric field!!! :) So I created ExcelDt() function to use in every country.

Please advise me like this :)

With best regards.

Sudip
With best regards,
Sudip

User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Post by fchirico » Wed Apr 01, 2009 2:23 pm

sudip wrote:Hi Fernando,

Previously I used dtoc(). But dtoc() depends on _SET_DATEFORMAT. If it is British (dd/mm/yy) (as it is generally used in India), then Excel has problem for dates like 25th Dec 2008. Because dtoc() will return "25/12/08" and some times it shows error and some times it think it is a Character or Numeric field!!! :) So I created ExcelDt() function to use in every country.


Sudip
Sudip Thanks!

Are points of view. If you define a year with 4 digits 25/12/2008 exported to date field correctly. It also exports the correct blank fields.
The theme of the SET DATE can be solved in many ways.

Nice to meet you, and a pleasure to have you on the forum.

Regards, Fernando Chirico.
Saludos, Fernando Chirico.

User avatar
mol
Posts: 3047
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 172 times
Been thanked: 92 times
Contact:

Post by mol » Thu Apr 02, 2009 12:04 pm

Finally,
I have found solution to the problem of SAVEAS function...

simply, it must look:
oSheet:SaveAs(cNameOfTheFile)
Whole time I was trying this:
oExcel:SaveAs(cNameOfTheFile)
So simply mistake and so hard to find this...

Best regards, Marek

PS.
It still generates error:
Error 2608724/3 DISP_E_MEMBERNOTFOUND: SAVEAS
Called from TOLEAUTO:SAVEAS(0)
Called from ZAPISZRAPORTXLS(3142)
Only first compilation run well, next generates error... :x

Post Reply