共用方式為


Ewa.Workbook.getWorkbookPath()

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value
Remarks
Example
Applies To

Gets the location of the workbook file to open.

var value = Ewa.Workbook.getWorkbookPath();

Return Value

String

Remarks

The Ewa.Workbook.getWorkbookPath method returns the path of the specified workbook as a string.

Note

Ewa.Workbook.getWorkbookPath returns null if you have only View Item permission.

Example

The following code example shows how to display the path of the active workbook in the browser status bar after the page loads.

<script type="text/javascript">
     
var ewa = null;
    
// Add event handler for onload event.
if (window.attachEvent) 
{ 
    window.attachEvent("onload", ewaOmPageLoad);    
} 
else 
{ 
    window.addEventListener("DOMContentLoaded", ewaOmPageLoad, false); 
}

// Add event handler for applicationReady event.
function ewaOmPageLoad() 
{         
    Ewa.EwaControl.add_applicationReady(getEwa); 
} 

function getEwa()
{            
    // Get a reference to the Excel Services Web Part.
    ewa = Ewa.EwaControl.getInstances().getItem(0);    
     
    // Display workbook path in browser status bar.
    window.status =  "Active workbook path: " + ewa.getActiveWorkbook().getWorkbookPath() + ".";                                
}              
      
</script>

Applies To

Ewa.Workbook Object

See Also

Concepts

Ewa.Workbook Methods

Ewa Namespace