I am unable to set properties such as FontBold, FontItalic, etc on portions that are a part of a Paragraph that contains existing Portions. The members are marked as RW, however they cannot be set.
Here's an example:
Dim tCell As Cell Dim tPara As Paragraph = New Paragraph Dim tPort As Portion = New Portion tCell.Paragraphs.clear() tPara.Portions.clear() tPort.FontBold = False tPort.Text = "Hello" tPara.Portions.Add(tPort) tPort = New Portion tPort.FontBold = True tPort.Text = " World!" tPara.Portions.Add(tPort) tCell.Paragraphs.Add(tPara)
In this example, "Hello" will not be bold (as expected), but "World!" will not be bold either. If this is by design, then what is the point of having 'portions' which are defined in the Aspose.Slides documentation as segments of a line(Paragraph) with different formatting?
Just to clarify, add the set portion.text, then add portion to paragraph, and paragraph to cell.textframe, THEN modify the font properties of the portion?
I'm just curious now, is this by design? I think it'd make more sense to be able to modify font properties of a portion at the same time you're adding text, etc. Rather than having to go back after adding Text, etc, and select it from the paragraph.portions() array.
7)fontBold is still false after setting to true, no font properties are saved in the portion.
Attached is the code for the function. The function takes a string of html tags and text, and formats the portions of text according to the html tag they lie within.
Why you need all these ArrayLists? 2. For i As Integer = 0 To (htmlStringArray.Length - 1) definitely won’t work because logic is wrong. You set font properties for empty portions. For the portion with text no font properties are applied. Try to run this code in debugger and check how it works.
I have changed the function to give the idea how to set properties. Anyway, you probably have to change html parsing code to make it work.
1. Yes I understand I didn't need them. After I posted the attachment in my previous mail, I revised the function to remove the unnecessary arrays.
2. This For loop was for an array of strings to process, not for an array of portions.
So ultimately I need to have an array of paragraphs (paras in your revision) to add paragraphs to, instead of directly to the textframe? Sorry if it seems like I'm clueless, the documentation for modifying multiple portions in a single paragraph, and multiple paragraphs in a textframe does not exist (at least I've not been able to locate any)