Font Change when I try to update text inside Rectangle object in the slide

I am updating the text inside the rectangle share object in the slide.

Orignially before updating the text, rectangle font size is Arial Black 44. after updating the text, font size will reset to Arial 10.

Private Sub ReplaceSlideText(ByVal iSlideId As Integer, ByVal OldText As String, ByVal NewText As String)

Try

Dim slide As Slide = pres.GetSlideByPosition(iSlideId)

For i As Integer = 0 To slide.Shapes.Count - 1

If TypeOf slide.Shapes(i) Is Aspose.Slides.Rectangle Then

If (slide.Shapes(i).TextFrame.Paragraphs.Item(0).Text.IndexOf(OldText) <> -1) Then

slide.Shapes(i).TextFrame.Paragraphs.Item(0).Text = Replace(slide.Shapes(i).TextFrame.Paragraphs.Item(0).Text, OldText, NewText)

Exit Sub

End If

End If

Next

Catch oEx As Exception

Throw New Exception("Error while creating Create Deck Copy at:createdeck.aspx.vb:ReplaceSlideText" & oEx.Message)

End Try

End Sub

How to retain orignal font size? if not possible how to update font for the text inside rectangle object.

Dear vinniesn,

Thanks for considering Aspose.Slides.

Change the line inside the innermost if statement in your code likes this

slide.Shapes(i).TextFrame.Paragraphs(0).Portions(0).Text = Replace(slide.Shapes(i).TextFrame.Paragraphs.Item(0).Text, OldText, NewText)