[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 667
  • Last Modified:

Printing in color

I have a datawindow that colors rows red or yellow or white depending on the data.  On screen it works fine, but when I go to print preview, or I print it, the colors disappear.  How do I keep the colors when printing?

--Will
0
quark122
Asked:
quark122
1 Solution
 
sandeep_patelCommented:
hi,
as it is happening on the print preview mode and printing i think it's not problem with powerbuilder, but it is with your printer settings. Check the color settings in your default printer. whether color property is yes or no ? which printer u r using ?

-sandeep
0
 
quark122Author Commented:
I'm connecting (in my dev environment) to an HP4600.  The color settings are set to automatic and print in grayscale is *NOT* checked.  But when I turn on print preview, the data still goes to black & white.  The datawindow is dynamically generated (with syntaxFromSQL). The rows color setting is changed dynamically to an if condition

dw_1.Modify("Datawindow.Detail.Color='0~t If(Left(Error, 2) = " + &
      "~~'*E~~', " + invo_colors.is_errColor + &
      ", If(Left(Error, 2) = ~~'*W~~', " + invo_colors.is_warnColor + &
      ", " + invo_colors.is_infoColor + "))'")


0
 
sandeep_patelCommented:
hi,
if i m not wrong invo_colors is the structure and is_errcolor and is_infocolor are the elements of the structure.
can u check the values of 'invo_colors.is_errColor' and 'invo_colors.is_infoColor' before and after the modify? also check the same after enabling the printpreview mode but before printing. Is there any script that is changing the values of these two elements of the structure and the again the modify function?

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sandeep_patelCommented:
i missed is_warncolor. Also check the same for that
0
 
quark122Author Commented:
The colors are fine.  When I turn PP back off, it shows back up in color.    Those colors are loaded into the invo at startup and held.  I open the window with the DW, the DW displays everything just fine in color.  I then go do a Print Preview, the colors disappear in the print preview.  I then turn Print Preview back off and the colors return.
0
 
namasi_navaretnamCommented:
This may an issue with mapping printer color. Try with some absolute colors.

dw_1.Modify("Datawindow.Detail.Color='0~t If(Left(Error, 2) = " + &
     "~~'*E~~', " + RGB(255,0,0)  + &
     ", If(Left(Error, 2) = ~~'*W~~', " +  RGB(0,255,0)+ &
     ", " + RGB(0,0,255) + "))'")

I think using RGB function make a diffrence. If that did not work, try will actual numbers calculated using this formula.
65536 * Blue+ 256 * Green+ Red

If i remember it correctly, the trick is to use RGB function.

Regards-
0
 
sandeep_patelCommented:
hi,
yes u r absolutely right. I checked the same with pb6.5 and pb9.0 also.It will remove all the colors of any band. Means the color property of the band will not work. Event if call the modify function after enabling the print preview it has no effect. Not only that it is happening in Datawindow painter also. so there is no problem in your modify function. I checked the same it's working properly but in print preview, it has no effect.
But the colors that u specify for any column text or background or any other object will remain as it is in the preview also. So u can get the desire effect by putting one text box in the detail window and set the backgrouund color of that text box through modify function not the detail band. Say u have inserted new text box st_1 in your detail band, so your above modify function will be:

dw_1.Modify("st_1.background.Color='0~t If(Left(Error, 2) = " + &
     "~~'*E~~', " + invo_colors.is_errColor + &
     ", If(Left(Error, 2) = ~~'*W~~', " + invo_colors.is_warnColor + &
     ", " + invo_colors.is_infoColor + "))'")


0
 
diasroshanCommented:
hi,
if i am not mistaken ur requirement is to highlight a row with a specific color depending on ur criteria and then print with the same color....
my observation is that if the color of the detail band is changed u cannot print the color....
...but the work around is that u can dynamically change the background of all ur columns and then print the same....i have pasted a code below which might help...especially coz ur dw is created dynamically....

Long li_ColumnCount ,li_CurrentColumn

li_ColumnCount = Integer(dw_1.Describe('Datawindow.Column.Count'))

FOR li_CurrentColumn = 1 TO li_ColumnCount
dw_1.Modify('#' + Trim(String(li_CurrentColumn))+ ".Background.Mode = 0 " )      
      
   dw_1.Modify('#' + Trim(String(li_CurrentColumn))+ ".Background.Color='0~t If(Left(Error, 2) = " + &
     "~~'*E~~', " + invo_colors.is_errColor + &
     ", If(Left(Error, 2) = ~~'*W~~', " + invo_colors.is_warnColor + &
     ", " + invo_colors.is_infoColor + "))'")

Next

actually i have tried it using RGB and it works...hope it works with ur variables also....
Eg:

      dw_report.Modify('#' + Trim(String(li_CurrentColumn))+ ".Background.Color='0~t If(Left(mattype, 1) = " + &
              "~~'A~~', " + String(RGB(179,243,251))  + &
              ", If(Left(mattype, 1) = ~~'F~~', " +  String(RGB(255,255,119))+ &
              ", " + String(RGB(249,183,239)) + "))'")

let me know if u need further clarification....

Cheers...
Rosh
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now