Help! Paragraph


#1

With my script i can get the text inside an every paragraph of the document word, with GetText method.

dim nodes2 as NodeCollection = doc.GetChildNodes(NodeType.Paragraph,true)
dim j as integer
do while j < nodes2.count
dim Par as Paragraph = nodes2.Item(j)
response.write(Par.GetText())
j = j + 1
loop

How i can get the style (font,bold or not, underline,italic) of every word in a paragraph? A paragraph could be so: Example

"The enumeration values correspond to the MS Word built-in styles such as Normal, Heading 1, Heading 2 etc. All user defined styles are assigned the StyleIdentifier.User value."

Thanks


#2

Hi,

Thank you for considering Aspose.

A paragraph consists of text runs which exactly differs by font properties (name, size, color and many others). You can get all runs from a paragraph using the Paragraph.Runs property. Font properties of a run are stored in a Font object returned by Run.Font and the text of a run is returned by Run.Text. All text within a run has the same font formatting so if you need to know it for each word, just implement your own logic to split the text of the run to words.


#3

Thaks for your help!!

I have another question for you. You said that:

"All text within a run has the same font formatting so if you need to know it for each word, just implement your own logic to split the text of the run to words"

Therefore, it's possible that in un single run, there are a words with different font.size or font.bold, ecc... or every words, in the same run, has same font formatting. I hope that it has a same font formatting.

Thanks


#4

Sorry for being unclear, all text within one run has the same font formatting hence all the words have the same font formatting. So, in your example:

The enumeration - the first run

values correspond to the - the second run

MS Word - the third run

etc.