Hi, Support:
What is the method to get text font color/size/fontname in shape and textframeShape based on Apose.slides.dll v23.5 based on Vb.net?
Thanks for your help!
Hi, Support:
What is the method to get text font color/size/fontname in shape and textframeShape based on Apose.slides.dll v23.5 based on Vb.net?
Thanks for your help!
@ducaisoft,
Thank you for contacting support.
I am working on the question and will get back to you as soon as possible.
And another issue is that how to get the background color of a given slide, esp. how to detect the background of the slide is white.
@ducaisoft,
Let autoShape
is an AutoShape object. Then you can read format properties of a text portion as follows. Please note that the GetEffective
method is used to get actual property values.
' Get the first paragraph.
Dim paragraph = autoShape.TextFrame.Paragraphs(0)
' Get the first text portion.
Dim textPortion = paragraph.Portions(0)
' Get actual format properties from the text portion.
Dim portionFormat = textPortion.PortionFormat.GetEffective()
' Get the color of the text portion.
Dim fillType = portionFormat.FillFormat.FillType
If fillType = FillType.Solid Then
Dim textFillColor = portionFormat.FillFormat.SolidFillColor
' ...
End If
' Get the font height.
Dim fontHeight = portionFormat.FontHeight
' Get the font name.
Dim fontName = portionFormat.LatinFont.FontName
You can also read the default text portion properties set to the paragraph:
Dim defaultPortionFormat =
paragraph.ParagraphFormat.DefaultPortionFormat.GetEffective()
The following code example shows you how to get the slide background color:
' Get actual properties of the slide background.
Dim slideFillFormat = slide.Background.FillFormat.GetEffective()
' Get the background color.
If slideFillFormat.FillType = FillType.Solid Then
Dim slideColor = slideFillFormat.SolidFillColor
' ...
End If
Thanks! It works.
And another issue is that how to get the font properties such as fontsize,fontname,fontcolor,fontStyle for each char in the textPortion?
@ducaisoft,
A text portion is the smallest text item, therefore you should read the font properties from the text portion containing the text characters.