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

NullReferenceException when trying to replace more then 10 chars

Thread ID:

Created:

Updated:

Platform:

Replies:

119330 Jun 5,2015 06:03 PM UTC Jun 8,2015 06:06 AM UTC Windows Forms 2
loading
Tags: DocIO
Mark Visschers
Asked On June 5, 2015 06:03 PM UTC

When I try to replace a string in a word document larger then 9 chars + closing char I assume,
I get, on closing the document, a NullReferenceException.

When replacing a string with 8 chars with a big string it doesnt give me this exception.

Is this normal and is there a way to work around this?

strToReplace = "ReplaceReplace" + (i).ToString(); // this gives me a problem
strToReplaceWith = "HelloWorldasodifhaldfihasdlifhaldigh" + (i).ToString(); //this doesnt
wordDoc.Replace(strToReplace, strToReplaceWith, true, true);
wordDoc.Save("ReplacedSample.docx");
wordDoc.Close();

Greetings

Attachment: SyncBigReplace_8e2c9e60.rar

Mark Visschers
Replied On June 6, 2015 10:58 AM UTC

For some reason, when I started the program this morning it magically worked...
If this changes and I can create it in a reproducible way ill update this thread.

Sivasubramani V [Syncfusion]
Replied On June 8, 2015 06:06 AM UTC

Hi Mark,
Thank you for using Syncfusion products.
We will wait until we hear from you.
Please refer the below mentioned UG link for more details on find and replace technique in DocIO.
http://help.syncfusion.com/ug/asp.net%20mvc/index.html#!Documents/find.htm

http://help.syncfusion.com/ug/asp.net%20mvc/index.html#!Documents/replace.htm
Please refer the below mentioned online sample link to know more usage on find and replace technique using DocIO.
Online sample link:
http://asp.syncfusion.com/demos/web/docio/replacewithformating.aspx

Please let us know if you have any questions.
Regards
Sivasubramani.v

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

;