Exporting to Microsoft Excel from a DataView Web Part consuming a Web Service with Parameters

In Sharepoint Designer, I've developed a page displaying a DataView Web Part which consumes an XML Web Service with three parameters.  These parameters are passed in from a simple Form Web Part containing three input fields.  I am able to provide default values for the web service so the dataview is initially populated, and when I enter in new parameters, the web service goes back, grabs the requested data and displays in the dataview nice and slick.
The problem I'm having is this: In Internet Explorer 7, when I right-click on the DataView Web Part and select Export to Microsoft Excel, Excel opens up, says "ExternalData_1: Getting Data..." and returns the data from the web service which applies to the default parameter values each and every time, regardless of whether I have changed the parameters on the web page, and contrary to what the DataView Web Part displays on the screen.
Has anyone else run into this, and is there a solution to the problem?
Best regards,
Mark Christie

Hi Bullish35,
 It's possible to provide single export button and export your 4 dataview webparts. Here's the modified code.
<Script Language="Javascript">
function isIE() // Function to Determine IE or Not
return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
function exportToExcel() // Function to Export the Table Data to Excel.
var isIEBrowser = isIE();
if(isIEBrowser== false)
alert('Please use Internet Explorer for Excel Export Functionality.');
return false;
else
var strTableID1 = "detailsTable1", strTableID2 = "detailsTable2", strTableID3 = "detailsTable3", strTableID4 = "detailsTable4";
var objExcel = new ActiveXObject("Excel.Application");
var objWorkBook = objExcel.Workbooks.Add;
var objWorkSheet = objWorkBook.Worksheets(1);
var detailsTable = document.getElementById(strTableID1);
var intRowIndexGlobal= 0;
for (var intRowIndex=0;intRowIndex<detailsTable1.rows.length;intRowIndex++)
for (var intColumnIndex=0;intColumnIndex<detailsTable1.rows(intRowIndex).cells.length;intColumnIndex++)
if(intColumnIndex != 3)
objWorkSheet.Cells(intRowIndexGlobal+1,intColumnIndex+1) = detailsTable1.rows(intRowIndex).cells(intColumnIndex).innerText;
intRowIndexGlobal++;
for (var intRowIndex=0;intRowIndex<detailsTable2.rows.length;intRowIndex++)
for (var intColumnIndex=0;intColumnIndex<detailsTable2.rows(intRowIndex).cells.length;intColumnIndex++)
if(intColumnIndex != 3)
objWorkSheet.Cells(intRowIndexGlobal+1,intColumnIndex+1) = detailsTable2.rows(intRowIndex).cells(intColumnIndex).innerText;
intRowIndexGlobal++;
for (var intRowIndex=0;intRowIndex<detailsTable3.rows.length;intRowIndex++)
for (var intColumnIndex=0;intColumnIndex<detailsTable3.rows(intRowIndex).cells.length;intColumnIndex++)
if(intColumnIndex != 3)
objWorkSheet.Cells(intRowIndexGlobal+1,intColumnIndex+1) = detailsTable3.rows(intRowIndex).cells(intColumnIndex).innerText;
intRowIndexGlobal++;
for (var intRowIndex=0;intRowIndex<detailsTable4.rows.length;intRowIndex++)
for (var intColumnIndex=0;intColumnIndex<detailsTable4.rows(intRowIndex).cells.length;intColumnIndex++)
if(intColumnIndex != 3)
objWorkSheet.Cells(intRowIndexGlobal+1,intColumnIndex+1) = detailsTable4.rows(intRowIndex).cells(intColumnIndex).innerText;
intRowIndexGlobal++;
objExcel.Visible = true;
objExcel.UserControl = true;
</Script>
I haven't tested this. But it should work! :)Regards,
Venkatesh R
/* My Code Runs in Visual Studio 2010 */
http://geekswithblogs.net/venkatx5/

Similar Messages

  • Error in "Export to Microsoft Excel" from Portal

    Hi,
    I have a BW report on Portal 7.0 with columns with time in format like hh:mm:ss.
    When I exported it to Excel and open this file I get inside Excel window an information window "Problems while loading" and explanation "Value of cell". After I send OK sheet of data is opening. The hours fraction of time in all cells is changed to hh+1.
    In log of this action ...\Temporary Internrt Files\Content.MSO\EB0B32EE.log are lines like:
    HTML Error of Cell Value:06:10:00
        where 06 ought to be 05.
    The text below is from Excel:
    <td class=3Dx547531 x:num=3D"06:10:00" style=3D" mso-number-format:'hh\:mm\:ss'"><font class=3DFx547530>05:10:00</font></td>
    Thanks in advance
    Grzegorz Szot

    Hi,
    I had the same problems (html inside excel) it was caused by wrong excel / bex versions because they were not compatible.
    In my mind your error is caused by the same problem.
    Ceck the compatibility matrix:
    [BEx Compatibility|https://websmp201.sap-ag.de/~sapidb/011000358700000227152003E/compatibility_bex_office.htm.] of MS Operating Systems and Office Products
    Business Explorer Suite: Platform Questions
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1d43766a-0901-0010-0a9b-85eb1089fb17
    Bog:
    /people/community.user/blog/2007/06/27/using-the-bi-7x-add-on-for-sap-gui-710--requirements
    If this does not help and you found no solution you can check this notes on relevance:
    NW 7.0 BI Web Applications - Excel export of time cells
    SAP Note Number: [1152146|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bw_bex/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d31313532313436%7d]
    NW04s BI Web Excel export: Data cells exported as text
    SAP Note Number: [982305|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bw_bex/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d393832333035%7d]
    Error during export to MS Excel with certain templates
    SAP Note Number: [1148493|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bw_bex/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d31313438343933%7d]
    NW2004s BI Excel export date is generation time-dependent
    SAP Note Number: [1086420|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bw_bex/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d31303836343230%7d]
    Hope this helps. Don't forget to assign points if it was helpful.
    Regards
    Andreas

  • Export to Microsoft Excel opens empty - IE11, Office 2010, Win 7

    Hi,
    I am using IE11, Office 2010 and Win7 64bit. When I open IE, navigate to a webpage and click "Export to Microsoft Excel" from the context menu of IE, Excel opens and the "New Web Query" dialog has an empty address (http:///). The content
    is
    "This page can`t be displayed"
    Does anyone know what might be the cause of this problem and how can I fix it?
    Best Regards,
    Jordan

    Hi,
    Please include a link to any webpage you are having issues with your questions so we can test the page....:
    Any webpage ... it is not webpage specific rather an environmental problem.
    javascript:alert(navigator.platform); :
    Message from webpage
    Win32
    OK   
    Open Excel, switch to DATA, choose From Web , then try to import the website for test if it had same problem.:
    It works unsurprisingly ...
    When I open IE I can see in the Windows Task Manager there are 2 processes - a 64bit (~8MB RAM) and a 32bit one (~70 MB RAM)
    My Office 2010 is a 32bit.
    If I open it directly a 32bit excel process is stared.
    If I open it via the "Export to Microsoft Excel" menu two 32bit excel processes are started. I believe one is for the New Web Query and another one for the Excel itself ..
    Best Regards,
    Jordan

  • "Export to Microsoft Excel" in Bex Web

    Hi Experts,
    I am refreshing report in Bex web and trying to save in Excel format.
    I am hitting on " Export to Microsoft Excel" button.
    It works fine with 65 pages report , but fails to export for report with 265+ pages.
    This report has 7+ columns.
    We are using MS 2007 version and BI 7.0
    Wanted to check if there are limitations or if any SAP NOTES or PATCHES would help me.
    I quick reply would  of great help to me.
    Thanking in advance.
    VS8VIV

    Hi,
    unfortunately SAP still limitate exporting to EXcel files no more
    than 65,536 rows , currently there is no solution available for this
    issue.
    Please check note 1040454 and its restrictions from the .NET
    environment, leading to the limitation of 750.000 cells. If one
    considers the currently existing limitation of 65536 rows, this
    would mean something around 11 columns. Even when more rows are
    supported, the maximum number of cells that the .Net process can
    handle would not increase.
    1178857 Additional information: Export to Excel functions.
    For huge queries SAP offers Open Hub as a 3rd party tool. Please refer
    to the following link for more information
    about this:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/504797dc-9467-2a10-52ba-acd35244cd39
    Regards,
    Venkat

  • Export Data To Excel From DVWP

    Hi,
    I created DVWP in SPD.
    Is it possible to Export Data To Excel From DVWP?
    What should I do?
    Thanks in advance!

    Hello,
    try this:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/c2e2eb0c-202e-49c1-80cb-2fbf5159b10c/how-to-export-dataview-webpart-to-an-excel-file?forum=sharepointcustomizationprevious
    Via script:
    http://ameyakawale.wordpress.com/2011/08/04/exporting-dataview-webpart-data-into-excel-using-javascript/
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/e01ed0bb-63bc-49fc-b1ff-5d2342f897ae/exporting-data-view-webpart-to-excel-spreadsheet?forum=sharepointcustomizationprevious
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Export to Microsoft Excel

    When we right click on an HTML page, we see an option "Export to Microsoft Excel", is there a way in java whereby i can invoke that option.
    For example i want a certain HTML page to be exported to an excel, i guess easiest option would be to have a button, and on its click i invoke that "Export to Microsoft Excel" option.
    Is there a way to achieve this, or can anyone can suggest me a different way of exporting an HTML page to an xls?

    There's plenty of ways to do this. In java there's the POI library, and others, but they'll be server-side.
    On the client side, if you can write to a local file from JavaScript (dont' know), then there is an XML(i.e. text) format the Excel understands, and if its written to a file with a .xls extension, Excel will load it as a normal .xls file.
    So I'd look at writing files from JavaScript and look into the public Excel/XML format.

  • Security message on exporting grid to excel from webpage

    I am exporting data to excel from grid on a webpage. I have written following code:
    gv.DataSource = resultlist;
    gv.DataBind();
    Response.ClearContent();
    Response.AddHeader("content-disposition", "attachment; filename=Test.xls");
    Response.ContentType = "application/excel";
    //Ccreate string writer object and pass it to HtmlTextWriter object
    StringWriter sw = new StringWriter();
    HtmlTextWriter htw = new HtmlTextWriter(sw);
    gv.RenderControl(htw);
    Response.Write(sw.ToString());
    Response.End();
    Code is executing correctly. But when I open this excel, it is giving me a warning message which says, "The file you are trying to open, "Test.xls", is in a different format than specified by the file extension. Verify that the file is not
    corrupted and is from a trusted source before opening the file. Do you want to open the file now?"
    File gets opened when I select "Yes" on this message box, but I don't want to get this message box. Is there any work-around to get rid of it? When I selected "Save As" option of this file, I found that default type of the file was Webpage.
    How can we get this default type as "xls or xlsx"? I think this problem will be resolved when we will get this default type as "xls or xlsx". 

    Hi Ajinkya,
    Please post in ASP.NET forums:
    http://forums.asp.net/
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Export to Microsoft Excel option in POWL

    Dear All,
    As per customer requirement, i need to show the excel document without information while we are not selecting any items in the POWL listing. I explained detail in below.
    No item number is selected in the POWL listing and click on "Exportu201D Button, Select u201CExport to Microsoft Excelu201D. A microsoft excel document is created with no information, but all the columns that are in the POWL listing should appear.
    Normally if we are clicking the "Export to Microsoft Excel" without selection items in the POWL listing, microsoft excel  document is created with information only.
    Please help me how to achieve this requirement in POWL.
    Thanks & Regards
    Prakash T

    Hi
    POWL stands for [Personal Object Worklist |http://help.sap.com/saphelp_srm70/helpdata/en/80/c8cbf89a394eaaa59767d0faf958d3/content.htm]
    Regards
    Prakash T

  • ALV Export to Microsoft Excel Question

    Hi All,
    I know this would be a basic question and I tried searching the forums and did not find any luck. I have implemented the standard ALV and the output is displayed in the table. The standard Export-->Export to Microsoft Excel does not work for me when I click on it. Should I need to enable / trigger this event to make this work?
    Also, Is there anyway that I show the Export to Microsoft Excel option directly in the standard ALV instead of clicking on the Export and then Export to Microsoft Excel?
    Thanks,
    Nagarajan.

    Hi Nagarajan,
    That is a satandard functionality no coding required. it will work.
    Your excel file containes any images??
    Try this...
    l_value                         TYPE REF TO cl_salv_wd_config_table.
    lr_filter  ?= l_value.
    lr_filter->set_export_allowed( abap_true ).
    OR
    If you want to cal excel by using your custom button please check this...blog
    Using WD ABAP ALV export - the hacked way
    also check this...
    Re: How to call manually Export to Excel event of ALV standar component
    Cheers,
    Kris.

  • Export to microsoft excel(97-2003)data only

    hi..
    im using sap crystal report 13.0.2000.0 version with vs2010..
    if report is in land scape mode and
    when i export a report to export to microsoft excel(97-2003)data only,then column headers are displaced..
    if it is portrait then it working fine..
    for landscape mode reports only it is not working

    I am not able to reproduce the issue. Make sure you are using SP1:
    SAP Crystal Reports, developer version for Microsoft Visual Studio: Updates & Runtime Downloads [original link is broken]
    If that does not help, define "displaced". A pic may be worth a 1000 words :).
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported.

    SharePoint 2007 custom (VS 2008) solution is upgraded to SharePoint 2013 using (VS 2012). I followed this approach.
    I had created new empty project (solution) in SharePoint 2013 using (VS 2012) compiled and deployed successfully. All safe controls are registered in the web.config file. After deploying solution i Restarted IIS also, still getting this error. How to resolve
    Error
    Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe. Correlation ID: 5d217c9c-1827-7083-80cd-e095a30befee.
    Show Error Details
    Hide Error Details
    [UnsafeControlException: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.]
      at Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(Boolean isAppWeb, Guid guid, Guid solutionId, Nullable`1 solutionWebId, String assemblyFullName, String typeFullName, Boolean throwIfNotSafe)
      at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)
    <menu class="ms-hide" id="MSOMenu_WebPartMenu"><ie:menuitem id="MSOMenu_Minimize" text="Minimize" title="Collapse this web part." type="option"></ie:menuitem><ie:menuitem
    id="MSOMenu_Restore" text="Restore" title="Expand this web part." type="option"></ie:menuitem><ie:menuitem id="MSOMenu_Close" text="Close" title="Close this Web Part. You can still
    find it under closed Web Parts section in the insert ribbon. These changes will apply to all users." type="option"></ie:menuitem><ie:menuitem iconsrc="/_layouts/15/images/DelItem.gif" id="MSOMenu_Delete" text="Delete"
    title="Delete this Web Part from the page. These changes will apply to all users." type="option"></ie:menuitem><ie:menuitem type="separator"></ie:menuitem><ie:menuitem iconsrc="/_layouts/15/images/EditItem.gif"
    id="MSOMenu_Edit" text="Edit Web Part" title="Change properties of this shared Web Part. These changes will apply to all users." type="option"></ie:menuitem><ie:menuitem id="MSOMenu_Connections"
    text="Connections" title="Show connections options for this Web Part. These changes will apply to all users." type="option"></ie:menuitem><ie:menuitem type="separator"></ie:menuitem><ie:menuitem
    id="MSOMenu_Export" text="Export..." title="Export this Web Part. These changes will apply to all users." type="option"></ie:menuitem><ie:menuitem iconsrc="/_layouts/15/images/HelpIcon.gif" id="MSOMenu_Help"
    style="display:none;" text="Help" type="option"></ie:menuitem> </menu>        

    Hi Ashok,
    According to your description, my understanding is that you got an error after you re-built a SharePoint 2007 solution with VS2012, and deployed it.
    Make sure the Namespace and Type Name are consistent across all files where indicated. Also with matching case sensitivity. Verify web.config file and assembly in GAC or virtual directory bin folder in post deployment.
    More information, please refer to the link below:
    http://roykimsharepoint.wordpress.com/2013/04/27/classic-web-part-errors/
    Here is a similar post for you to take a look at:
    http://stackoverflow.com/questions/1689707/sharepoint-web-part-type-could-not-be-found-registered-as-safe
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • SharePoint - Web Part - SQL Server Reporting Services Report Viewer Error.

    Hi,
    I was just having a bit of a fiddle with the differen't web-parts available to add on our local SharePoint site, and as one of my tasks is to have a report automatically open when the page is opened i thought i would try to add the web-part 'SQL Server Reporting
    Services Report Viewer' just to see the outcome.
    Now, I don't much care about viewing the report at this time, but imediately after trying to add the web part i am being displayed with an error and no matter how much i navigate away from the page or close the browser the particular link to the page i was
    trying to insert the web-part into now displays an error.
    The error simply says 'An unexpsected error has occured' with various 'Correlation ID:' each time.
    Now i have a link to other parts or subsites of that SharePoint site and they work just fine, it's just when i try to click on the page where i wanted to put the web-part in it
    still comes up with an error. This page just so happens to be the home page so it really does need to be fixed.
    Please help!?
    Many Thanks,
    Plain_Clueless

    Hi again,
    Sorry for the bother, We have now fixed the issue for the time being.. all that was needed was a simple '?contents=1' at the end of the url which takes you to a menu where you can delete the
    necessary web-part that was causing the trouble.
    As for actually implementing the report onto SharePoint.. in future i will make Dev pages instead.. and it seems i may need to contact the admin side of building so they configure 'SQL Reporting 
    Services Report Viewer' properly.
    Thanks a lot though!
    - A little less Plain_Clueless
    Plain_Clueless

  • Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.

    We have an SharePoint services 3.0 installation that uses custom web parts on 100s of subsites.  The custom web parts on any website is presenting this error
    Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.
    This past weekend we decided to create a new database server and migrate the databases to the new server in an effort to retire an old box. 
    INitially we attempted to go through the configuration wizard which didnt do anything but add a new database server to our farm.  What we have done is remove the new database server from the farm and use an alias on the SP server to continue to use
    the same name but actually get its data from the new database server.
    Everything works with the site except these custom webparts. 
    Any thoughts on where to go to first, should i redeploy what i think are the webparts from VS 2005 (solutions are VS 2005 slns.)? 
    Tony Spaulding

    You need to make Safe Control enteries in your web.config for the particular web application.
    Open web.config
    Locate the SafeControls Tag
    Make a safe control entry
    <SafeControl Assembly="Assembly name, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d8eb6481d8b4beec" Namespace="your webpart namespace" TypeName="*" Safe="True" />
    In order to find the assembly details, Open the GAC. Right click on your dll and then click properties.

  • Web Part inside a Web Part

    Hello.
    I am currently redesigning a SharePoint. The new proposal is 95%
    complete, I am having one issue which I am struggling to resolve.
    I need to have a web part within another web part (a web part showing the news and announcements list
    inside the whole page web part) inside a table cell. 
    To resolve this I created an iFrame and placed a web part inside.
    This solved this issue however whenever
    the links were clicked in this web part they opened up in the small iFrame window and not the parent window (the one showing the whole page).
    I am trying to find a way to open the links in the iFrame in the parent window, new tab or in
    a new
    browser. Just like when you right click a link and select Open in New Tab but automatic. Also because there is no option to change the hyperlinks in the announcement list, I am unable to use the well known target & _blank functions etc.
     If
    you need anymore details I will be happy to provide you with these.
    Thank you.

    SharePoint architectural considerations aside, you can use the target
    attribute of your href links to escape an iframe. For instance:
    <a href="#" target="_top">Link</a> - will use the full browser window, escaping any iframes
    <a href="#" target="_blank">Link</a> - will open in a new tab/window, depending on user browser settings
    For more information about the target attribute, read
    this tutorial.
    Danny Jessee<br/> MCPD - SharePoint Developer 2010<br/> MCTS - SharePoint 2010, Configuring<br/> dannyjessee.com/blog

  • Center list web part within a web part zone

    How do you center web parts within a web part zone? I have a web part zone within a <td>, and the cell is centered. Within the cell I have a table that is centered, which contains the web part zone. However, the web parts within the zone remain left
    aligned. What am I missing? Thanks.

    Hi ,
    I did a test using the web part page template, there is a center web part zone. If I added a web part in the center web part zone and added another web part in the center right web part zone, save the page, the web part displayed in left. If I added a web
    part into the center left zone, the web part within the center web part zone displayed in center . The location of the center web part zone is comparative with others.
    If you want to keep the web part zone in center, you can use css style to modify it.
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

Maybe you are looking for

  • Drag and drop from Mozilla to PS doesn't work with Vista

    On XP I can drag an image directly from Mozilla to Photoshop and it opens it in a new document. In Vista that doesn't work anymore. Any ideas if this can be fixed

  • Importing Data into Apex 3.0.1

    I know that this question has a simple answer, but here goes. I know how to import data into oracle using sql loader and sql insert commands but can Apex import data into a blank application form with multiple rows of data to import. Like: U_Id L_Nam

  • Material to be recieved from vendor

    Dear All, we have four plants 001,002,003 & 004. 001 & 002 will send the material to vendor with 541 movement type. 004 will raise an subcon PO to vendor say 555.then when i recieve the material in 004 plant the raw material provided from 001 & 002 s

  • Performance of Spatial Java API

    I use the following statements to retrieve the sdo_geometries from Oracle Spatial Database: Statement stmt = conn.createStatement(); OracleResultSet ors = (OracleResultSet) stmt.executeQuery("select geom from counties"); while(ors.next()) // Extract

  • Cant find my serial number for final cut espress but have disk

    Can anyone help with this...