Clarity

Expand all | Collapse all

Format Cell in Excel using Gel Script

  • 1.  Format Cell in Excel using Gel Script

    Posted Jul 13, 2018 05:20 AM

    Hi All,

     

    We are creating an Excel file to store the summary of the custom process.

    Currently we are trying to format the header row to include colors.

     

    Hence could you suggest the best solution.

     

    Thanks in Advance.

     

    Regards,

    Anusha



  • 2.  Re: Format Cell in Excel using Gel Script

    Posted Jul 13, 2018 05:26 AM

    Hi Anusha,

     

    I have seen these couple of discussions happening in CA PPM community:

     

    https://communities.ca.com/thread/99453531#99453850 

    https://communities.ca.com/thread/97680075#97680394 

     

    Check if you get any hint from these links. Hope that helps. 

     

    Cheers. 



  • 3.  Re: Format Cell in Excel using Gel Script

    Posted Jul 13, 2018 05:40 AM

    Hi Abhisek,

     

    We are able to store the data into the log file successfully, but unable to format the background color of the cell.

     

    Any suggestions to change the cell background color would be helpful.

     

    Regards,

    Anusha



  • 4.  Re: Format Cell in Excel using Gel Script

    Posted Jul 13, 2018 06:18 AM

    I have never done this. I am not sure if this can be done. Lets wait to see if someone can pitch in. 



  • 5.  Re: Format Cell in Excel using Gel Script

    Posted Jul 13, 2018 06:25 AM

    Hi Anusha, 

     

    I checked again and I don't think it is possible. 

    Example: Create a File to Write in Documents for Multiple Projects 

     

    Thanks,

    Abhisek Dhar



  • 6.  Re: Format Cell in Excel using Gel Script

    Posted Jul 13, 2018 08:00 AM

    Can you share us how you are writing to the file? using <file:writeFile> or using POI API?



  • 7.  Re: Format Cell in Excel using Gel Script

    Posted Jul 13, 2018 12:39 PM

    A sample code using file write gel tag which you can refer for developing.

     

    <file:writeFile delimiter="," embedded="false" fileName="${NIKU_HOME}\WRITE\HERE\FILE.csv">
         <!-- REMOVE FIRST SECTION IF YOU DON'T WANT HEADERS -->
         <file:line>
              <file:column value="column1_header"/>
              <file:column value="column2_header"/>
              <file:column value="column3_header"/>
              <file:column value="column4_header"/>
         </file:line>
         <core:forEach items="${results.rowsByIndex}" var="row">
              <file:line>
                   <file:column value="${row[0]}"/>
                   <file:column value="${row[1]}"/>
                   <file:column value="${row[2]}"/>
                   <file:column value="${row[3]}"/>
              </file:line>
         </core:forEach>
    </file:writeFile>


  • 8.  Re: Format Cell in Excel using Gel Script

    Posted Jul 17, 2018 12:43 AM

    Hi Prashank,

     

    We are able to write the data into the files successfully.

    But we are looking for the ways to format the cell, eg: change cell background color.

     

    Regards,

    Anusha



  • 9.  Re: Format Cell in Excel using Gel Script

    Posted Jul 17, 2018 07:26 AM

    Then you need to use Apache poi API in gel and file export will be excel.



  • 10.  Re: Format Cell in Excel using Gel Script

    Posted Jul 20, 2018 04:55 AM

    Hi Prashank

    We are able to fill the cell background in Java using teh below lin:

     style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());

     

    But we are unable to use the function in GEL Script

    We are facing issues in passing the argument of type IndexedColors

     

    Regards,

    Anusha



  • 11.  Re: Format Cell in Excel using Gel Script

    Posted Jul 20, 2018 05:23 AM

    I am assuming you are using <core:invoke> tags. Instead try below and let me know if it works.

    <core:expr value="${style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex())}"/>

    where the reference style is an instance of CellStyle Class.



  • 12.  Re: Format Cell in Excel using Gel Script

    Broadcom Employee
    Posted Jul 17, 2018 05:18 AM

    Hi Anusha,

     

    If you write CSV format file by using <file:writeFile>, it will be a plain text file.

    So, I think there is no way to add colors.

     

    Regards,

    Shoichi



  • 13.  Re: Format Cell in Excel using Gel Script

    Posted Jul 23, 2018 12:26 PM

    I have a tag lib to write excel formatted document which the XlsCellTag has the ability to set the cell's style.

     

    If you need to do this via core:invoke.  Check out Chris Wuenstel response to my Excel Tag post:

     

    Excel Tag Library 

     

    V/r,

    Gene