[OfficeUtils] Lay-out Word file

[OfficeUtils] Lay-out Word file

  
Forge Component
(17)
Published on 26 Apr by Elena Novozhilova
17 votes
Published on 26 Apr by Elena Novozhilova

Hello,

For an application we are building we are using OfficeUtils to export to a Word template.
My question is whether there are some restrictions regarding the use of a different lay-out in Word?

What is happening right now, is that we have a template with a certain lay-out and some fields have to be filled in. However, when we fill in the fields with information from the application, instead of 2 pages as the Word Document needs to be, 19 pages are created. The merge fields are filled in correctly, but there are just a lot more pages.

Any suggestions? Attached is a simplified version of the Word File with too many pages...

Regards,
Daan Brandenburg

Daan Brandenburg wrote:

Hello,

For an application we are building we are using OfficeUtils to export to a Word template.
My question is whether there are some restrictions regarding the use of a different lay-out in Word?

What is happening right now, is that we have a template with a certain lay-out and some fields have to be filled in. However, when we fill in the fields with information from the application, instead of 2 pages as the Word Document needs to be, 19 pages are created. The merge fields are filled in correctly, but there are just a lot more pages.

Any suggestions? Attached is a simplified version of the Word File with too many pages...

Regards,
Daan Brandenburg

Hello Daan,


Can you please provide me a Template of word document that you have been used that i can look at it structure inside to give any ideas.


Hello Elena,

Yes, see the attached file.

Solution

Daan,

By comparing your template with the generated file, i came to the conclusion that your template includes line breakes (result of pressing SHIFT + ENTER), and those are somehow being replaced by the component with pagebreacks on the generated file (see attached screenshot).

My advice would be to replace on the template those line breaks with regular line terminators (result of pressing ENTER) and then adjust the paragraph properties so that the spacing between lines is 0.

Solution

Thank you Elena!

It looks a lot better now.

Regards,
Daan

Hi Elena,

I want to generate the .docx file in which I can pass the binary data as source and I can download it in the form of docx file. Do you have solution for this? Thanks in advance.

Regards,

Manish Jawla

Manish Jawla wrote:

Hi Elena,

I want to generate the .docx file in which I can pass the binary data as source and I can download it in the form of docx file. Do you have solution for this? Thanks in advance.

Regards,

Manish Jawla

Hi Manish,

I'm not sure what exactly you want to achieve, but the way OfficeUtils works for word generation consists in providing a document template in binary format, and the content (text, tables, or images) to be placed on the placeholders provided on the template. At the end you will get a word document (its binary data) that consists of the template where the placeholders replaced by the desired content, and you can download the resulting file using the built in OutSystems download functionality.

Best regards,
Elena


Thanks Elena :)