Solved

Printing in color

Posted on 2004-03-22
8
651 Views
Last Modified: 2013-12-26
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
Comment
Question by:quark122
8 Comments
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 10649692
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
 

Author Comment

by:quark122
ID: 10649827
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
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 10650049
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
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 10650065
i missed is_warncolor. Also check the same for that
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:quark122
ID: 10650077
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
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 10653660
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
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 10655331
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
 
LVL 18

Accepted Solution

by:
diasroshan earned 200 total points
ID: 10656648
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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now