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. Image for the cookie policy date

word template

I am trying to use DOCIO to process the attached document template. What I need to do is find each string of the form "{ REF EMSFORM_ }". Read the entire string into memory so that I can parse out the part and replace the entire value with text.

In addition if "{ REF EMSFORM_ }" is in a table I need to know which row and column the field is foiind in.

If this is poosible, can you help with a small sample?

template_ex.zip

5 Replies

MW Melba Winshia Syncfusion Team February 26, 2007 12:33 PM UTC

Hi Bob,

Thanks for your interest in Essential DocIO.

Issue 1:
-------

Could you please clarify the following?

1) Do you want to find each string of the form "{ REF EMSFORM_ }" and replace the entire value with text. If this is the case you can use the following code snippet.

[C#]

docSource1.Replace("{ REF EMSFORM_01EMPHO }","Replace",true,true);

Here is the sample for your reference:

FindAndReplace.zip

If this is not the case could you please provide more details regarding” find each string of the form "{ REF EMSFORM_ }". Read the entire string into memory so that I can parse out the part and replace the entire value with text” this issue? This would help me in investigating this issue further.

Issue 2:
--------

Currently we do not have support to find which row and column the field is found in. Sorry for the inconvenience.

Kindly let me know if you have any other questions.

Regards,
Melba


PZ Peter Zagres February 26, 2007 08:03 PM UTC

Hi Melba, Thank you for the quick response. What I have is a product which gives a user the ability to create placeholders in a word document and then generate "form letters" using user defined fields (such as 01EMPHO, 03SCAH, etc.).

Our current software uses word api and MSWord::Fields for this purpose. I realize that DocIO does not support MSWord::Fields so have changed my MSWord::Fields to normal text (as you see in the template_ex.doc) and now I am trying to determine what I can do with DocIO.

So to answer your question, given the following paragraph from my template_ex.doc example,

Ingestion Toxicity: { REF EMSFORM_03IGATH }{ REF EMSFORM_03IGATA }

what I need to be able to do is find the regex "{ REG EMSFORM_* }", then get the contents of what was actually found, for example { REF EMSFORM_03IGATH }, and replace the entire string "{ REF EMSFORM_03IGATH }" with some other value. then go to the next one ("{ REF EMSFORM_03IGATA }" and do the same thing.

I would also like to know which paragraph (or any other DocIO container object available) the object was found in.

I am willing to do whatever it takes for me to use docio so any suggestions "outside of my box" is appreciated.

As far as tables, can I ask docio somehow, to give me all the tables in my document and then use the row /cell accessors to work the text? If so, how do I iterate through all the tables in my document?

thanks,
Bob


MW Melba Winshia Syncfusion Team February 27, 2007 12:23 PM UTC

Hi Bob,

1) It is possible to find the regex "{ REG EMSFORM_.* } by using the following code snippet.

[C#]

//Find occurance { REG EMSFORM_.*
TextRangesHolder[] matchHolders = doc.FindAll(new Regex("{ REF EMSFORM_.*", RegexOptions.None));

But it is not possible to get the contents of what was actually found. It is possible only to find the length.

2) Currently we do not have support to know which paragraph the object was found in. Sorry for the inconvenience.

3) Currently we do not have support to get the table in a document. Already we have a feature request [#953] regarding this issue.

Kindly let me know if you have any other questions.

Thanks,
Melba


PZ Peter Zagres February 27, 2007 04:12 PM UTC

I can't find feature #953, can you provide a link?


MW Melba Winshia Syncfusion Team February 28, 2007 12:04 PM UTC

Hi Bob,

You can track the status of this feature from the following link:

http://www.syncfusion.com/support/features/docio/Default.aspx?ToDo=view&questId=953

Kindly let me know if you have any other questions.

Thanks,
Melba

Loader.
Live Chat Icon For mobile
Up arrow icon