We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Replace a field with its value?

Hi,
A have a DATE filed in a document template. When I create and save a new document from this template, this field is properly updated.

Now, I want to replace this field with its value (e.g. the date I have created the document), so it stays fixed and do not change when all document fields get updated further (I cannot use CREATEDATE field, unfortunately).

How do I replace any field with its value? What if the value is multi-line? What if the field code contains a paragraph break?

Ivo

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I think, you can try using the following code to achieve what you need:

Code is in Java, but I think you can easily translate it to C# or VB. Please let me know in case of any issues, I will be glad to help you.

Best regards.

Thanks Alexey, this was very elegant!

A small twist is needed, though, when field code contains paragraph breaks - in this case field value goes into another paragraph.

How can I marge two successive paragraphs?

Cancel - already found it here:

<a href="https://forum.aspose.com/t/106261

I love this forum! :slight_smile:

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

It is perfect that you already found the solution. Please feel free to ask in case of any issues, I will be glad to help you.

Best regards.