Closed nmossvfp closed 1 year ago
The SetCellFormula method only sets the formula for the cell; it cannot set the format also. You would have to define a format style with the background effect that you want and then apply to every other row/cells. There is not currently any support for dynamic formatting or table formatting.
Ok. Got it. Thanks.
From: ggreen86 @.> Sent: Monday, April 03, 2023 4:09 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: nmossvfp @.>; Author @.> Subject: Re: [ggreen86/XLSX-Workbook-Class] Question about formatting for green bar (Issue #84)
The SetCellFormula method only sets the formula for the cell; it cannot set the format also. You would have to define a format style with the background effect that you want and then apply to every other row/cells. There is not currently any support for dynamic formatting or table formatting.
— Reply to this email directly, view it on GitHub https://github.com/ggreen86/XLSX-Workbook-Class/issues/84#issuecomment-1494914469 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ANUTMD2YJAHKYEDZ7AMXRF3W7MU6ZANCNFSM6AAAAAAWRXSHPM . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ANUTMD2AOVM263M2FBBUNX3W7MU6ZA5CNFSM6AAAAAAWRXSHPOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSZDKK2K.gif Message ID: @. @.> >
The sample below is taken from the DEMO mode code.
=MOD(ROW(A2),2)=1
! Add AVERAGE(), MAX(), & MIN() formula to columns ! this.SetCellFormula(lnWb, lnSh2, 16, 3, "=AVERAGE(C10:C15)") ! this.SetCellFormula(lnWb, lnSh2, 16, 4, "=MAX(D10:D15)") ! this.SetCellFormula(lnWb, lnSh2, 16, 5, "=MIN(E10:E15)")
I have been trying but so far have been unsuccesful to create a "Green Bar paper" like effect on a worksheet using code.
Using the conventional formaula [=MOD(ROW(A2),2)=1] I would want to alternate light green such as an RGB(226,239,218) fill for all odd rows of a sheet except the header row.
Can I use SetCellFormula to achieve the desired effect?
Thanks