Coloring cells in a table by code

Stimulsoft Reports.NET discussion
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

Coloring cells in a table by code

Post by jpascual »

I have a dataset containing fields with ARGB color format. I want to assign the dataset to a table of Stimulsoft to paint the table cell background color depending on the field.
Is it possible to paint the background color of a cell in code?

thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Coloring cells in a table by code

Post by Alex K. »

Hello,

Please see the sample report in attachment.

Thank you.
Attachments
678.SampleReport.mrt
(23.69 KiB) Downloaded 458 times
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

Coloring cells in a table by code

Post by jpascual »

Thanks for the example.
But I can not write the name of the color in the table cell.
My example is the following dataset I have two fields, name and color. So I need to write the name and color background color.
the color is different from the name and may vary for the same name.
I need to check if the color codes of the cell 3 is X, then the background color is X.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Coloring cells in a table by code

Post by Alex K. »

Hello,

Please send us a simple report with data for analisys.

Thank you.
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

Coloring cells in a table by code

Post by jpascual »

I have a report with a sample.

how I Can upload the file to the forum?
Attachments
679.PlanningSample.mrt
(78.06 KiB) Downloaded 382 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Coloring cells in a table by code

Post by Alex K. »

Hello,

After post you can click Attach and upload the file.

Thank you.
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

Coloring cells in a table by code

Post by jpascual »

ok thanks, I attacht the file.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Coloring cells in a table by code

Post by Alex K. »

Hello,

Also please, let us know how do you specify the color in the data source (string, number)?
Please show us a sample.

Thank you.
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

Coloring cells in a table by code

Post by jpascual »

the color is a string, the color is in format ARGB. For example "-1" to white color. -256 to yellow.

the color is the field "color_cuadrante" in the datasource "turnos"
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Coloring cells in a table by code

Post by Alex K. »

Hello,

You can change the previous sample

Code: Select all

public static System.Drawing.Color ARGBToColor(string ArgbColor)
{
	Color color = Color.Empty;
	color = Color.FromArgb(int.Parse(ArgbColor));
	return color;
}

Thank you.
Attachments
682.Report.xml
(557 Bytes) Downloaded 240 times
680.SampleReportARGB.mrt
(6.19 KiB) Downloaded 314 times
Post Reply