Hi, I am trying to change font size of an object attribute within the model, but whenever I do so, the font size is changed of all object attributes I have in the model. Here is what I do:
model.TextOccList()[0].AttrOcc(1).SetPortOptions(Constants.ATTROCC_PORT_FREE, 4) FF = model.TextOccList()[0].AttrOcc(1).FontStyleSheet() FF.Font(1049).setSize(16) model.TextOccList()[0].AttrOcc(1).setFontStyleSheet(FF)
so, the above code works, but it changes the font size of all attributes, so I thought I would try to overwrite the font size of the specific attributes that need to have different font. So, later in the code I put this, but it doesn't have any effect at all.
kpiArray[r].AttrOcc(9).SetPortOptions(Constants.ATTROCC_CENTER, 4) kpiArray[r].AttrOcc(9).setAlignment(Constants.ATTROCC_ALIGN_LEFT) FF2 = kpiArray[r].AttrOcc(9).FontStyleSheet() FF2.Font(1049).setSize(10) model.TextOccList()[0].AttrOcc(1).setFontStyleSheet(FF2)
Has anyone do anything similiar to this before? Please share ideas...
Amol Patil on
Hi Di,
The fontstylesheets are maintained at database level, so by default the default font style is applied to all attributes. So if you collect the fontstyle in variable from an attribute and modify it, it will be modified for all the attributes using it.
You need to create a new fontstylesheet and apply it to the attribute occurrences.Check the method Database.createFontStyle()
Regards,
Amol Patil