cancel
Showing results for 
Search instead for 
Did you mean: 

Printing WD view

Former Member
0 Kudos

Hello All,

Is there a way that I could print the content of my WD view using a button inside, instead of using the print option of my browser. In order to print only the table or the form instead of printing the wholw portal.

Regards,

Orlando Covault

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Orlando,

What I had to do was build a string called "content" that was an html page with all the data from the WD page. This would be a popup page when the button view printer friendly page was pressed.

Here is the code to display the popup page:

byte[] printContent = content.getBytes();

try

{

IWDWindow win = wdThis.wdGetAPI().getComponent().getWindowManager().createExternalWindow

(WDWebResource.getWebResource(printContent, WDWebResourceType.HTML).getURL(),"Print Content",false);

//win.setWindowSize(100,100);

//win.setWindowPosition(WDWindowPos.CENTER);

win.open();

}

catch (WDURLException e)

{

wdComponentAPI.getMessageManager().reportWarning("Cannot generate printable content.");

}

-Clint

Former Member
0 Kudos

Hi Clint,

I saw something similar in , but my question is... how did you build the string called "content"

Regards,

Orlando Covault

Former Member
0 Kudos

I just created a string and added the html to it and the variables with the data. You can create as detailed as an html page as you need. Similiar to this:

String content = "<html><head><title>Printer Friendly Page</title>" +

"</head><body>Details<table border=\"1\"><th align=\"left\">Ad #</th> " +

"<th align=\"left\">name</th> <th align=\"left\">Ad#</th> " +

"<th align=\"left\">Total Price</th></tr><tr><td>" + strNum +

"</td><td>" + str + "</td><td>" +

"<th align=\"left\">word</th> <th align=\"left\">Status</th> </tr><tr><td>" + strRun + "</td>" +

"<td>" + strword + "</td><td>" + strStatus + "</td></td></tr>";

Former Member
0 Kudos

Thanks Clint,

I´ll give it a soot and the I´ll get back to you.

Regards,

Orlando Covault