Paragraph doesn't contain the correct style name


#1

Hi,

I am in the midst of evaluating and faced some problems. I have created some styles to differentiate several paragraphs, when the program goes through the paragraphs, and try to access the stylename of each paragraph, it is reflecting a different style name.

For example, I created a "CF-Test" style and marked several paragraphs as "CF-Test", when I navigate through the nodes, it still give me the style name as "Normal".

Anything wrong?

Document WordDoc = new Document(Request.PhysicalApplicationPath + "HASTH_LegalAuditRpt.doc");

foreach(Paragraph p in WordDoc.GetChildNodes(NodeType.Paragraph, true))

{

Response.Write( p.ParagraphFormat.Style.Name + " *---* " + p.GetText() + "
");

}

Regards,

John Tan


#2

It should all work fine. Styles and style names for paragraphs work correctly for us. If you attach your document to the post we will be able to provide a more useful answer.