Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Set Border With Font Size Through API

richard.joseph.pollak
Advocate

Set Border With Font Size Through API

richard.joseph.pollak
Advocate
Advocate

The font size for borders in the Active Standard Style in my drawing document is set to 0.120.

When I add a default border manually through the browser by right-clicking 'Default Border' and choosing 'Insert Drawing Border...', the new border has the correct font size.

However, when I add a default border through the api using the code below, the new border's font size is much too large.

 

 

ThisDrawing.Document.ActiveSheet.AddDefaultBorder()

 

 

Added ManuallyAdded ManuallyAdded Through APIAdded Through API

 

Seems like this should be simple to do, but I'm stuck. When I try reading the documentation, I can't get the sample code for AddDefaultBorder() with arguments included to work, so I'm not sure if it is properly documented. I just need to get the correct font size. If there's a way to change it after inserting the border, that would be a good enough solution as far as I'm concerned.

0 Likes
Reply
Accepted solutions (1)
555 Views
1 Reply
Reply (1)

richard.joseph.pollak
Advocate
Advocate
Accepted solution

I finally figured it out. Here's the solution in case anyone with a similar problem finds this post:

 

oTextStyle = ThisDrawing.Document.StylesManager.TextStyles("Text Style Name")

ThisDrawing.Document.ActiveSheet.AddDefaultBorder(TextStyle:= oTextStyle)
0 Likes