Change existing styles, not adding new ones

I'm writing a small utility to update the styles within a series of documents and templates to be consistent with a master document.

I'm aware of the Add() method on the styles collection, however I'm interested in doing something like:
foreach (Style myStyle in document.Styles)
myStyle.CharacterFormat.Bold = ...
to a series of templates.

However after I have saved these .dot files the changes are not carried across.

Also I need to change the default paragraph font in these documents. Any suggestions ?

I'm using the 6.1 DocIO library.


1 Reply

AD Administrator Syncfusion Team February 29, 2008 09:44 AM UTC

Hi Michael,

Sorry for the delay in responding.

1.However after I have saved these .dot files the changes are not carried across.

I am not able to reproduce the issue that you mentioned here. I have created a simple sample with paragraph styles and change it as dot file, the styles are applied.

Here is the sample:
http://websamples.syncfusion.com/samples/DocIO.Windows/72042-f/main.htm

2.Also I need to change the default paragraph font in these documents. Any suggestions ?

You can change the default paragraph font by using the following code snippet:


[C#]
// Create Paragraph styles
style = document.AddParagraphStyle ( "MyStyle_Normal" );
style.CharacterFormat.FontName = "Bitstream Vera Serif";
style.CharacterFormat.FontSize = 10f;
style.CharacterFormat.TextColor = Color.FromArgb ( 0 , 21 , 84 );

// Applying style to the current paragraph.
paragraph.ApplyStyle ( "MyStyle_Normal" );



Please refer the sample in the below link which illustrates the above:
http://websamples.syncfusion.com/samples/DocIO.Windows/F-72042/main.htm

Please try this and let me know if this helps.

Regards,
G.Yavana




Loader.
Up arrow icon