Hello,
I would like to get the style overides for the body headers of a schedule. However when I use this function, it does not return the correct values for font name, justification etc it seems size cannot be overidden.
Dim objScheduleDefinition As ScheduleDefinition = objViewSchedule.Definition
Dim ListOfRows As New List(Of String)
strRowHedding = "Headers" & clsReadWrite.strPublicConstCSVsepp & "Styles"
For Each objScheduleFieldId As ScheduleFieldId In objScheduleDefinition.GetFieldOrder
Dim objScheduleField As ScheduleField = objViewSchedule.Definition.GetField(objScheduleFieldId)
If Not objScheduleField.IsHidden Then
Dim objFormatOptions As FormatOptions = objScheduleField.GetFormatOptions
Dim objTableCellStyle As TableCellStyle = objScheduleField.GetStyle
Dim objHorizontalAlignmentStyle As HorizontalAlignmentStyle = objTableCellStyle.FontHorizontalAlignment
Dim objVerticalAlignmentStyle As VerticalAlignmentStyle = objTableCellStyle.FontVerticalAlignment
Dim strFontName As String = objTableCellStyle.FontName
Dim bolIsFontBold As Boolean = objTableCellStyle.IsFontBold
Dim bolIsFontItalic As Boolean = objTableCellStyle.IsFontItalic
Dim bolIsFontUnderline As Boolean = objTableCellStyle.IsFontUnderline
objViewSchedule.Document.GetElement(objViewSchedule.HeaderTextTypeId).Name
Dim dblTextSize As Double = Math.Round(objTableCellStyle.TextSize / 3.77952756, 1, MidpointRounding.AwayFromZero)
strRowHedding = strRowHedding & clsReadWrite.strPublicConstCSVsepp & Chr(34) & objScheduleField.ColumnHeading & "|" & strFontName & "|" & dblTextSize & "|Bold:" & bolIsFontBold & "|Underline:" & bolIsFontUnderline & "|Horiz:" & objHorizontalAlignmentStyle.ToString & "|Vert:" & objVerticalAlignmentStyle.ToString & Chr(34)
End If
Next
Kind Regards
David
Solved! Go to Solution.
Hello,
I would like to get the style overides for the body headers of a schedule. However when I use this function, it does not return the correct values for font name, justification etc it seems size cannot be overidden.
Dim objScheduleDefinition As ScheduleDefinition = objViewSchedule.Definition
Dim ListOfRows As New List(Of String)
strRowHedding = "Headers" & clsReadWrite.strPublicConstCSVsepp & "Styles"
For Each objScheduleFieldId As ScheduleFieldId In objScheduleDefinition.GetFieldOrder
Dim objScheduleField As ScheduleField = objViewSchedule.Definition.GetField(objScheduleFieldId)
If Not objScheduleField.IsHidden Then
Dim objFormatOptions As FormatOptions = objScheduleField.GetFormatOptions
Dim objTableCellStyle As TableCellStyle = objScheduleField.GetStyle
Dim objHorizontalAlignmentStyle As HorizontalAlignmentStyle = objTableCellStyle.FontHorizontalAlignment
Dim objVerticalAlignmentStyle As VerticalAlignmentStyle = objTableCellStyle.FontVerticalAlignment
Dim strFontName As String = objTableCellStyle.FontName
Dim bolIsFontBold As Boolean = objTableCellStyle.IsFontBold
Dim bolIsFontItalic As Boolean = objTableCellStyle.IsFontItalic
Dim bolIsFontUnderline As Boolean = objTableCellStyle.IsFontUnderline
objViewSchedule.Document.GetElement(objViewSchedule.HeaderTextTypeId).Name
Dim dblTextSize As Double = Math.Round(objTableCellStyle.TextSize / 3.77952756, 1, MidpointRounding.AwayFromZero)
strRowHedding = strRowHedding & clsReadWrite.strPublicConstCSVsepp & Chr(34) & objScheduleField.ColumnHeading & "|" & strFontName & "|" & dblTextSize & "|Bold:" & bolIsFontBold & "|Underline:" & bolIsFontUnderline & "|Horiz:" & objHorizontalAlignmentStyle.ToString & "|Vert:" & objVerticalAlignmentStyle.ToString & Chr(34)
End If
Next
Kind Regards
David
Solved! Go to Solution.
Solved by jeremy_tammik. Go to Solution.
It is hard to say anything offhand. What values you expect to see, and what values do you actually observe?
Can you share a complete minimal reproducible case for analysis?
It is hard to say anything offhand. What values you expect to see, and what values do you actually observe?
Can you share a complete minimal reproducible case for analysis?
Thank you for your reply. Following is an image of a test schedule from an attached sample model:
Following are the results. I'm getting correct results from the title (Header) section, but not from the field title where I have overridden the justification to top right and the font.
Bahnschrift|5|Bold:True|Underline:True|Horiz:Center|Vert:Middle |
Mark (Right Top)|Arial|2.4|Bold:False|Underline:False|Horiz:Left|Vert:Middle |
Kind Regards
David
Thank you for your reply. Following is an image of a test schedule from an attached sample model:
Following are the results. I'm getting correct results from the title (Header) section, but not from the field title where I have overridden the justification to top right and the font.
Bahnschrift|5|Bold:True|Underline:True|Horiz:Center|Vert:Middle |
Mark (Right Top)|Arial|2.4|Bold:False|Underline:False|Horiz:Left|Vert:Middle |
Kind Regards
David
Thank you for the sample material. I passed them on to the development team for analysis..
Thank you for the sample material. I passed them on to the development team for analysis..
They reply:
The TableCellStyle of ScheduleField is for the whole column of the body section of the schedule, while the body header may have a different TableCellStyle if overridden. To retrieve header styles, there is no direct API exposed in the schedule. The only way I can think of is to use GetTableCellStyle:
It needs to be called in Body section and the user needs to know which row and column is the header.
Example code:
TableCellStyle objTableCellStyle = objViewSchedule
.GetTableData()
.GetSectionData(SectionType.Body)
.GetTableCellStyle(0, 0);
They reply:
The TableCellStyle of ScheduleField is for the whole column of the body section of the schedule, while the body header may have a different TableCellStyle if overridden. To retrieve header styles, there is no direct API exposed in the schedule. The only way I can think of is to use GetTableCellStyle:
It needs to be called in Body section and the user needs to know which row and column is the header.
Example code:
TableCellStyle objTableCellStyle = objViewSchedule
.GetTableData()
.GetSectionData(SectionType.Body)
.GetTableCellStyle(0, 0);
Thank you that's it.
Thank you that's it.
Can't find what you're looking for? Ask the community or share your knowledge.