Print List

Coordinator
Feb 23, 2007 at 7:31 PM
Mar 8, 2007 at 5:30 AM
Hi Scot,

I have downloaded and installed print list and it seems to work great. However, I was wondering if it would be possible for you to have the feature print the contents of the current view rather than the list. I believe that you should be able to interogate the ctx javascript object to retrieve the view id. The feature currently defaults to printing the lists default view even though you may be viewing a different view.

ie ctx.view = "{93EA4C00-F9DE-4C32-9D9C-333489B5C856}

Kind Regards,
Tarek

PS - I have purchased your book and so far it look pretty cool. So congratulations!!!
Coordinator
Mar 9, 2007 at 2:31 AM
Thanks, Tarek. I'll look at this for the next release.
Coordinator
Mar 21, 2007 at 2:51 AM
Release 2.0 is posted with support for printing any list view.
Apr 18, 2007 at 12:12 PM
Cool feature!
Though, wouldn't it be nice to have it print the current view of the list, in effect removing the view selection on the print page.
The purpose of a printer friendly page is to have in fact a printer friendly page. This, in my world at least, translates into not printing images, buttons and dropdownlists.

I've tried to modify the code, but there is unfortunately, no easy way of obtaning the current view of a list, and it cant be passed as a parameter (as ListId can).

Next, I tried to use httpreferrer, as each view has its own .aspx page, that has the same name as the view does. My idea here was to juggle the httpreferrer string and get the view name and access it in list.Views"name_of_the_view" in the SPQuery.
But alas, the http_referrer is null, my guess is that the menu (in which the Print list action resides) uses awindow.location() type script, but I'm not sure.

Regards
twh / Kode2.com
Coordinator
Apr 25, 2007 at 2:28 AM
Now you know why it works the way that it does :-)
Apr 25, 2007 at 7:34 AM
Ah, so no workaround?

Regards
twh / Kode2.com
Apr 26, 2007 at 5:51 PM
Hello,

I have successfully deployed the Print List WSP solution. In Central Administration, it states that it is globally deployed.

I still cannot access the Print List option from any of my WSS 2007 applications. There is no option to activate the feature in any of the applications (does not show in site features list), and there is no option in any of my lists to Print List.

Is there something I am missing? I would love to get this feature running.

Thank you for all of your assistance.
Coordinator
Apr 28, 2007 at 10:57 PM
try activating the feature with STSADM and see if that works
May 7, 2007 at 6:18 PM
Downloaded and installed the new release 2.0 but the comments that "thaoula" mentioned on March 7th still did not get addressed.. I think.

The feature is not working when printing from a view that is not within the listing itself. For example: If you are in http://website/default.asp and try to print a listing it will not work. However if you are in http://website/listing/default.asp and try to print then it will work. The listing guid is not passed to the printlist.aspx page, instead redirects as: PrintList.aspx?list={ListId}

Thanks.
Jun 9, 2007 at 12:23 AM
I am having the same problem as jdbulldog, i also tried to install WindowsLinks.wsp and he same thing happens
Jun 15, 2007 at 5:34 PM
I am also having the same problem as jdbulldog and simon. The wsp shows as deployed successfully and global but does not appear in the features list. This is on SBS2003 (non-r2) with wss3 installed.
Coordinator
Jun 21, 2007 at 2:25 PM
Are you looking in the Site Collection features list? It's not on the site features - it's on site collection features.
Jun 26, 2007 at 4:40 PM
Ahhh... Sight Collection features. Works great!
Jul 16, 2007 at 7:06 PM
Another nice feature would be the ability to filter the data in the printer friendly view so that only the list data that matches the filter would be printed. I could not find a way to do this in the current version.
Aug 25, 2007 at 10:34 PM
Hi Scot -
I added (addsolution) the PrintList feature - no problem. When in Central Admin I get an error when I try to deploy the solution so it does not complete. We have 2 FE web servers and 1 index server. It tries to install on the index server which fails (as it should) - but as a result - the feature is not deployed.
Can I deloy this by using just the stsadm commands? Will that work? (deploysolution?)
thanks
Coordinator
Sep 12, 2007 at 1:19 PM
You can try STSADM, but you may be having issues with the Windows SharePoint Services Timer Service. Try restarting the service and then deploy.
Sep 13, 2007 at 9:24 PM
Edited Sep 13, 2007 at 9:45 PM
I starting thinking about ways to have a printable version of the current view...I think this is a way around the limitation of the querystring:

<UrlAction Url="javascript:function printableView(){var site='{SiteUrl}';var list='{ListId}';var view=ctx.view;window.location.href=site + '/_layouts/PrintList/PrintList.aspx?list=' + list + '&amp;view=' + view.replace('{','').replace('}','');};printableView();"/>

Then in PrintList.aspx, you have the GUID of the view to use. I haven't tried this out (yet), but I can't see why it wouldn't work. Scott, do you think you could add this?

ps: the wiki markup kinda scrambled my javascript, so beware! ;^)

Regards,
Mike Sharp



twhKode2 wrote:
Ah, so no workaround?

Regards
twh / Kode2.com

Sep 13, 2007 at 11:10 PM
Edited Sep 13, 2007 at 11:39 PM
It works! Change the UrlAction element's Url attribute like:

<UrlAction Url="javascript:alert('current view is:' + ctx.view);function printableView(){var site='{SiteUrl}';var list='{ListId}';var view=ctx.view;window.location.href=site+'/_layouts/PrintList/PrintList.aspx?list='+list+'&amp;view='+view;};alert('now redirecting');printableView();"/>

And modify the SPQuery like:

//Display the view identified by the viewId
SPQuery query = new SPQuery(list.Viewsnew Guid(viewId));

And you get the current view as the printer-friendly view.

Regards,
Mike Sharp

Coordinator
Sep 19, 2007 at 9:05 PM
Great job! Thanks, guys.
Sep 21, 2007 at 7:04 PM
I have a quick question -

When we have sub folders in the list, I am not able to select the folder so as to drill into the contents of the folder to print.

Does anyone have a work-around for this issue? Is there a suggestion for code modification so that when I click on a folder
in the rendered list, it shows me the contents of that folder for print? (Current behavior is the following: when I click on
a folder, the "{listId}" querystring is not retained, and if I add it manually, the page is not a "Postback" anymore so I get
the "Select View" option all over again")

Thanks for any answers.
Rajiv
Sep 24, 2007 at 2:27 AM
I'm surprised the ctx object doesn't have a rootFolder property!

The only way I can think of offhand would be to extract the rootFolder the querystring, and add it to the url attribute like I did the others.

I'm out of town and away from my dev environment, but I'll set a reminder to try it when I get back later this week.

Regards,
Mike Sharp



RChakravarti wrote:
I have a quick question -

When we have sub folders in the list, I am not able to select the folder so as to drill into the contents of the folder to print.


Thanks for any answers.
Rajiv

Sep 25, 2007 at 3:49 PM
I'm having the same issue as samsam. This is the first customization to features I've done, so I'm not well versed in how this all works. Seems that if the listid is on the page, there must be a way to grab it. Print List definitely doesn't work when the list is in a web part. It works as samsam describes, which errors out.


samsam wrote:
Downloaded and installed the new release 2.0 but the comments that "thaoula" mentioned on March 7th still did not get addressed.. I think.

The feature is not working when printing from a view that is not within the listing itself. For example: If you are in http://website/default.asp and try to print a listing it will not work. However if you are in http://website/listing/default.asp and try to print then it will work. The listing guid is not passed to the printlist.aspx page, instead redirects as: PrintList.aspx?list={ListId}

Thanks.


Sep 25, 2007 at 10:58 PM
Edited Sep 25, 2007 at 11:03 PM
Mike,

Thanks for the reply.. We have done as you suggest by tagging on the RootFolder to the QueryString in the Url, and then we
try the following:
rootFolder = Request.QueryString["rootfolder"];
query.Folder = list2.RootFolder.SubFolders[rootFolder];

However, the list2.RenderAsHtml(query) method still does not render the list in the FOLDER, the page maintains the "html view"
of the Top level folder.

At this time, we are at a loss.. so any help you can provide would be great. We hope you can look into this at your earliest convenience.
Thanks,
Rajiv

PS: Has ANYONE got the correct rendering working for a list with subfolders and the HTML rendering correctly? We are surprised
no one else seems to be complaining about this?
-- Quote:
I'm out of town and away from my dev environment, but I'll set a reminder to try it when I get back later this week.

Regards,
Mike Sharp
-- End Quote


Oct 25, 2007 at 12:33 AM
Hi and thanks for Print List, it's a HUGE help!

I would ask if this is feasible to include into the project:

We plan on generating reports on the list data through Views. Some of these reports are quite long horizontally, and it would be nice to be able to force the default page setup to Landscape.

I was able to do it with some code in the original Print List iteration by adding the following:

_"<style type="text/css" media="print">
page {
size:landscape;
}
</style>
<script type="text/javascript">
var shell;
function winPrint() {
try {
SetPaperSize();
} catch (e) {
SetPaperSize_fail();
}
}
function SetPaperSize() {
try {
shell = new ActiveXObject("WScript.Shell");
shell.sendKeys("^p");
setTimeout("shell.sendKeys('%R')",1000);
setTimeout("shell.sendKeys('%L')",1100);
setTimeout("shell.sendKeys('{ENTER}')",1200);
setTimeout("shell.sendKeys('{ENTER}')",1300);
} catch(e) {
SetPaperSize_fail();
}
}
function SetPaperSize_fail() {
if(navigator.product!='Gecko'||navigator.appVersion<5)
// don't show the alert for browsers that can understand the style rules.
// yes, it's a very ugly hack, but it works.
alert('Please verify that your print settings have a Landscape orientation.');
window.print();
}

</script>"_

I am not that familiar with the coding in this new version so I am not sure how to approach adding the functionality.

Any chance this could make it in the next release, or suggestions on how I can get some code in to force landscape (even forcing the Page Setup dialog, with a popup explaining that the user should set landscape would be helpful). Thanks again!
Coordinator
Nov 1, 2007 at 1:10 PM
Hi Everyone,

I spent some time examining the issue of printing inside of the folders. It looks to me like the feature will need to be rearchitected pretty significantly to get this capability. For now, I'll take the cheesy "known issue" route, but I hope to be able to look at this in more detail.

Scot
Jan 12, 2008 at 6:48 PM
Do you have ideas to fix this problem(printing inside of the folders)?
Coordinator
Jan 13, 2008 at 4:37 PM
There's no real answer for the problem under the current approach. The HTML that comes from the API will support folders, but there seems to be no simple way to indicate the folder you want under the current design. I've tried several things, but for various reasons, each approach was unsuccessful. I think a whole new approach would be required. This would involve generating the HTML yourself and tracking the folder.

Scot
Mar 6, 2008 at 7:33 PM
Is there anyway to force this print list feature to a new window? My users are getting lost! They keep calling me asking how to I go back to my Personnel list???!?!? Anything would be helpful at this point!
Coordinator
Mar 6, 2008 at 10:40 PM
You could probably do it by modifying the Javascript in the elements.xml to open a new window.
Mar 7, 2008 at 2:30 PM
Edited Mar 7, 2008 at 2:58 PM


ScotHillier wrote:
You could probably do it by modifying the Javascript in the elements.xml to open a new window.


Thats what I tried initially. The code is acutally already trying to do a window.open, but through a variable ref. When I change it around, it opens in a new window, but leaves the old window with a weird code. It says [Object] on it. Then the window that popped up has even stranger code. After receiving the error I changed it back to normal. I will go back to my the code to get the error again. Basically it acted like it was a new page and a new site. It wouldn't pull the content from the list.
-Mike
Mar 7, 2008 at 2:52 PM

Sorry For the double post. The error on the popped up window is

Value cannot be null. Parameter name: g

and the error on the page that it left says [object]
Coordinator
Mar 7, 2008 at 7:01 PM
Usually, it says Object because you did not save the return value of window.open to a variable. Add a "var myWindow = window.open" kind of thing.
Mar 18, 2008 at 12:49 AM
This is such a great feature. I only really have one issue. Is there a way to get this to work with Calendars? My users have requested the ability to print out the different views on a specific calendar. Unfortunatly when they use the Print action they get the drop down for the different views but nothing else is displayed.
Mar 18, 2008 at 8:21 PM
Scott, Do you why the filter is not working on print view? Thanks.
Coordinator
Mar 21, 2008 at 11:18 AM
Havce both of you tried the latest version to see if it solves your problem? Sounds like you may have an older one.
Mar 26, 2008 at 3:07 AM
Thank you Scott. I downloaded the source and redeployed, the view filter is working now with little change. By the way, is that possible to dump the filtered data into excel file without the garbage data? Thanks.
Mar 31, 2008 at 8:04 PM
Is there a way to get this feature to work on MySites? I thought globally deploying would work for MySites too, but the option only appears in publishing sites.
Ideas?
Mar 31, 2008 at 8:23 PM
sorry, i was a little anxious, ive got it working on MySites too now, cool feature, thanks!
May 2, 2008 at 4:13 PM
In allitems.aspx page, I customized the LVWP to DFWP to add additional columns with html links.

After clicking print list, select a view, all item view, the page is blank other than the dropdown.

Has anyone ran into this? Any suggestions?

Thanks,

Tony
May 26, 2008 at 4:42 PM
Hi,

I've copied all the files across (Features, Images and Layouts), installed the feature using stsadm and activated it via the Site Collection Features page. The Print List option is showing up in my actions menu's but when I click on it I get an error on the popped-up page stating;

"File Not Found.   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) "

I'm trying to print the list at URL https://iris.adamsmith.ac.uk/pg/Lists/Meeting%20Details/AllItems.aspx and the URL of the popup print window is: https://iris.adamsmith.ac.uk/pg/_layouts/PrintList/PrintList.aspx?list={56703b49-14dd-49d4-88d7-adc8d0c1470c}&view={FF1A73FD-CAED-466B-B2D2-D14AFBE80CA7}

Any ideas? Thanks.

Mark
Coordinator
May 29, 2008 at 11:35 AM
The PrintList.dll is not installed in the GAC. Why did you manually copy elements? The solution comes with a WSP file. Just use that and all the elements will get installed in the correct location.
Jun 20, 2008 at 9:18 PM
Hi Scott,
    I installed the lasted PrintList.wsp and I am still unable to print the Calendar view.  I just wanted to know if it is supposed to work or not.  I will try an iisreset off hours but this is a production system to I don't want to do it unless I need to.  Let me know what you think.

Greg
Nov 6, 2008 at 8:22 PM
Hi Scot, congratulations for your nice work.
Wouldn't it be nice to be able to print more than one view from the same list at the same time. I'm not a programmer so I can't do it, but there goes the idea incase someone has the time or dares to do it.

Thanks,

Ivan
Jun 10, 2009 at 4:32 PM

Hi Guys,

Been playing around with the print list feature; both Ishai Sagi's orginal; and the codeplex improvment. A lot of people have been asking about printing the current view, and that's what i'm after. I've tried rdcpro solution to this, but I receive an unknown error. The Codeplex improvment offers the drop down list to select the view; which is nice, bit I want it to print the current view automitically - or extract a link that would allow me to jump right to the view & print. I've got the sourse code to play around with, but i'm not much of a coder. Any help appreciated.

Aug 5, 2009 at 3:58 PM

Hi,

nice feature! I tried to print some views and it mostly works great. But if you try to print a view with groupings it doesn't work. If you click the plus to expand a group its just loading and nothing happens. It only works if the grouping is set to expanded at the view?

Has anyone experienced the same problem?

Thanks!

Aug 6, 2009 at 10:37 AM

Hi again.

I fixed the groupings problem and added some extras:

- Popup window for print view

- Printing directly the current view selected in list.

- Groups are expanded automatically

If somebody is interrested - let me know!

Aug 11, 2009 at 3:54 PM

I can't get the filters to work.  The page reloads and in the URL I can see filter values being set, but the filter is not applied.  Am I missing something?

Oct 2, 2009 at 5:19 PM

Not sure if my version is old or not.  When I try to print a list with Totals (using Count on a column) that show at the top of the list, the totals don't appear when trying to print the list.  Is this feature there or planning on it?

Regards,

Perry