Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Export Xslt Data View to Excel

826 views
Skip to first unread message

Hans Baumann

unread,
Oct 21, 2009, 10:01:24 AM10/21/09
to
Hi everybody,

This is my issue:

1. Create a custom list in WSS
2. Create / Edit any web part page
3. Add a SharePoint List View Web Part for the Custom List you have just
created
4. Save the changes.
5. Load the page in Internet Explorer
6. Select the option "Export to spreadsheet", you will be prompted to open
it with Excel, who opens it and creates a link the SharePoint Custom List.
This is O.K.

..but...

7. Open the same page with SharePoint Designer
8. Select the added web part in point 3.
9. Right-click and choose "Convert to XSLT Data View".
10. Save changes, go back to the browser and reload the page (it will prompt
an error, just click on "refresh page").
11. Try the same action in point 6. the result is just two columns!!!

Anyone know if this has any workarounds?

VM

unread,
Oct 22, 2009, 11:49:01 PM10/22/09
to
I do have same problem. Does anybody have any solution?

Thanks

Fabrizio

unread,
Oct 30, 2009, 6:54:01 AM10/30/09
to
I have the same problem.

many thanks

Anastasiia Riabchenko

unread,
May 10, 2011, 7:18:19 AM5/10/11
to
Hi,
Your post is quite old but maybe somebody else will have the same problem (as I did today).
When I modified view is SP Designer export to Excel sheet was not working properly, it exported only two columns.
The solution of it is very simple.
In SP Designer create custom buttom:
<input name="Button1" id="ExportBTN" type="button" value="Export" style="padding: 1px 6px 4px 6px; height: 22px; width: 80px; font-size: 11px; font-family: Tahoma;"/>

Then in javascript code part add the below code:

<script type="text/javascript">
$(document).ready(function(){
$('#ExportBTN').click(function(){
var TableID = "{7A3E54AA-4CA0-4598-843B-1251DC3A9285}-{c6f8cbfa-90b1-43d7-971c-8ab24917bfdb}";
//this ID can be retrieved in web browser, find in code TABLE ID= part and copy the id.
exportToExcel(TableID);
});
});

function exportToExcel(TableID)
{
var detailsTable = document.getElementById(TableID);
var columns = detailsTable.getElementsByTagName("th");
var oExcel = new ActiveXObject("Excel.Application");
var oBook = oExcel.Workbooks.Add;
var oSheet = oBook.Worksheets(1);
for(i=0;i<columns.length;i++){
oSheet.cells(1,i+1).value= columns.innerText;
oSheet.cells(1,i+1).font.color="6";
oSheet.cells(1,i+1).font.bold="true";
oSheet.cells(1,i+1).interior.colorindex="15";
oSheet.cells(1,i+1).columnwidth =20;
}
for (var y=0;y<detailsTable.rows.length;y++)
{
for (var x=0;x<detailsTable.rows(y).cells.length;x++)
{
oSheet.Cells(y+1,x+1) = detailsTable.rows(y).cells(x).innerText;
}
}
oSheet.columns.autofit;
oExcel.Visible = true;
oExcel.UserControl = true;
}
</script>

That's it. For me it worked perfectly.

BR,
Nastia


>> On Thursday, October 22, 2009 11:49 PM VM wrote:

>> I do have same problem. Does anybody have any solution?
>>
>> Thanks

0 new messages