Cell Font and Colour  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Cell Font and Colour

Postby SBarnes » Wed Mar 20, 2019 10:24 am

Is there a way to set the font and the colour of the font for a particular cell in the Jiwa Grid?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Cell Font and Colour  Topic is solved

Postby Scott.Pearce » Wed Mar 20, 2019 10:28 am

Code: Select all
grdLines.ActiveSheet.Cells[Row, grdLines.ActiveSheet.GetColumnFromTag(null, "QuantityDemand").Index].BackColor = Color.Red;
grdLines.ActiveSheet.Cells[Row, grdLines.ActiveSheet.GetColumnFromTag(null, "QuantityDemand").Index].ForeColor = JiwaFinancials.Jiwa.JiwaApplication.Manager.ContrastColour(System.Drawing.Color.Red);
grdLines.ActiveSheet.Cells[Row, grdLines.ActiveSheet.GetColumnFromTag(null, "QuantityDemand").Index].Font = new System.Drawing.Font(grdLines.Font.FontFamily.Name, SalesOrderForm.grdLines.Font.Size, FontStyle.Bold);
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Cell Font and Colour

Postby SBarnes » Wed Mar 20, 2019 10:30 am

Thank Scott, is that new record for turn around time on a post :o
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Cell Font and Colour

Postby Scott.Pearce » Wed Mar 20, 2019 10:33 am

*thumbs up*
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Cell Font and Colour

Postby Mike.Sheen » Wed Mar 20, 2019 10:33 am

Note you may need to set the LockBackColor property of the cell to null before setting the BackColor will work - if that's something you want to do.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Cell Font and Colour

Postby Mike.Sheen » Wed Mar 20, 2019 10:35 am

SBarnes wrote:Thank Scott, is that new record for turn around time on a post :o


Equal record? viewtopic.php?f=26&t=955&p=3541#p3541
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Cell Font and Colour

Postby SBarnes » Mon Mar 25, 2019 1:58 pm

Aw shucks now I feel important ;)
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Cell Font and Colour

Postby SBarnes » Tue Mar 26, 2019 12:04 pm

Actually the code to make this happens looks like


Code: Select all
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyLabel").Index].Locked = false;

            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyLabel").Index].BackColor = Color.Red;
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyLabel").Index].ForeColor = Color.Red;
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyLabel").Index].Font = new System.Drawing.Font(jgPriceAndQty.Font.FontFamily.Name, jgPriceAndQty.Font.Size, FontStyle.Bold);
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyLabel").Index].Locked = true;
            
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyVal").Index].Locked = false;
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyVal").Index].BackColor = Color.Red;
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyVal").Index].ForeColor = Color.Red;
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyVal").Index].Font = new System.Drawing.Font(jgPriceAndQty.Font.FontFamily.Name, jgPriceAndQty.Font.Size, FontStyle.Bold);
            jgPriceAndQty.ActiveSheet.Cells[3, jgPriceAndQty.ActiveSheet.GetColumnFromTag(null, "QtyVal").Index].Locked = true;
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 3 guests