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

line break and bold

Thread ID:

Created:

Updated:

Platform:

Replies:

75293 Jul 20,2008 06:24 PM UTC Jul 29,2008 10:40 AM UTC ASP.NET Web Forms (Classic) 8
loading
Tags: DocIO
peter crymble
Asked On July 20, 2008 06:24 PM UTC

Hi

I am using the find and replace method of the docIO component. Works well. However, I need to be able to make some code bold and insert a line break..

Here's the code so far (dr is a datareader):

varDetails = varDetails & "Bedroom 5:" & dr("bedroom5") & "\n\n"
....
...
document.Replace("<
>", varDetails, True, True)

Any ideas?

Thanks for your help
Peter



Bhuvaneswari P [Syncfusion]
Replied On July 21, 2008 01:31 PM UTC

Hi Peter,

Thank you for your interest in Syncfusion products.
Yes, it is possible to find and replace the text with for formatted text. We can find the string and replace the text with textbodypart. Please refer the below code snippet to do so:

[C#]

TextBodyPart part = new TextBodyPart(doc);
IWParagraph par = new WParagraph(doc);
//Bedroom 5:" & dr("bedroom5") & "\n\n"
par.AppendText(" Syncfusion").CharacterFormat.Bold =true;
par.AppendText("Syncfusion\n\n");
part.BodyItems.Add(par);
//Replace Text with image and text.
doc.Replace("INSERT PARAGRAPH ITEMS", part, false, true);


Please take a look into the sample bowser sample from the below location:
\\Syncfusion\EssentialStudio\x.x.x.x\Windows\DocIO.Windows\Samples\2.0\Editing\ReplaceWithDocumentElements\CS

Please let me know if you have any other questions.

Best Regards,
Bhuvana


peter crymble
Replied On July 21, 2008 04:49 PM UTC

thanks - having problems - would you mind providing that snippet in VB?

Thanks


peter crymble
Replied On July 21, 2008 05:24 PM UTC

Sorry - got that work. Thanks.

However, the \n\n still appears in the document i.e. it does not take a new line...

Thanks


Bhuvaneswari P [Syncfusion]
Replied On July 22, 2008 12:04 PM UTC

Hi Peter,

Thanks for the update.

I am afraid that I am not able to reproduce the issue. In our end its working fine.

Please provide the below information to reproduce the issue:
1. Office version
2. Essential Studio version
3. OS

You can you the line break also to insert new line. Please refer the below code:

par.AppendText(" Syncfusion").CharacterFormat.Bold = True
par.AppendText("Syncfusion")
par.AppendBreak(BreakType.LineBreak)
par.AppendBreak(BreakType.LineBreak)
par.AppendText(" After line break").CharacterFormat.Bold = True
part.BodyItems.Add(par)
'Replace Text with image and text.
doc.Replace("INSERT PARAGRAPH ITEMS", part, False, True)


Please try this and let us know if this helps you.

Best Regards,
Bhuvana


peter crymble
Replied On July 24, 2008 10:36 AM UTC

Hi

Thanks - the appendbreak code works great. One last question then I'm done!!!

I add a paragraph style. It adds to the word doc but doesnt apply it. Any ideas?

Dim style As IWParagraphStyle = CType(document.AddParagraphStyle("Normal"), IWParagraphStyle)
style = CType(document.AddParagraphStyle("move_detail"), IWParagraphStyle)
style.CharacterFormat.Bold = False
style.CharacterFormat.FontName = "Arial"
style.CharacterFormat.FontSize = 10


par.ApplyStyle(style.Name)
par.AppendText("Lounge:").CharacterFormat.Bold = True
par.AppendText(dr("lounge"))
par.AppendBreak(BreakType.LineBreak)
etc. etc....


Bhuvaneswari P [Syncfusion]
Replied On July 25, 2008 12:39 PM UTC

Hi Crymble,

Thanks for the update.

I am afraid that I am not able to reproduce the issue. I can able to apply the styles to the paragraphs without any issues.

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

Please have a look into the sample and send us the modify the sample to reproduce the issue, this would be very help full to reproduce the issue in our end and investigate more on this issue. Please send us your system configuration also.

Best Regards,
Bhuvana


peter crymble
Replied On July 29, 2008 10:31 AM UTC

Hi
Fixed! Just for anyone else having this issue. The text I was replacing had the word 'normal' style applied to it. I just took the style out of the template, and it works.

thanks
P

>Hi Crymble,

Thanks for the update.

I am afraid that I am not able to reproduce the issue. I can able to apply the styles to the paragraphs without any issues.

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

Please have a look into the sample and send us the modify the sample to reproduce the issue, this would be very help full to reproduce the issue in our end and investigate more on this issue. Please send us your system configuration also.

Best Regards,
Bhuvana




Bhuvaneswari P [Syncfusion]
Replied On July 29, 2008 10:40 AM UTC

Hi Peter,

Thanks for the update.

Glad to know that your issue has been fixed.

Please let me know if you have any questions.

Best Regards,
Bhuvana


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

;