report AX: foreground color

Hi,

I’d like to setup a foreground color in a report but I can’t change the property.

Is it possible?

If I change the foregroundcolor in the design don’t get any effect.

Then I try by code:

for(i=1; i <this.design().sectionCount(); i++) //
{
reportSection = this.design().sectionNumber(i);
if (reportSection)
this.design().section(i).foregroundColor(#Gray);

}

but I get an initialization error at the section number 34.

Can somebody help me?

Thanks a lot!

I found this blog post on using colors in reports. Hope it helps, it looks similar to what you are trying to accomplish.

http://dynamics-ax-live.blogspot.com/2009/12/use-colors-in-report.html

Bob

Thanks for your help!

I saw this blog post: it’s very interesting and I use it for a section.

But I would like to color the entire report where I have many sections so I was looking for this problem.

Regards

In the end I added a control about the fieldtype:

int controlcount;
int counter;
int usecolor;
object reportobject;
;

controlcount=_ReportSection.controlCount();
if (Custinvoicejour.CurrencyCode != ‘PLN’)
{
usecolor=WinApi::RGB2int(200,240,255);

_ReportSection.foregroundColor(usecolor);

for(counter=1;counter<=controlcount;counter++)
{
reportobject=_ReportSection.controlNo(counter);
if (reportobject.controlType() != ReportFieldType::Box)
reportobject.backgroundColor(usecolor);
}
}

And it’s works fine.