views:

477

answers:

1

Is it possible to create an Excel document using VSTO, using a SharePoint contenttype?

Creating a document in VSTO based on a template is easy.

Workbook newWorkbook = this.Application.Workbooks.Add(@"C:\temp\TestTemplate.xltx");

But the "template" that's assigned to a content type in SharePoint has xlsx as an extension.

A: 

The xlsx extension is not because the file is hosted in SharePoint, but because it is an Office 2007 template (all office 2007 extensions have an extra x behind their extension, so .doc becomes .docx). You can assign your own templates to content types in SharePoint if you want.

VSTO should work with xlsx files too, you probably just need to use the office 2007 dll's.

Colin
From my understanding, xltx is an Excel (2007) template. But SharePoint uses xlsx documents as "templates".What I'm doing now is, use Excel Services to get a bytearray into the client (Excel on the desktop). I only have to figure out a way to create a document on the client, and upload it to SharePoint again.
Saab