ViewSchedule cell style override (border) - help needed

sobon.konrad
Advocate
Advocate

ViewSchedule cell style override (border) - help needed

sobon.konrad
Advocate
Advocate

I have been trying to override the Header section of the schedule with some border styles. I can easily change text properties (underline, italics, bold, text size etc) but cant seem to be able to change the border display/lineweight.

 

Here's what I am doing:

 

gStyles = FilteredElementCollector(doc).OfClass(GraphicsStyle).ToElements()

for i in gStyles:
	if i.GraphicsStyleCategory.Name == "veryFatLineStyle":
		lineStyle = i

hsd = tableData.GetSectionData(SectionType.Header)
hsd.SetCellText(hsd.FirstRowNumber, hsd.FirstColumnNumber, "XYZ Schedule")
if hsd.AllowOverrideCellStyle(hsd.FirstRowNumber, hsd.FirstColumnNumber):

	options = TableCellStyleOverrideOptions()

	options.BorderLineStyle = True
	options.BorderBottomLineStyle = True
	options.BorderLeftLineStyle = True
	options.BorderRightLineStyle = True
	options.BorderTopLineStyle = True
	
	tcs = TableCellStyle()
	tcs.SetCellStyleOverrideOptions(options)

	tcs.BorderBottomLineStyle = lineStyle.Id
	tcs.BorderLeftLineStyle = lineStyle.Id
	tcs.BorderRightLineStyle = lineStyle.Id
	tcs.BorderTopLineStyle = lineStyle.Id

	hsd.SetCellStyle(hsd.FirstRowNumber, hsd.FirstColumnNumber, tcs)

 Can anyone tell me if I am making any mistakes? I am only confused by the BorderLineStyle method present in the TableCellStyleOverrideOptions while its not available in the TableCellStyle class. 

 

Thanks! 

0 Likes
Reply
Accepted solutions (1)
1,639 Views
6 Replies
Replies (6)

rosalesduquej
Autodesk Support
Autodesk Support

Hi Konrad.Sobon,

 

It looks to me that BorderLineStyle indicates if any of the 4 borders are overridden.  And setting this flag sets all 4 border styles to be overridden.

 

Maybe try setting only BorderLineStyle and then modify the 4 lines that this property will make them avalible to be overridden. 

 

Let me know how it goes.

 

Best,

 



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes

sobon.konrad
Advocate
Advocate

Can you please provide a sample code of the solution that you are suggesting? I believe I did try that already and the result was still the same, but just to make sure code would be appreciated. Thanks! 

0 Likes

chris
Explorer
Explorer

Hello,

 

I am experiencing the same issue. Did you find a solution?

0 Likes

sobon.konrad
Advocate
Advocate

I am sorry but i didn't and judging by the responses from Autodesk folks they dont know either. 

0 Likes

chris
Explorer
Explorer

Hi, I know it is possible as I have seen other API's doing what we are trying...

0 Likes

chris.j.mckeown
Contributor
Contributor
Accepted solution

Hello,

 

I have resolved this issue.

 

instead of:

 

tcs.BorderBottomLineStyle = styleLines.Id;

 

use the GraphicsStyleCategory Id:

 

tcs.BorderBottomLineStyle = styleLines.GraphicsStyleCategory.Id;

 

Regards