I have a problem with using ExcelService in Sharepoint 2010.
Case: I have a template Excel File, and i copied it to some folder and then tried to fill cells in new document:
This code creates a file:
SPList documents = Web4Documents.GetListEx("Lists/RequestDocuments");
SPFolder folder = documents.RootFolder.SubFolders.Add(_formContext.Request.Number).SubFolders.Add("Docs");
string path = folder.ServerRelativeUrl.AddUrl("Document.xlsx");
SPFile document = Web4Documents.Files.Add(path, stream, null, true);
After that I open this file using Excel Service:
using (Workbook workbook = client.OpenWorkbook(_context._SiteOriginal.MakeFullUrl(DocumentPath)))
{
//workbook.SetCell("A1", "TEST");
workbook.SetCellByCoords("List1", 1, 1, "test");
workbook.Save();
}
This is a implementation of workbook`s Save method:
public void Save()
{
try
{
_service.SaveWorkbook(_session);
}
catch (SoapException ex)
{
throw new ASUPTPException("SOAP exception message: {0}, ERROR_CODE:", ex.Message, ex.SubCode.Code.Name);
}
}
And I get SoapException: "An error occurred while attempting to save your workbook. As a result, the workbook was not saved". Error code: FileSaveGeneric
Template file is empty.
Can anybody tell me why..?