Hi All,
I have a scenario wherein I need to update the color of the header of the excel file , which is getting exported on the click of a button. So, what exactly happens is that when I export an excel file, the header should be in any color and bold and other cells should be as it is. I tried implementing using Advanced excel forge components. But I got stuck in between.
@Athulya Panicker , It looks like the way to go.
Did you reproduce the same steps as the oml example?
Pay attention to 2 aspects.
1. Put the inputs related to Worksheet and Workbook correctly.
2. You can't put the aggregate result directly into "ToObject()", because it is just a List. You must have a Record List.
That is not entirely correct.
e.g.
In the Cell_WriteRange if in the Worksheet input you insert Workbook_Create.Workbook you will have an "Object reference not set to an instance of an object. " referring to OutSystems.js .
You need to insert the Worksheet_Select.Worksheet to avoid this error
Hi!
Are you rewriting the header cells using "CellWrite" action with the corresponding Color in the "Cell format" parameter?
HI,
NO,
Actually what happens in my situation is that we have to directly export all the data of a particular entity to a single excel file. So for that I need to change the color format of headings in the excel sheet. I am actually confused about which server action to be used. So can you pl help me
@Athulya Panicker , check if this is what you are looking for (see attachment).
Anyway, I strongly advise you to look at the documentation related to Advanced Excel.
Good developments...
Hello Nivaldo I used the oml file as a reference for my poc. But I had a doubt about how to convert an entity to a record list.
Hello,
1. Create a Structure, with fields that you will need
2. In the action, add a variable of Type equal to you Structure created. Change the Data Type.
write List
Than Record
PS: I would recommend you to see the guided path https://www.outsystems.com/training/paths/18/becoming-a-reactive-web-developer/
Just use a aggregate and use the resulting list.
@Maria da Graça Peixoto is right, you can use directly the aggregate.
But one issue there is that the Id's will also be exported
Hello NivaldoI am actually getting this error
Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object. at Object.s [as getException] (https://crisillimited-dev.outsystemsenterprise.com/ModelInventory/scripts/OutSystems.js?RnlDcii3Xz75iIHHERIZtA:2:10241) at c.onSuccess (https://crisillimited-dev.outsystemsenterprise.com/ModelInventory/scripts/OutSystems.js?RnlDcii3Xz75iIHHERIZtA:3:7232) at XMLHttpRequest. (https://crisillimited-dev.outsystemsenterprise.com/ModelInventory/scripts/OutSystems.js?RnlDcii3Xz75iIHHERIZtA:3:2648)
That error usually happened when using javascript.
What you have been working on is a server action, it shouldn't have nothing to do with it.
Hi Nivaldo
Thank you for your help.. It was a minute mistake from myside which caused the error. So as you said I checked and found that I hadn't select the correct worksheet. Now it is working fine but the excel file I am exporting consists of more than 100 columns. So for increasing the column width for the excel I am using column_setWidth action so inorder to increase the width of all 100+ columns together.... will it be good practise if I try implementing using a loop or do you have any other method for the same?
What I would do in that case, to keep it simple was:
1. Initially export the data to EXCEL with the normal OutSystems action to get the binary file ( note that the Advanced EXCEL works directly with the binary file )
2. Then Create the workbook and open it;
3. Add a sheet with the binary from the first step as "WorkSheet";
4. Select that sheet ;
5. Use a loop to change cell by cell the format from first row
6. Close the workbook;
And that's it, you have a binary to export.
Hope this help , best regards
Graça