开发者

ASP.NET client to stream server-side docx files to Word 2007

开发者 https://www.devze.com 2023-02-11 08:54 出处:网络
The basic question is how can I click a button on a asp.net web pag开发者_高级运维e and it should show the download file box with open or save using Microsoft Word 2007?

The basic question is how can I click a button on a asp.net web pag开发者_高级运维e and it should show the download file box with open or save using Microsoft Word 2007?

I'm using OpenXML SDK v 2.0 and can, by clicking on a button, create (server-side) a docx document from a template, add in custom xml to populate Content controls and create a new Word docx document. However, my problem is then trying to send the document content in the http response object which will recognise the content as a Word 2007 document and, with the appropriate mime type, ask the user if they want to open the file with Word 2007 (which they have installed on their machine). No matter which option I try (about a dozen so far) I get either a 'Error parsing near 'PK ..' or an Error parsing near '

I've read just about all that seems to be online in the OpenXML Developer.org site, Eric White's blog, the MSDN articles, etc, etc but none seem to work when it comes to sending the document content to the client. I don't want to open the document in the browser, simply give the user the option to open the document (for further editing) in Word 2007.

I understand most of the Word 2007 file structure stuff and realise that the errors above relate to trying to parse the apparent zip file of docx or the xml (I have tried various permutations of Response.ContentType). It seems to me that the 'difficult' stuff of server-side document generation is done but the simple part of sending the content to the client is eluding me.

I hope someone who has managed to do this can help.

0

精彩评论

暂无评论...
验证码 换一张
取 消