We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Small info needed Styles embedding into a word document

Hi All,
I am new to this forum.
I have downloaded the Evaluation or trail version of AsposeWord for java i am able to run my example ,its very good one.

i am reading a existing MS-Word file and creating new file and pasting all the contents also i am adding new text like helloworld and i am trying to read existing style into Style class and it will be good if i can apply same style to my text but i am not able to do this.its coming in red color.

can you please help me.
Here is the the code

StyleCollection styleCollection = sourceDoc.getStyles();
Style oldStyle = null;
for (Style style : sc)
{

    System.out.println("style name :" + style.getName());
    if (style.getName().equalsIgnoreCase("Test - helloStyle"))
    {//Test - hello is the style name which is coming from above systm.out.println
        oldStyle = style;
    }

}
DocumentBuilder builder = new DocumentBuilder(dstDoc);
builder.getListFormat().setList(oldStyle.getList());
builder.writeln("welcome :" + "test123");
String s = oldStyle.getName();
builder.writeln("Hello World: " + s + ", bulleted.");
builder.getDocument().save("c:\\test\\" + "Test1.doc");
/////

i am getting the output but its coming in redcolor on the top of the document where but my style is in different color.
Evaluation Only. Created with Aspose.Words.
Copyright 2003-2008 Aspose Pty Ltd.

welcome: test123
Hello World: Test - helloStyle, bulleted.
Evaluation Only. Created with Aspose.Words. Copyright 2003-2008 Aspose Pty Ltd.
is it coming due to i am using Evaluation version.thanks in advance.

Thanks,
Susant

Hi

Thanks for your interest in Aspose products. Aspose.Words adds evaluation watermark at the top of your document when you use Aspose.Words in evaluation mode. Please request a 30-day Temporary License to test Aspose.Words without evaluation limitations as described here
https://purchase.aspose.com/temporary-license
And please apply license as described here:
https://docs.aspose.com/words/net/licensing/
Please let me know in case of any issues. I will be glad to help you.
Best regards,