We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Chnage style in an existing document

Thread ID:





63376 Jul 3,2007 12:31 PM UTC Jul 3,2007 09:04 PM UTC WinForms 1
Tags: DocIO
Christian Nein
Asked On July 3, 2007 12:31 PM UTC


how can I apply existing styles to some text in an existing document? Example:

object obj1 = Word.WdUnits.wdLine;
object obj2 = Word.WdMovementType.wdExtend;
selection.EndKey(ref obj1, ref obj2); // select the current line
selection.set_Style("Bissantz Heading 2"); // apply some user specific style

Anyway, I am missing the "Selection" object which is a crucial object when formatting DOC-files using MS Office InteropAssemblies. I still did not find the corresponding object of DocIO.

Thanks & best regards

Ajish [Syncfusion]
Replied On July 3, 2007 09:04 PM UTC

Hi Christian,

Thank you for your interest in Essential DocIO.

Essential DocIO supports creation of custom styles that can apply a whole group of formats in one simple task. This sample demonstrates how custom styles can be created and applied using Essential DocIO.

Here is a code snippet to create and apply custom styles.

// Create Paragraph styles
IParagraphStyle style = document.AddParagraphStyle ( "MyStyle");
style.CharacterFormat.FontName = "Bitstream VeraSerif";
style.CharacterFormat.FontSize = 10f;

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

A sample demonstrating support for StylesAnd Formatting is available along with our install and it can be found at the following path

C:\Documents and Settings\{user}\My Documents\Syncfusion\EssentialStudio\\Windows\DocIO.Windows\Samples\2.0\Document Formatting\StylesAndFormatting\cs

Kindly take a look and let us know if you have any other questions.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon