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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DocIO capabilities

Thread ID:

Created:

Updated:

Platform:

Replies:

74470 Jun 15,2008 08:02 PM UTC Jun 24,2008 10:04 AM UTC Windows Forms 3
loading
Tags: DocIO
Ian Hughes
Asked On June 15, 2008 08:02 PM UTC

I am evaluating DocIO for my application. The central feature for me is search and replace.

I've gotten DocIO to do search and replace while preserving formatting, however I need to search and replace the formatting itself (i.e. color). Is this possible?

I also need to be able to preserve instances where the first letter is capitalized. Can this be done as well?

Thanks in advance for any help you can give me.

Regards,
Ian



Bhuvaneswari P [Syncfusion]
Replied On June 16, 2008 07:16 AM UTC

Hi,

Thanks for evaluating Syncfusion products.

Currently we do have option to find the text alone and we don't have support to find the formatting. However, we can workaround this issue by enumerating all the paragraphs and check its color and then change the color. Please find the below code snippet:

[C#]


foreach (WSection sec in document.Sections)
{
foreach (WParagraph par in sec.Paragraphs)
{
if (par.ChildEntities.Count > 0)
{
//Find the text based on the color
WTextRange range; range = (par[0] as ParagraphItem) as WTextRange;

if (range.CharacterFormat.TextColor == Color.FromArgb(255,255,0,255) )
{
//Change the color
range.CharacterFormat.TextColor = Color.Brown;
}
}

}

Here is the sample for your reference:
http://websamples.syncfusion.com/samples/DocIO.Windows/P74470/main.htm

Please let me know if you have any other questions.

Best Regards,
Bhuvana



Ian Hughes
Replied On June 16, 2008 05:57 PM UTC

Hi Bhuvana,

Actually I need to change individual word and phrase color. I see that DocIO has the concept of WTextRange. Is it possible to do something like, "Find, select, set wtextrange to selection, change color property, find next?"

If possible, that would do work if it was reasonably fast, something that doesn't seem to be a problem with string search and replace.

Regards and thanks for the quick reply,
Ian

>I am evaluating DocIO for my application. The central feature for me is search and replace.

I've gotten DocIO to do search and replace while preserving formatting, however I need to search and replace the formatting itself (i.e. color). Is this possible?

I also need to be able to preserve instances where the first letter is capitalized. Can this be done as well?

Thanks in advance for any help you can give me.

Regards,
Ian





Rajkumar S [Syncfusion]
Replied On June 24, 2008 10:04 AM UTC

Hi,

Thanks for the update.

We don't have any direct option to find and replace the format alone. As a workaround we can find the text and change the format using the text range like below code snippets:

[C#]

//Find the text
TextSelection seletion = document.Find("text");
//Assign the selected text range
WTextRange[] range= seletion.GetRanges();
//Format the text range
range[0].CharacterFormat.TextColor=Color.green;


Please try the above code and let me know if this helps you.

Regards ,
Rajkumar.



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

;