Setting the bold property on the font object of a document-wide style make it disappear in generated document



I want to define a paragraph style and use it to format a paragraph in the generated Word document. Here is the code I use:

Document Doc=new Document();


Style newStyle;

newStyle=Doc.Document.Styles.Add(StyleType.Paragraph, “testStyle”);



//The following line makes the “testStyle” style disappear in the generated doc



DocumentBuilder db=new DocumentBuilder(Doc);


db.Writeln(“test text”);


When I uncomment the lines that sets the ‘bold’ property in the ‘font’ object of the ‘testStyle’ style object, and regenerate the document: the generated paragraph does not have any style defined, and none of the formatting I specified in the ‘testStyle’ style were applied.

Can you reproduce this ? If yes, is my code wrong ?

I use Word 2003 to view the generated documents (they are generated in the .doc format).
The same behavior occurs if I set the ‘Color’ property instead of the ‘Bold’ property (I did not try any other properties, but I guess this happens for all properties of the ‘Font’ object)



Thank you for considering Aspose.

Are you using the latest version of the component? Your code works just fine for me, the testStyle style does not disappear in the resulting document.


Indeed, version solved the problem. I previously used version

Thank you for the quick response.