共用方式為


Ewa.Workbook.getDataCultureName()

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value
Remarks
Example
Applies To

Gets the actual name of the data culture for that particular session.

var value = Ewa.Workbook.getDataCultureName();

Return Value

String

Remarks

The Ewa.Workbook.getDataCultureName method gets the data culture for the session as a string, for example "en-US".

Note

The data culture can affect things such as formulas in cells. For example, the Date and Time formulas follow data culture settings and will return data accordingly.

Example

The following code example shows how to add a button to the page and then adds an event handler for the button onClick event that gets the data culture for the user session and displays the returned string in the browser status bar.

<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);                                   
}              
        
function getDataCultureButton()
{    
    // Get a reference to the workbook.
    var wkBook = ewa.getActiveWorkbook();    
        
    // Display the data culture in the browser status bar.
    window.status = wkBook.getDataCultureName();  
}
                

</script>
<input type="button" id="GetDataCulture" value="Get Data Culture" onclick="getDataCultureButton()" />

Applies To

Ewa.Workbook Object

See Also

Concepts

Ewa.Workbook Methods

Ewa Namespace