Page 3 of 4

Re: DBF To Excel

Posted: Tue Mar 31, 2009 8:51 am
by mol
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

Re: DBF To Excel

Posted: Tue Mar 31, 2009 8:54 am
by mol
Sorry, for my quick post... Now it works! I don't know what I've changed...

Time for pause and coffee

Re: DBF To Excel

Posted: Tue Mar 31, 2009 9:06 am
by mol
One problem left...
How to use SaveAs function.
Do you have any working wxample?

Re: DBF To Excel

Posted: Tue Mar 31, 2009 9:37 am
by mol
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$...

Re: DBF To Excel

Posted: Tue Mar 31, 2009 10:01 am
by esgici
mol wrote:...
I'm angry when I must use something from M$...
Hi Marek

You aren't alone !

Regards

--

Esgici

Re: DBF To Excel

Posted: Tue Mar 31, 2009 12:14 pm
by mol
I think, that may be problem with linker - one change in program in different place causes this error. It's very strange...

Re: DBF To Excel

Posted: Wed Apr 01, 2009 3:12 am
by fchirico
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.

Re: DBF To Excel

Posted: Wed Apr 01, 2009 11:17 am
by sudip
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

Re: DBF To Excel

Posted: Wed Apr 01, 2009 2:23 pm
by fchirico
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.

Re: DBF To Excel

Posted: Thu Apr 02, 2009 12:04 pm
by mol
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