Free Support Forum - aspose.com

Concatening a increment value to fixed text

Hello, how can we use aspose to concat increment value to merge field ?

for example, on the code below red texts are inserted programatically by mailmergewithregion.
And black texts are predefined in my doc (value not changes ).

My text is

Support : béton ‘neuf, brut, lisse’

Localisation : Fa?ade avant

Support : béton ‘neuf, brut, lisse’

Localisation : Fa?ade gauche

Support : pate de verre

Localisation : Pignon gauche

And my base doc look like:

Support :“nomsupport”

Localisation :"NomLocalisation"



I would like my text to looks like :

Support 1 : béton ‘neuf, brut, lisse’

Localisation : Fa?ade avant

Support 2 : béton ‘neuf, brut, lisse’

Localisation : Fa?ade gauche

Support 2bis : béton ‘neuf, brut, lisse’

Localisation : Fa?ade gauche

Support 3 : pate de verre

Localisation : Pignon gauche

Regards

In your case, the easiest way would probably be:

1. Create another merge field just where the number should be, for example MERGEFIELD MyNumber.
2. Create a field with the same name in your data source. If you mail merge from a DataTable, then you can just add a column with the appropriate name (MyNumber) to the table at any time.
3. Once your data source has a column, you can either run a loop through the rows and fill the numbers before calling mail merge or you can provide a MergeField event handler and return a number for each row from the event handler.

Another way, you could try to mark the paragraphs that require numbering as numbered list in MS Word, you can create quite sophisticated custom numbering that can look like "Support 1" and so on. During mail merge, the numbered list will grow and the numbers will increment. I'm not sure however what do you expect from 2bis etc numbers and how do you want them to work.

Thank you,

The IT management ask us this obligations :
After generating the document, forbid people to modify the word text generated (to avoid the users to save and send a document different of that generated by the database ).

It is possible for aspose.word to genarable enabled document (a document that cannot be modified ) ?

If not, It is possible to generate .pdf files by aspose.Word ?

If not , I think we’ll go to test aspose.pdf.

You can unprotect or protect documents using Aspose.Word.

To protect a document, use Document.ProtectionType or Document.Protect, Document.Unprotect.

Please note that if you protect a Word document using Aspose.Word, it will assign a random password that is not known and cannot be unprotected by user. You can unprotect any document using Aspose.Word, you can also open any protected document using Aspose.Word.

You need to use Aspose.Word and Aspose.Pdf to produce PDF files. Aspose.Word will generate a file an a special XML format that Aspose.Pdf will take on input and product a PDF file. If you buy two or more components together, you get a discount.

Thank you,
by using Document.protect, this works but user can select,copy and past protected document to a new empty document(unprotected of course ) and then apply modifications.

But is it possible to hide or enable select and copy command ?

Regards

Try Document.Protect(ProtectionType.AllowOnlyFormFields) and see what happens.

Thank you, very much this works very well.

Regards