I’ve got a template powerpoint slide that I open, then replace some values. The template’s font starts out as Arial. After replacing some text, it ends up as Times New Roman. How can I set the text back to Arial? I tried:
myParagragh.Text.Format(“FontName=Arial”)
but I was just guessing as to what goes in the string parameter, and guessed wrong. Is this the correct command to use if the correct string parameter is used?
I posted a question to the thread https://forum.aspose.com/t/error-font-style-is-lost-after-4-paragraphs/111256 which seemed to address this problem but it hasn’t gotten any response.
At first replace your code: For i = 0 To theParagragh.Portions.Count - 1 If theParagragh.Portions.Item(i).Text = "" Or _ theParagragh.Portions.Item(i).Text Is Nothing Or _ theParagragh.Portions.Item(i) Is Nothing Then theParagragh.Portions.RemoveAt(i) Else BreakdownPortion(theParagragh.Portions.Item(i)) theParagragh.Text.Format("FontName=Arial") End If Next
with: For i = 0 To theParagragh.Portions.Count - 1 If theParagragh.Portions.Item(i).Text.Length > 0 Then BreakdownPortion(theParagragh.Portions.Item(i)) End If Next
Text font can be set as: theParagraph.Portions.Item(i).FontIndex = index
where index is zero-based index of font in the fonts collection.