Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Nachfolgend finden Sie bekannte Probleme und Tipps zum Arbeiten mit Excel Services.
Excel Web Service
Anzeigen des WSDL-Speicherorts
Sie können die Seite Excel Web Services Web Services Description Language (WSDL) anzeigen, indem Sie zur folgenden URL auf dem Server navigieren: http://<server>/<customsite>/_vti_bin/excelservice.asmx?WSDL
Wenn Sie nicht über eine benutzerdefinierte Website verfügen, können Sie die WSDL mithilfe der folgenden URL anzeigen: http://<server>/_vti_bin/excelservice.asmx?WSDL
Weitere Informationen finden Sie unter Zugreifen auf die SOAP-API.
Grundlegendes zu Excel Web Services und Namespaces
Nachfolgend finden Sie Excel Web Services und Namespaces:
- The single web service object that contains all the API methods: ExcelService
- Der Schemanamespace:
http://schemas.microsoft.com/office/excel/server/webservices - Der Name der Webdienstseite: ExcelService.asmx
Lokales Verknüpfen mit einem Webdienst
In bestimmten Szenarien sollten Sie direkt mit Microsoft.Office.Excel.Server.WebServices.dll verknüpfen und wie auf eine beliebige lokale Assembly zugreifen, anstatt die Datei als Webdienst über SOAP über HTTP aufzurufen.
Weitere Informationen und Richtlinien zur Verwendung von Direct Linking finden Sie unter Loop-Back-SOAP-Aufrufe und Direct Linking.
Understanding Invalid Characters
Die Aufrufe der GetCell- und der GetRange-Methode schlagen fehl, wenn die Arbeitsmappenzellen Zeichen enthalten, die in einer XML-Antwort ungültig sind.
For example, if a cell contains characters with hexadecimal values 0x1, 0x2 ... 0x8, the ASP.NET parser will throw an exception that the value of the character being written to the XML response is invalid:
System.InvalidOperationException: Der gefundene Anforderungsinhaltstyp ist 'text/html; charset=utf-8', aber 'text/xml' wurde erwartet. Die Anforderung ist mit der folgenden Fehlermeldung fehlgeschlagen: -- <html><head><title>' ', Hexadezimalwert 0x01, ist ein ungültiges Zeichen.
Dieses Verhalten wird erwartet. Die XML-Spezifikation, mit der definiert wird, welche Zeichen in einer XML-Antwort zulässig sind, gibt an, dass die Hexadezimalwerte 0x1, 0x2 ... 0x8 ungültige XML-Zeichen sind:
Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] / any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. /
Weitere Informationen finden Sie unter W3C Extensible Markup Language (XML)-Spezifikation.
Saving a Workbook
When you make changes to a workbookfor example, by setting values to a range using Excel Web Servicesthe changes to the workbook are preserved only for that particular session. The changes are not saved or persisted back to the original workbook. When the current workbook session ends (for example, when you call the CloseWorkbook method, or the session times out), changes you made will be lost.
If you want to save changes to a workbook, you can use the GetWorkbook method and then save the workbook using the API of the destination file store. For more information, see How to: Get an Entire Workbook or a Snapshot and How to: Save a Workbook.
Grundlegendes zur Url-Eigenschaft einer Excel Web Services-Proxyklasse
Do not use the Url property of an Excel Web Services proxy for the location of the workbook you want to open. The Url property of a web service proxy class generated by Visual Studio gets or sets the base URL of the XML web service the client is requesting. Im Fall von Excel Web Services ist dies in der Regel: http://<server name>/_vti_bin/ExcelService.asmx
To specify the location of a workbook, use the OpenWorkbook method instead of the Url property as shown in the following code example.
//Instantiate the web service and make a status array object.
ExcelService xlservice = new ExcelService();
string sheetName = "Sheet1";
//Set the path to the workbook to open.
//TODO: Change the path to the workbook
//to point to a workbook you have access to.
//The workbook must be in a trusted location.
string targetWorkbookPath = "http://myserver02/example/Shared%20Documents/Book1.xlsx";
//Set credentials for requests.
xlservice.Credentials = System.Net.CredentialCache.DefaultCredentials;
//Call the open workbook, and point to the trusted
//location of the workbook to open.
string sessionId = xlservice.OpenWorkbook(targetWorkbookPath, "en-US", "en-US", out outStatus);
Weitere Informationen finden Sie unter WebClientProtocol.Url-Eigenschaft.
Grundlegendes zur Sicherheit
Verwenden von Arbeitsmappenberechtigungen
Beachten Sie die folgenden Probleme im Zusammenhang mit Arbeitsmappenberechtigungen:
- Excel Web Services verwendet das Microsoft SharePoint Foundation-Autorisierungsschema, um zu überprüfen, ob der Aufrufer das Recht hat, APIs (d. h. Webdienstaufrufe) auf der SharePoint Foundation-Website (d. h. der Website, auf der sich Excel Web Services befindet) remote aufzurufen. If the caller does not have the "Use Remote API" right, the Excel Web Services returns an "HTTP 401 (Unauthorized)" error, and logs an "API authorization failed" event. Excel Web Services performs these authorization checks only for calls that originate as SOAP calls. Calls from applications that link locally to Microsoft.Office.Excel.Server.WebServices.dll are not considered remote calls. Therefore, they are not subject to authorization checks. However, if the application that links locally to Microsoft.Office.Excel.Server.WebServices.dll is itself a SOAP service, and handles the service's SOAP calls, the call to Excel Web Services will seem like a SOAP call (even though the application links directly to Microsoft.Office.Excel.Server.WebServices.dll). In this scenario, Excel Web Services will perform the authorization checks.
- To get the entire workbook (for example, by calling the GetWorkbook method using the
WorkbookType.FullWorkbookargument), the caller needs "open" permission for the workbook or "read" permission in a file share. - Zum Aufrufen der GetApiVersion-Methode sind keine Berechtigungen erforderlich.
- Für die übrigen Excel Web Services-Methoden benötigt der Aufrufer (abgesehen von Anmeldeinformationen) die Berechtigung „Anzeigen“ (in SharePoint Foundation) oder „Lesen“ (in einer Dateifreigabe) für die Arbeitsmappe.
Trusted Location
The workbooks you want to open in Excel Services must be placed in a trusted location. If not, the Excel Web Services calls to open the workbook will fail.
Informationen zum Vertrauen eines Speicherorts finden Sie unter How to: Trust a Location und How to: Trust Workbook Locations Using Script.
Visual Studio
Microsoft Visual Studio Proxy Behavior
Wenn Microsoft Visual Studio eine Proxyklasse für ein Clientprojekt erstellt, das Excel Web Services aufruft, weist diese das folgenden Verhalten auf:
If a method has no return value, and one or more out arguments, the first out argument is moved to become the return value. That is, the method in the proxy class will have one less out argument in the method signature. But the signature will have a return value with the type and content of what used to be the first out argument.
The affected Excel Web Services methods are:
- Calculate
- CalculateA1
- CalculateWorkbook
- CancelRequest
- CloseWorkbook
- GetSessionInformation
- Refresh
- SetCell
- SetCellA1
- SetRange
- SetRangeA1
Benutzerdefinierte Funktionen für Excel Services
Der globale Assemblycache wird zuerst überprüft, dann der lokale Ordner
By design in the Microsoft .NET Framework, an assembly in a global assembly cache will be loaded instead of the same assembly in a local folder. The common language runtime will look for an assembly in the global assembly cache first before searching in the local folders.
Therefore, if an assembly is installed in the global assembly cache and is in the UDF list but disabled (or removed from the UDF list altogether), and an identical assembly is installed in a local folder and enabled, the assembly in the global assembly cache will still get loaded and used instead of the same assembly in the local folder.
Dies hat keine Auswirkungen auf Upgradeszenarien, bei denen die Assemblyversion geändert wurde, was bedeutet, dass die Assembly nicht mehr die gleiche ist.
Allgemein
Reihenfolge von Zeichenfolgen in Sharedstring.xml wird nicht beibehalten
Excel Services behält nicht die ursprüngliche Reihenfolge der Zeichenfolgen in einer Arbeitsmappentabelle mit freigegebenen Zeichenfolgen bei (der Sharedstrings.xml Teil in der Xml-Formatdatei von Microsoft Office Excel). For example, execute the following steps:
- Open a file using Excel.
- Save the file in .xlsx file format.
- Upload the file to a document library that is a trusted location.
- Open the file in the document library by using Excel Web Access.
- Click Open in Excel.
- Save the file in .xlsx file format.
Wenn Sie die in Schritt 2 erstellte Sharedstrings.xml Datei mit der datei vergleichen, die in Schritt 6 erstellt wurde, werden Sie feststellen, dass die Reihenfolge der Sharedstrings.xml Teile möglicherweise anders sein kann.
You should not write an application that assumes the order of strings in the shared-string table is fixed. For example, you cannot replace the shared-string table with an existing localized translation table. You must adjust to the new ordering of strings in the shared-string table.