Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

excel borders using matlab

1,493 views
Skip to first unread message

Lars Berntsen

unread,
Jun 13, 2003, 3:20:02 AM6/13/03
to
Can someone help me with an example on how to add borders in excel
using matlab.

Vadivelu M

unread,
Jun 13, 2003, 4:54:42 AM6/13/03
to
Hi,


You may use ActiveX to add borders in excel using matlab. Following
is the sample matlab code.


%%%%%%
Excel = actXserver('Excel.Application');
set(Excel, 'Visible', 1);
wrkBooks = get(Excel, 'WorkBooks');
invoke(wrkBooks, 'Add');
wrkSheet = get(Excel, 'ActiveSheet');
range = invoke(wrkSheet, 'Range', 'B10:G20');
borders = get(range, 'Borders');
set(borders, 'ColorIndex', 3);
set(borders, 'LineStyle', 9);
%%%%%%


-Vadivelu M
===========

gjert

unread,
Jun 13, 2003, 5:51:03 AM6/13/03
to
What if you only want border one side?

Vadivelu M

unread,
Jun 13, 2003, 6:55:20 AM6/13/03
to
Hi,


borders is a collections of all. if you want, you can set one
particular border as,


my_border = get(borders, 'Item', <item>);
set(my_border, 'ColorIndex', 3);
set(my_border, 'LineStyle', 9);


where, <item> can be,
1 - all vertical but not rightmost
2 - all vertical but not leftmost
3 - all horizontal but not bottommost
4 - all horizontal but not topmost
5 - all diagonal down
6 - all diagonal up
7 - leftmost only
8 - topmost only
9 - bottommost only
10 - rightmost only
11 - all inner vertical
12 - all inner horizontal


so, you can choose your own side.


-Vadivelu M
===========

Vadivelu M

unread,
Jun 13, 2003, 8:38:10 AM6/13/03
to
Hi,


All lines of my sample code works fine in R13. To work in R12, please
change the line range = ... to,


range = get(wrkSheet, 'Range', 'B10:G20');


-Vadivelu M
===========

0 new messages