miercuri, iunie 07, 2006

Export To Spreadsheet Woes

As you know, I have personalized my SharPoint site so dramatically, It no longer contains any original 'Out Of The Box' design elelments. As such, I would have liked to place a link somewhere on my page to export the list to a spreadsheet. This functionality is contained in the code:

%3Csharepoint%3Arelatedtasks+runat%3D%22server%22%3E

which provides all of the related taks, including exporting the list to a spreadsheet.

I do not want all of the other actions at this time, although, I am sure I will be needing to provide links to these items someday as well:

  • Add to My Links
  • View Reports
  • Alert Me
  • Export to spreadsheet
  • Modify Settings and Columns
Anyway, the primary focus of this article is how to get the export to spreadsheet function to do what I want it to do without having all that other stuff around.

The first thing I tried (don't laugh, it might have worked if it weren't for those meddling kids), was:
  1. Using the 'Out of The Box' AllItems.aspx template and clicked on the 'Export to spreadsheet' link
  2. Opening the list in Excel and saving a local copy.
  3. Upload my local copy to a document library
  4. Providing a link to the Excel file that I just uploaded into the document library and hoping for the best.
Needless to say, this didn't work because the list was not linked to the Excel file (hey - it was worth a go). So right-clicking the excel data did not provide the needed 'Synchronize with Sharepoint' option that I so desparately needed.

Then, I tried modifying the code as such:

%3Csharepoint%3Arelatedtasks+runat%3D%22server%22+list%3D%22JFHG837T%2D7629%2D438A%2DB7F3%2D92784GFH784G%22%3E

Which seemed to work, however, once the list was opened in Excel, only the ID field was displayed.

So, I opened the 'Out of The Box' AllItems.aspx template in ie and viewed the source.

This looked promising:

%3Ca+accesskey%3D%22P%22+id%3D%22diidIOExportToSpreadsheet%22+href%3D%22javascript%3A%22+onclick%3D%22%22+cs%3D%22109%26Using%3D%22+iqy%3D%22%22+list%3D%22%7B%3C%2Fspan%22%3E%3Cspan+style%3D%22font%2Dfamily%3Acourier+new%3B%22%3EJFHG837T%2D7629%2D438A%2DB7F3%2D92784GFH784G%3C%2Fspan%3E%3C%2Fa%3E%3C%2Fspan%3E%3Cspan+style%3D%22font%2Dsize%3A85%25%3B%22%3E%3Cspan+style%3D%22font%2Dfamily%3Acourier+new%3B%22%3E%3Ca+accesskey%3D%22P%22+id%3D%22diidIOExportToSpreadsheet%22+href%3D%22javascript%3A%22+onclick%3D%22%22+cs%3D%22109%26amp%3BUsing%3D%22+iqy%3D%22%22+list%3D%22%7B%3C%2Fspan%22%3E%7D+%26View%3D%7BH8UG5T6E%2D7625%2DJ92S%2DH7J8%2DMDXMQU8YT7UL%7D+%26amp%3Bamp%3Bamp%3BRootFolder%3D%26CacheControl%3D1%27%29%3Bjavascript%3Areturn+false%3B%22%3EExport+to+spreadsheet%3C%2Fa%3E

However, using that code only provided the ID field from my list, not all fields from my list, again. Removing the View Querystring was the answer, so now I have:

%3Ca+accesskey%3D%22P%22+id%3D%22diidIOExportToSpreadsheet%22+href%3D%22javascript%3A%22+onclick%3D%22%22+cs%3D%22109%26Using%3D%22+iqy%3D%22%22+list%3D%22%7B%3C%2Fspan%22%3E%3Cspan+style%3D%22font%2Dfamily%3Acourier+new%3B%22%3EJFHG837T%2D7629%2D438A%2DB7F3%2D92784GFH784G%3C%2Fspan%3E%3C%2Fa%3E%3C%2Fspan%3E%3Cspan+style%3D%22font%2Dsize%3A85%25%3B%22%3E%3Cspan+style%3D%22font%2Dfamily%3Acourier+new%3B%22%3E%3Ca+accesskey%3D%22P%22+id%3D%22diidIOExportToSpreadsheet%22+href%3D%22javascript%3A%22+onclick%3D%22%22+cs%3D%22109%26amp%3BUsing%3D%22+iqy%3D%22%22+list%3D%22%7B%3C%2Fspan%22%3E%7D+%26View%3D%26amp%3Bamp%3Bamp%3BRootFolder%3D%26CacheControl%3D1%27%29%3Bjavascript%3Areturn+false%3B%22%3EExport+to+spreadsheet%3C%2Fa%3E

Which works!

Niciun comentariu:

Despre mine

Timi-Ostravia, Republic of Czedvia, Bulgaria
I make web applications. The tools I use are many and far between. I have been maining to learn Ruby and Python, and Perl. These tools are all like Lego to me. They can all be make to build things and have their strengths and weakest.