Replace string- Special characters

Hey folks -

The links above go 404. Would you please provide an updated URL? Also, would that URL contain the valid replacement chars to use? We’re demo-ing this component, and it’s very frustrating trying to figure which char is the offender and what I can use in it’s place.

Hi
Joel,

Thanks for your inquiry. You can find the updated link below:
https://docs.aspose.com/words/net/find-and-replace/

Moreover, an exception is thrown if a captured or replacement string contain one or more special characters: paragraph break, cell break, section break, field start, field separator, field end, inline picture, drawing object, footnote.

Best Regards,

I know about the exception, I’ve been searching the forums because I’m experiencing it.

I’m looking for the links that show what are the ‘bad’ chars and what are the ‘good’ char replacements so as to avoid said exception.

Hi
Joel,

Thanks for your inquiry. Here is a list of special characters i.e. when used inside captured or replacement string, an exception is thrown:

\r
\a
\f
(char)19
(char)20
(char)21

Could you please clarify why do you need to replace these special characters? We will try to suggest some way to achieve what you are looking for.

Moreover, in future we will consider improving Replace method in order to support special characters. This thread has been linked to the appropriate issue (i.e. WORDSNET-1252) in our bug tracking system and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best Regards,

Hi,
We have encountered the same issue when updating an older system which used word automation.
An example of why this is required is when we need to optionally turn on or off certain sections in a document template - which may contain formatting such as a newline character.
a simple example from our system is:

<*IF[Invoice\GST][Yes]
§
In our opinion it appears there is GST.
*> <*IF[Invoice\GST][No]
§
In our opinion it appears there is no GST.
*> 

Our system looks for any tags <* *> and in this case evaluates whether it should show this piece of the document (based on evaluating the fields listed) or remove it, in either case it is replacing a section which has line breaks.
We could look in to changing the tag structure and looping through the document’s content differently to try to get it to work but this could require editing around 100 template documents and a lot of additional testing.
When is a build with this issue fix is likely?

Hi Scott,

Thanks for your inquiry and sorry for the delayed response.

I have verified the status of this issue from our issue tracking system and regret to share that this issue is still unresolved. Currently it is pending for analysis and is in the queue. Also, at the moment I can’t provide you the ETA for this issue. However, we will inform you via this forum thread as soon as it’s resolved.

Sorry for the inconvenience.

Best Regards,

Hi Awais,
Has there been any update on this fix? This is the last item we need to address in a build and this issue is blocking us.
We need to have some indiciation of when the fix will be ready.

Hi
Scott,

Thanks for your inquiry. Unfortunately, there is no further news on this. I have asked for the ETA of this issue from our development team. As soon as, any information is shared by them, I will be more then happy to share that with you.

Best Regards,

Hi Awais,
Has there been any further update as it has been over 3 months?
We renewed our Aspose OEM licence in anticipation of being able to roll out this build sometime in the near future and now this fix is the last thing holding us up.
An ETA would be appreciated.

Hi Scott,

Thank you for your continued support of Aspose.Words. At the moment, this feature has been postponed till a later date and there is no ETA available. However, I have passed your concern to our development team. As soon as any information is shared by them, I will be glad to share that with you. We apologize for your inconvenience.

Best Regards,

Hello,

Can you have someone from your development team contact me about this? Aspose.words is marketed as a viable replacement for word automation however as discussed it’s replace function seems to be quite limited and does not provide the same flexibility as using word automation. This bug is still holding up our migration and I’m starting to wonder if this will be fixed before our maintenance is up and if not we have basically just wasted a years licence.

Hi Scott,

Thanks for your request. We’re in communication with our development team. As soon as any information on the ETA is shared by them, I will be glad to share that with you. We apologise for any inconvenience.

Best Regards,

Hi Scott,

Thanks for your patience. I have received response from our development team and yes this feature is definitely on their radar. They will provide a more solid estimate early next month and I will get back to you as soon as I have information on the ETA.

Best Regards,

Hello,

Just to clarify this is an issue fix and not a new feature which is being requested.

It is an issue as Aspose words claims to be a better alternative / replacement to word automation (see here) and word automation includes this functionality and we subsequently have not been able to update our system which is currently using word automation to use Aspose words.

I don’t suppose there has been any updates on this?

Hi Scott,

Thanks for your inquiry. I am afraid, this issue is still unresolved. Could you please attach your sample document containing the tags <* *> and your desired/expected output document here for testing (please create the target/expected document using Microsoft Word)? May be there exists some more appropriate way that I can suggest you in order to achieve what you need. I will investigate the issue on my side and provide you more information.

Best regards,

Hi awais,

I explained this much earlier in this thread just over a year ago.

Essentially this is about creating document templates and defining configurable sections which need to be swapped out / removed based on the properties of the given user/object.

The problem is that the replace function implemented in the aspose library throws an aspose exception if either the source or replace string contains a special character, the word automation function aspose is replacing on the other hand lets you do this.

Not throwing an exception and replacing the text would help me achieve what I need.

I’ve attached a dummy template which contains an example of this and what would be expected.

Cheers,

Hi Scott,

Thanks for your inquiry. We will develop a work around code for your specific case and get back to you soon (WORDSNET-8530). We apologize for your inconvenience.

Best regards,

Hi Scott,

Thanks for waiting. I have created a project for you which works around this limitation of the find and replace engine. The example demonstrates how to remove a block of text using find and replace even when the text spans across different paragraphs. Please find it attached. Note you will need to create the logic to check the text and answers to decide if the text should be removed.

A better method to achieve this would be to use bookmarks instead of text delimiters, this way you could find the bookmark by name and remove all content in between the bookmark start and bookmark end regardless of how many paragraphs it spans (just by calling Bookmark.Text = string.Empty).

Cheers,

The issues you have found earlier (filed as WORDSNET-1252) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(6)

A post was split to a new topic: Special characters in replace string