Page 1 of 1

EXCEL and cell borders - how to set them?

Posted: Thu Oct 27, 2011 6:24 am
by mol
Hi!
I need to export some data to excel workbook.
Everythink works OK, but, I don't know how to set borders of cells.

Has anybody working sample how to set borders?

Best regards, Marek

Re: EXCEL and cell borders - how to set them?

Posted: Thu Oct 27, 2011 6:48 am
by Rathinagiri

Code: Select all

xlEdgeLeft := 7
xlContinuous := 1
oExcel := TOleAuto():new( "Excel.Application" )
if Ole2TxtError() != "S_OK"
   MsgStop("Excel Not available.", "Error")
   return nil
endif
oExcel:WorkBooks:add()
oH := oExcel:Get( "ActiveSheet" )
oH:cells(1,1):Borders(xlEdgeLeft):LineStyle := xlContinuous
For other constants please see here:

http://technet.microsoft.com/en-us/libr ... 92886.aspx

Re: EXCEL and cell borders - how to set them?

Posted: Thu Oct 27, 2011 6:57 am
by mol
Many thanks for your quick help, Rathi!

Re: EXCEL and cell borders - how to set them?

Posted: Thu Oct 27, 2011 12:00 pm
by mol
I have a problem while exporting polish national characters to Excel. It takes from hmg 3.0.37 - I think, change of harbour 2 to harbour 3 causes problems.
Problem with national characters appear in reading data from MS SQL Database via ODBC, too.

Is known any solution for this problem?
Maybe I've missed any declaration which must be added to main function?


Best regards, Marek