473,385 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Rendering WordML from ASP.NET

I have a WordML file that I want to render in the browser in word via
ASP.NET. If I use Response.Redirect("filename.xml") in the ASP.NET
codebehind I can get it to work. I would prefer to use set the
ContentType to the appropriate value and write the actual XML text to
the Response object, but I can't get that to work. I've tried the
following-

//************************************************** *************
// This shows the contents as XML
//************************************************** *************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}

Response.ContentType = "text/xml";
Response.Write(fileContents);
//************************************************** *************
// This puts a a Word dialog that says "the XML file Default.aspx
cannot be opened
// because there are problems with the contents
//************************************************** *************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}

//Response.Clear();
Response.ContentType = "application/msword";
Response.Write(fileContents);

//************************************************** *************
// This shows the contents as XML
//************************************************** *************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}

//Response.Clear();
Response.ContentType = "application/msword-xml";
Response.Write(fileContents);
My final goal is to allow the document to be edited with Word, then
intercept the save event in the ASP.NET code to grab the document and
process within ASP.NET rather than granting the client user rights to
save a file to the server.

Any ideas or suggestions?

Biff Gaut
Gaithersburg, MD

Mar 10 '07 #1
1 2962
To render WordML file as HTML; Microsoft provides the file Word2Html.xsl
that will do just it. Although be warned large word documents will take a
long time to transform.

Hope that helps.

"Biff" <bi******@gmail.comwrote in message
news:11********************@c51g2000cwc.googlegrou ps.com...
>I have a WordML file that I want to render in the browser in word via
ASP.NET. If I use Response.Redirect("filename.xml") in the ASP.NET
codebehind I can get it to work. I would prefer to use set the
ContentType to the appropriate value and write the actual XML text to
the Response object, but I can't get that to work. I've tried the
following-

//************************************************** *************
// This shows the contents as XML
//************************************************** *************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}

Response.ContentType = "text/xml";
Response.Write(fileContents);
//************************************************** *************
// This puts a a Word dialog that says "the XML file Default.aspx
cannot be opened
// because there are problems with the contents
//************************************************** *************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}

//Response.Clear();
Response.ContentType = "application/msword";
Response.Write(fileContents);

//************************************************** *************
// This shows the contents as XML
//************************************************** *************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}

//Response.Clear();
Response.ContentType = "application/msword-xml";
Response.Write(fileContents);
My final goal is to allow the document to be edited with Word, then
intercept the save event in the ASP.NET code to grab the document and
process within ASP.NET rather than granting the client user rights to
save a file to the server.

Any ideas or suggestions?

Biff Gaut
Gaithersburg, MD

Mar 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tom Frey | last post by:
Hi, is there any solution available for transforming WordML XML files to PDF on server requests. Here is basically what I'm looking for: We have like 15 different types of contracts that have...
5
by: Clifford W. Racz | last post by:
Has anyone solved the issue of translating lists in Word 2003 (WordML) into xHTML? I have been trying to get the nested table code for my XSLT to work for a while now, with no way to get the...
0
by: Logician | last post by:
Can anyone point me in the right direction for XML creation from WordML, after using a JPEG/OCR? Problem ======= 1. The WordML has font tags, and I need just data tags for reading by ..NET ...
0
by: Altsoft Xml2PDF | last post by:
Xml2PDF formatting engine version 2.3 May 25, 2004 Altsoft N.V. Altsoft N.V. is proud to announce the release of version 2.3 of its Xml2PDF formatting engine. The update includes: -...
3
by: utterberg | last post by:
If I have an xml that looks something like this: <section> <item> <label>label one</label> <data>123</label> </item> <item> <label>label two</label> <data>456</label>
0
by: jayrm100 | last post by:
Hi, When there is mouse movement over a tag <Doc> in WordML, a tool tip like "Start of Doc" is displayed. I need to know if its possible to overwrite this tool tip, that is "Welcome to WordML"...
0
by: Matthias Langbein | last post by:
Hi all, in ref. to the MSDN-Article "New XML Features of the Microsoft Office Word 2003 Object Model"...
0
by: JD | last post by:
Hello: I am trying to put together a solution that would programmatically insert XML data into a WordML document. I am trying to do this through a web page when a user clicks on a link. For...
1
by: Pedro Rosas Silva | last post by:
Hi everyone, Is anybody aware of a way how to insert an image in a WordML document programmatically, through C#? I have a C# application that loads into memory a WordML document...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.