Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Coloured rows in report
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
01182383
Message ID:
01182727
Views:
15
>>>>>I've a grid in which the user can select a color (GetColor()) and the row is then colored with that color (using DynamicBackColor). The color is also stored in a field of the cursor underlying the grid.
>>>>>I've the need to print a report (Set ReportBehavior 80) with the colors as displayed in the grid.
>>>>>
>>>>>How can I obtain the result?
>>>>>
>>>>>TIA
>>>>
>>>>You actually can, but it needs a slight hack at the .frx report file...
>>>>Create the report with a rectangle for the background you want, size it where you need, etc. Double click the control and put something unique in the "COMMENT" property of the control to refer back to. Something like "CHANGE THIS BACK COLOR". Make sure the sample rectangle shape has showing SOMETHING as a backcolor even if its defaulted to a light grey so you know the shading is properly set and not in a transparent vs opaque vs no fill mode...
>>>>
>>>>Then, in the process before actually building the report, build a new temp copy of the report something like
>>>>
>>>>
>>>>   select * from (yourReport.frx) into table c:\Temp\MyTestReportCopy.frx
>>>>   use in select( "YourReport" )  && alias of orig report.frx from SQL
>>>>   use c:\Temp\MyTestReportCopy.frx
>>>>
>>>>   */ Then, update respective columns for FILLGREEN, FILLBLUE, FILLRED
>>>>   */ with the value as from the grid control for the entry in question
>>>>   replace FillRed with (redcolor.fromgrid),;
>>>>           FillGreen with (greencolor.fromgrid),;
>>>>           FillBlue with (bluecolor.fromgrid);
>>>>       for atc( "CHANGE THIS BACK COLOR", Comment ) > 0
>>>>
>>>>    use
>>>>
>>>>    */ Then, report THIS TEMP REPORT VERSION
>>>>    report form c:\Temp\MyTestReportCopy.frx preview / or to print / etc...
>>>>
>>>>
>>>
>>>Don,
>>>
>>>How would this technique allow multiple colors? E.g. each record in a file that drives a report has a color in a field, say, nRgbColor. I don't see how this trick would achieve multi-coloring in run-time. I think this can only be done in Excel or HTML.
>>
>>The original request was based on report behavior to 80. I thought (and must have missed it) that whatever color was chosen was the back color of the grid, not just the row...
>>
>>To do the per/row in the output, the approach could be done with a few rectangles (however many he wanted to apply), and setting the comment to something like "COLOR SET 1", "COLOR SET 2", etc... then also setting the print when clause to a clause to qualify in the table... ie:
>>
>>print when GridAlias.RowColor = (whatever color he's working on)...
>>
>>ex:
>>
>>
>>   */ see code from prior to create report copy and open
>>
>>   select distinct RowColor from GridAlias into cursor C_RptColors
>>   select C_RptColors
>>   scan
>>      lcUpdateRectangle = "COLOR SET " + allt( str( recno() ))
>>      select TempReportCopy
>>
>>     replace FillRed with (redcolor.fromgrid),;
>>           FillGreen with (greencolor.fromgrid),;
>>           FillBlue with (bluecolor.fromgrid),;
>>           SupExpr with "GridAlias.RowColor = " + allt( str( C_RptColors.RowColor ))
>>       for atc( lcUpdateRectangle, Comment ) > 0
>>
>>      select C_RptColors
>>   endscan
>>
>>
>>
>>This would work for as many distinct colors as he has in the report with "COLOR SET ????" in the report definition... if there are only 3 rectangles, and he allows someone to pick 6 colors, then only 3 will be colored...
>>
>>
>>
>>The only other way I could see it done is with a report listener under VFP9. I also wrote a simple data-driven report framework that has samples of report listeners and using dynamic fonts, and dynamic coloring of fonts too. The full sample, reports, and Powerpoint is downloadable from
>>
>>www.pafox.org/pafoxwcapp/downloads/vfp9reports.zip
>
>I'm looking at the PowerPoint file now. Very interesting. Too bad I don't have VFP9 at my current job yet.
>
>Thanks again.

That may be true, but MOST of the principles can be applied even with VFP7... The only real thing you would not be able to take advantage of is the report listener portion... but then, when you upgrade to 9, you can get that too...
Previous
Reply
Map
View

Click here to load this message in the networking platform