Free Support Forum - aspose.com

How to get mergefield Value?

In the word document, it looks like this.

{MERGEFIELD Photo1 \* MERGEFORMAT}

I have written in the field the value: «Photo1.bmp»

How can I get the value from this field ?

Solution ????

I have found the e.FieldValue in the HandleMergeField, but how to raise this handle without first writing the value.

private void HandleMergeField(object sender, MergeFieldEventArgs e)

{

e.FieldValue

I would recommend you change the approach and avoid trying to get a value from a merge field. The problem is that merge fields, when they are in the document, are not supposed to have any meaningfull values. If you put some value into a merge field and then fields get updated (say Ctrl + A, F9) then all merge fields values will be reset to <>.

If you tell us more what you are trying to achieve, we might be able to recommend an approach that is more suitable.

Thanks a lot for fast respose and thanks for fully understanding what I want to do. Great.

In this case I do not now why microsoft allows to enter meanigfull or meanigless (is this a english word ?) values in merge field.

What I want to do ?

I am not so sure about the workflow. Is it a one Step or two Steps Work ?

What I want to do ?

I must fill in the values

[-V205/M205] [-V520/M520]

[P205]

[V210/M210], [V215/M215], [V245/M245], [V260/M260], [V298/M298], [V318/M318], [V405/M405], [V420/M420], [V435/M435], [V470/M470], [V501/M500], [V505/M505], [V510/M510], [V500],

from a database.

The other things are already on the document.

Kapitel:
4.1.2.1
Punkt: 1

1.

Der Zuluft- [-V205/M205] sowie der Fortluftventilator [-V520/M520] sind mit je einem Druckdifferenzwächter [P205] resp. [P520] überwacht (Riemenüberwachung). Beim Ansprechen einer dieser Wächter wird die ganze Anlage abgeschaltet. Die Ventilatoren [-V205/M205] und [-V520/M520] und die Regeleinrichtung werden sofort ausser Betrieb gesetzt. Die Aussenluft-[V200/M200], Fortluft- [V515/M515] und Brandschutzklappen [V210/M210], [V215/M215], [V245/M245], [V260/M260], [V298/M298], [V318/M318], [V405/M405], [V420/M420], [V435/M435], [V470/M470], [V501/M500], [V505/M505], [V510/M510], sowie das elektro-pneumatische Ventil [V500], welches die Druckluftversorgung zu den pneumatischen Volumenstromreglern [R235], [R417], [R440], [R460] unterbricht, werden nach 2 Minuten geschlossen. Die elektrisch angetriebenen Volumenstromregler [R210/M211], [R217/M218], [R220/M221], [R225/M226], [R230/M231], [R240/M241], [R245/M246], [R252/M251], [R255/M256], [R260/M261], [R265/M266], [R270/M271], [R275/M276], [R280/M281], [R285/M286], [R290/M291], [R295/M296], [R300/M301], [R305/M306], [R310/M311], [R320/M321], [R400/M401], [R410/M411], [R415/M415], [R430/M431], [R435/M436], [R445/M446], [R450/M451], [R455/M456], [R465/M466], [R470/M471], [R485/M486], [R490/M491], [R495/M496], [R500/M501], [R505/M506] bleiben offen.

So, I want that the word writer give me a information what he want to fill in. For example:

he want [-V205/M205] [-V520/M520] , so I must get a parameter to now what he want.

Simple ?

Ok, scenario 1:

Working with bookmarks. He writes v205_v520 , I give back [-V205/M205] [-V520/M520]

I do not know if it's the right way for my problem. But It is the way to get a parameter from the user and put back values.

Or is book mark not the right way for paramters. Which concept is for this ?

The problem: The workwriter can give me bookmarks, which I can not understand.

To solve this problem with wrong values, it is the best to do the job with two steps.

Ok, scenario 2: (2 Steps)

I get from the writer a document with bookmark bookmark bookmark...... always bookmark.

I read this document with apose dan but on each book mark a combobox with filled in values.

In a second step, the writer select in each combobox on the document the values, the needed values and I read

this values back and replace the comboboxes with the selected values.

Kapitel:
4.1.2.1
Punkt: 1

1.

Der Zuluft- bookmark sowie der Fortluftventilator bookmark sind mit je einem Druckdifferenzwächter bookmark resp. bookmark überwacht (Riemenüberwachung). Beim Ansprechen einer dieser Wächter wird die ganze Anlage abgeschaltet. Die Ventilatoren bookmark und bookmark und die Regeleinrichtung werden sofort ausser Betrieb gesetzt. Die Aussenluft-[V200/M200], Fortluft- [V515/M515] und Brandschutzklappen [V210/M210], [V215/M215], [V245/M245], [V260/M260], [V298/M298], [V318/M318], [V405/M405], [V420/M420], [V435/M435], [V470/M470], [V501/M500], [V505/M505], [V510/M510], sowie das elektro-pneumatische Ventil [V500], welches die Druckluftversorgung zu den pneumatischen Volumenstromreglern [R235], [R417], [R440], [R460] unterbricht, werden nach 2 Minuten geschlossen. Die elektrisch angetriebenen Volumenstromregler [R210/M211], [R217/M218], [R220/M221], [R225/M226], [R230/M231], [R240/M241], [R245/M246], [R252/M251], [R255/M256], [R260/M261], [R265/M266], [R270/M271], [R275/M276], [R280/M281], [R285/M286], [R290/M291], [R295/M296], [R300/M301], [R305/M306], [R310/M311], [R320/M321], [R400/M401], [R410/M411], [R415/M415], [R430/M431], [R435/M436], [R445/M446], [R450/M451], [R455/M456], [R465/M466], [R470/M471], [R485/M486], [R490/M491], [R495/M496], [R500/M501], [R505/M506] bleiben offen

I know you don't know from where my information comes and what the user know and what the program know. Doesn't matter

at the moment.

Important is only, is it possible to do something like scenario 2, when yes, how can

1. find all bookmarks, replace bookmark with filled comboboxes

2. find all comboboxes, replace all comboboxes with the by word writer selected values and get so the final document.

When no:

I mean scenario 2 can also be:

First step: I give the user a list of bookmarks in the document.

Than: the user insert this bookmarks, and than I replace this bookmarks with the values in a second step.

Question:

1. Where I should put this bookmarks in the document ?

Now don't be confused.

The simple idea is to get the best way to places this values in this text.

Another scenario would be:

Making a GUI:

On this GUI:

The word writer writes the text in, the whole word in a GUI ???

Additonal he has a listview, which looks like this.

[-V205/M205]

[-V520/M520]

[P205]

[P520]

[-V205/M205]

So he can drag an drop but the values from the list in the word.

Another scenario:

I give a list to the user and the user make copy paste on the word.

Now don't be confused.

The simple idea is to get the best way to places this values in this text.

Kapitel:
4.1.2.1
Punkt: 1

1.

Der Zuluft- [-V205/M205] sowie der Fortluftventilator [-V520/M520] sind mit je einem Druckdifferenzwächter [P205] resp. [P520] überwacht (Riemenüberwachung). Beim Ansprechen einer dieser Wächter wird die ganze Anlage abgeschaltet. Die Ventilatoren [-V205/M205] und [-V520/M520] und die Regeleinrichtung werden sofort ausser Betrieb gesetzt. Die Aussenluft-[V200/M200], Fortluft- [V515/M515] und Brandschutzklappen [V210/M210], [V215/M215], [V245/M245], [V260/M260], [V298/M298], [V318/M318], [V405/M405], [V420/M420], [V435/M435], [V470/M470], [V501/M500], [V505/M505], [V510/M510], sowie das elektro-pneumatische Ventil [V500], welches die Druckluftversorgung zu den pneumatischen Volumenstromreglern [R235], [R417], [R440], [R460] unterbricht, werden nach 2 Minuten geschlossen. Die elektrisch angetriebenen Volumenstromregler [R210/M211], [R217/M218], [R220/M221], [R225/M226], [R230/M231], [R240/M241], [R245/M246], [R252/M251], [R255/M256], [R260/M261], [R265/M266], [R270/M271], [R275/M276], [R280/M281], [R285/M286], [R290/M291], [R295/M296], [R300/M301], [R305/M306], [R310/M311], [R320/M321], [R400/M401], [R410/M411], [R415/M415], [R430/M431], [R435/M436], [R445/M446], [R450/M451], [R455/M456], [R465/M466], [R470/M471], [R485/M486], [R490/M491], [R495/M496], [R500/M501], [R505/M506] bleiben offen.

My problem at this time: I don't know the disadvantages and workload in apose when I thak the approch with

comoboxes or other technics. Prehaps all my ideas are the wrong way.

Regards

Hello Karl,

Thank you for a comprehensive description of your task. Please give me 1 day to think it over. I will also research the problem stated in your other post

InsertComboBox limitation to 25 items, workaround in aspose ?

If I got you right, you want to have a two stage process. First you prepare a document where you randomly place the tags like [R210/M211]. And then you'd like to process the text substituting the tags with an actual data. To edit a document, inserting tags from predefined list, you should use MS Word, because Aspose.Word does not provide an editor GUI. For processsing the prepared document you can use either Aspose.Word or MS Word - depends on your workflow, throughput requirements, local or server-side processing etc.