Einughur Word plugin: Doc.ApplyFieldData with EOL?

@Björn_Eiríksson

I have a word template (actually a set of 11 related ones which have the same field names) where there is one optional item which sometimes will be there and and sometimes not…

I would like to replace that while line with a “”…

In Word itself I can do that in word itself using find and replace “fieldName^p” with “”, and that gets rid of that whole line…

But I can’t seem to find a way to do that with Document.ApplyFieldData… is it possible? If so how?

I would not want to have to duplicate the 11 templates and to delete one line in each if I don’t have to!

Thanks
-Karen

@Björn_Eiríksson
another question on the word Plugin…

Is there there a way to merge word documents?

I’m generating multiple pages from the above templates, and I would like merge the pages into a single document if possible, but I don’t see an append document method.

Thanks,
-Karen

You would probably need to send me some sort of example on that I can comment on it.

As in this data you are talking about is just something in paragraph ? or its some sort of DataField or something else ?

No no way to merge documents. And I would not expect such any time soon. Word document is not exactly linear thing in its internals. What would need to happen over time is that I would need to offer some sort of deep clone on small internal parts so you can attach them again and then run that through all the internal routines as if you had added it in normal way, so that all dependency tree is built up in correct way.

This is a paragraph with only the one field in it.
It is in a table cell that has 3 paragraphs in it.

All the paragraphs in the cell are are centered horizontally, and the contents of the cell as a whole are centered vertically:

______________________________

         @CustID<EOL>
         @2CustID<EOL>
         @ProdForm        
______________________________

If @2CustID is not needed I want to eliminate that whole paragraph so the remains lines come together … and have Word recenter the remaining content vertically

______________________________

         @CustID<EOL>
         @ProdForm        
______________________________

In the MS Word App If I do a find and replace like this:
Find: “@2CustID^p”
Replace: “”

It works as I want.

in code I tried:

Doc.ApplyFieldData("@2CustID"+EndofLine, "")

Doc.ApplyFieldData("@2CustID"+EndofLine.Windows, "")

Doc.ApplyFieldData("@2CustID^p", "")

And none of those does that. I was hoping it was possible to do that some way, but it may not be because of how Word handles things under he hood.

-Karen

Ok Thanks.

-Karen

I think I understand now (somewhat at least !).

And I guess the problem is that EOL is not character of any kind at all in Word’s internals. Its new paragraph object.

Am not quite sure how that could be dealt with for your case (at the moment at least, will need to think on it at least I suppose).

I was afraid of that…

For now I bit the bullet and created 2 sets of templates. At run time I chose which set to use depending on if @2CustID is empty or not.

Thanks,
-Karen