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?
Thanks
many thanks
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