Ewa.Workbook.getDataCultureName()
Applies to: apps for SharePoint | Excel Services | SharePoint Server 2013
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
Type: 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. The code example assumes that you are working with an Excel Web Access Web Part on SharePoint Server 2013.
<script type="text/javascript">
var ewa = null;
// Add event handler for onload event.
if (window.attachEvent)
{
window.attachEvent("onload", ewaOnPageLoad);
}
else
{
window.addEventListener("DOMContentLoaded", ewaOnPageLoad, false);
}
// Add event handler for applicationReady event.
function ewaOnPageLoad()
{
Ewa.EwaControl.add_applicationReady(onApplicationReady);
}
function onApplicationReady()
{
// 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()" />