EXCEL and cell borders - how to set them?

Moderator: Rathinagiri

Post Reply
User avatar
mol
Posts: 2842
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 119 times
Been thanked: 65 times
Contact:

EXCEL and cell borders - how to set them?

Post by mol » Thu Oct 27, 2011 6:24 am

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

User avatar
Rathinagiri
Posts: 5166
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 129 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Thu Oct 27, 2011 6:48 am

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
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

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

Post by mol » Thu Oct 27, 2011 6:57 am

Many thanks for your quick help, Rathi!

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

Post by mol » Thu Oct 27, 2011 12:00 pm

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

Post Reply