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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Character Style Types

Thread ID:

Created:

Updated:

Platform:

Replies:

92443 Jan 15,2010 08:15 AM UTC Feb 16,2010 02:58 PM UTC ASP.NET Web Forms (Classic) 8
loading
Tags: DocIO
Chris Lindsay
Asked On January 15, 2010 08:15 AM UTC

Does DocIO support Character Style types? I need to be able to apply a style to a text range within a paragraph, that is, have several text ranges in one paragraph with different character styles. Using character format to achieve this is not sufficient because this is just formatted text not text using a given style. Is it possible to do this with DocIO? I've been looking through the class hierarchy and I can't seem to find a way to do it. WTextRange only has ApplyCharacterFormat(), not ApplyStyle() like WParagraph.

Rajendran [Syncfusion]
Replied On January 18, 2010 03:11 PM UTC

Hi Chris,

Thank you for your interest in Syncfusion Products.

Currently we are using character format for formatting the character. In future we will enhance character style to support just like styles in paragraph. Regarding your query Please try our code snippet to apply a style to a text range within a paragraph.

http:// files.syncfusion.com/samples/DocIO.Web/CharacterStyles.zip

Please let us know if you have any questions.

Regards,
Rajendran

Rajendran [Syncfusion]
Replied On January 18, 2010 03:24 PM UTC

Hi Chris,

Thank you for your interest in Syncfusion Products.

Currently we are using character format for formatting the character. In future we will enhance character style to support just like styles in paragraph. Regarding your query Please try our code snippet to apply a style to a text range within a paragraph.

http://files.syncfusion.com/samples/DocIO.Web/CharacterStyles.zip

Please let us know if you have any questions.

Regards,
Rajendran

Chris Lindsay
Replied On January 19, 2010 05:49 AM UTC

Yeah I had looked at that sample before starting this post. For what I need to do, applying a character format is no good. I must be able to apply a style to a text range within the paragraph.

The problem originates from the fact that when I import content from one document to another where the two documents have a style with the same name and same character format DocIO introduces a new style, this is not how Word behaves. I am trying to find a work-around for this problem, but I'm restricted by this DocIO limitation.

Is there any other way by which I can apply a style to a text range rather than the paragraph?


Rajendran [Syncfusion]
Replied On January 19, 2010 11:38 AM UTC

Hi Chris,

Currently we are supporting character format for text range. In future release we will enhance it to character styles. Kindly try the following code snippet to apply formatting to a text range.

// Apply formatting for text range
textRange = paragraph.AppendText("We are a leading provider of software components and tools for the Microsoft .NET platform.");
textRange.ApplyCharacterFormat(style.CharacterFormat);

For importing content from one document to another without loosing the style use the following code snippet.

WordDocument document = new WordDocument("Sample1.doc", FormatType.Doc);
WordDocument doc = new WordDocument("Sample.doc", FormatType.Doc);

/* Importing content from one document to another.Here boolean value - true denotes importing content along with styles from one document to another.*/

doc.ImportContent(document, true);

Please do find the sample from the below location which illustrates the same and provide more information if we misunderstood your requirements.

http://files.syncfusion.com/samples/DocIO.Web/ImportCharacterStyles.zip

please let us know if you have any questions.

Regards,
Rajendran


Chris Lindsay
Replied On January 20, 2010 12:55 AM UTC

Nice one. I actually need to use ImportContent(documentToImport, false) since I don't want to bring the styles from the import document, instead I want the styles in the target document to be applied. Where the two documents contain the same styles, importing the content with the import styles flag set to false causes the imported content to use the styles of the main document. Don't know if this true for all cases, but it seems to solve my problem.

Thanks.

Rajendran [Syncfusion]
Replied On January 20, 2010 04:47 AM UTC

Hi Chris,

We are glad that your problem has been solved.

Please let us know if you have any questions.

Regards,
Rajendran

Muhammad Ali Chughtai
Replied On February 14, 2010 01:52 PM UTC

Hi can i have a good example of creating a document using docio like i have seen it on

http://www.scriptingjournal.com/2010/01/create-a-document-using-syncfusion-docio/

Rajendran [Syncfusion]
Replied On February 16, 2010 02:58 PM UTC

Hi Muhammad,

Thank you for your interest in Syncfusion Products.

Please do find the sample from the below location and provide more information if we misunderstood your requirements.

http://help.syncfusion.com/samples/DocIO.Windows/SampleDocEx.zip

Please let us know if you have any other questions.

Regards
Rajendran

CONFIRMATION

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.

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

;