[OfficeUtils] Excel - Styles, Text Wrap in Cells and Page Breaks

[OfficeUtils] Excel - Styles, Text Wrap in Cells and Page Breaks

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

Hi, 

This component seems very well done and very useful, congrats, first of all!! :)

Now the problem I'm facing. 

I have the follow requirements: 

  1. I Want the two first columns always in bold; 
  2. One of the columns must wrap the text because it can be quite long text in there.
  3. When Exporting a table to excel make the Print layout all to one page; 


1. Styles

 For the template document as far as I understood the only way to format the cells is via Conditional Formatting them, is this right?

Because when I just make format it to be bold, but with no data at all in the template, the data will be go out with no format at all; 

Them I just formatted them through the Conditional formatting and them it works Perfectly. 


2. Wrap text

Now wrapping text, can't be done via the Condition Formatting trick. 

The only way I found to make this work is by turning the Wrap Text option on, and the place a caracter, like a space, in each of those cells I want to wrap. When there is content in the Template, the wrap text alignment seems to work.  


3. Page breaks
The first one is pretty easy and Can be done in the template; 

But now my issue is that if I have to place a char, like a blank space, in each cells for wrapping the text, when the users try to print the excel it will try to fit in One page all the cells I Pre-Filled with a blank space in the template. 

This means I have to estimate how many rows there will be in the excel in order to fulfill all the requirements and I have no way to make sure that this will work all times. 


Do someone know how to make this formatting working without being via Conditional Formatting when filling up a table?


Hi Jose, 

On the template Excel you can select all column and apply styles to it directly without filling in any data. For the styles to be applied on generated file there is a flag "UseTemplateCellsDataFormat" on action "Excel_Export_SetTable".


If something is not working can you provide yours template that i can check it or example of espace with it.

Elena Novozhilova wrote:

Hi Jose, 

On the template Excel you can select all column and apply styles to it directly without filling in any data. For the styles to be applied on generated file there is a flag "UseTemplateCellsDataFormat" on action "Excel_Export_SetTable".


If something is not working can you provide yours template that i can check it or example of espace with it.

Hi Elena, 


Just realized now that using the sample in the component without changing too much things it works. 

But here is a sample espace, where I just changed the template text to be Green and Bold on the second column. 

Also changed the preparation to duplicate the users a couple of time so it produces a lot o rows. 

You can also try the sample I made here: https://jqueiros.outsystemscloud.com/OfficeUtilsSample/Home.aspx

It might be my version of the office that is messing this up? 


Thanks,

José Queirós

Solution

Hi Jose, 

I've just published a new version of OfficeUtils that takes in consideration the styles defined on the column level when generating cells. Hope this will be helpful.


Best regards,

Elena.

Solution

Elena Novozhilova wrote:

Hi Jose, 

I've just published a new version of OfficeUtils that takes in consideration the styles defined on the column level when generating cells. Hope this will be helpful.


Best regards,

Elena.


Hi Elena, 

Thanks a lot, that works perfectly now. Good work!