So, what does this code do?
The first few functions sets up the Print View action for the list views.
The stripcontents function is used to parse tags and remove content around the requested tag.
The first line of the printlist function gets the text of the view selector for the list view I am on. This is a major piece so that I know what view I am using. The next few lines setup the ActiveX objects needed for this to work including loading the xsl transform file from a document library CTSPrintList.xsl. This is similar to the xsl stylesheet from the first article.
The next thing I do is use SPServices and the GetViewCollection call to get the actual view guid that matches the current view I am on. Then I call the GetViewHtml webservice function to return the actual view's HTML. I then use the small utility function stripcontents to strip the actual Where clause of the CAML query for the view. I then add back the Query and Where pieces of the CAML query and am ready to then use the GetListItems webservice call to get the data from the view.
Once I get the data, I use the stripcontents function again to strip out the GetListItemsResult data which I then translate using the xsl stylesheet.
I then add the proper xml tags to denote this is spreadsheet xml. I then use the base64 functions listed at the bottom of this post to encode the xml to base64. I then use the CopyIntoItems webservice call to copy this xml file to the CTSReports document library using the users name for the file.
The last step is to then launch Excel and then open this file and you will have the report the way you want it!
I think that this is a better approach than the one that I had before. All questions or thoughts are welcome!
The base 64 code from the site mentioned above: