473,663 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Redire ct("filename.xm l") 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.Stre amReader sr = new
System.IO.Strea mReader(@"c:\te mp\quizxml.xml" ))
{
fileContents = sr.ReadToEnd();
}

Response.Conten tType = "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.Stre amReader sr = new
System.IO.Strea mReader(@"c:\te mp\quizxml.xml" ))
{
fileContents = sr.ReadToEnd();
}

//Response.Clear( );
Response.Conten tType = "applicatio n/msword";
Response.Write( fileContents);

//*************** *************** *************** *************** ***
// This shows the contents as XML
//*************** *************** *************** *************** ***
string fileContents;
using (System.IO.Stre amReader sr = new
System.IO.Strea mReader(@"c:\te mp\quizxml.xml" ))
{
fileContents = sr.ReadToEnd();
}

//Response.Clear( );
Response.Conten tType = "applicatio n/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 2980
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******** ************@c5 1g2000cwc.googl egroups.com...
>I have a WordML file that I want to render in the browser in word via
ASP.NET. If I use Response.Redire ct("filename.xm l") 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.Stre amReader sr = new
System.IO.Strea mReader(@"c:\te mp\quizxml.xml" ))
{
fileContents = sr.ReadToEnd();
}

Response.Conten tType = "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.Stre amReader sr = new
System.IO.Strea mReader(@"c:\te mp\quizxml.xml" ))
{
fileContents = sr.ReadToEnd();
}

//Response.Clear( );
Response.Conten tType = "applicatio n/msword";
Response.Write( fileContents);

//*************** *************** *************** *************** ***
// This shows the contents as XML
//*************** *************** *************** *************** ***
string fileContents;
using (System.IO.Stre amReader sr = new
System.IO.Strea mReader(@"c:\te mp\quizxml.xml" ))
{
fileContents = sr.ReadToEnd();
}

//Response.Clear( );
Response.Conten tType = "applicatio n/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
7594
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 to be filled dynamically with data (names, addresse, etc.). These contracts are up to 30 pages long. Right now they are all in .doc format and we have to fill in the data by hand.
5
7409
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 collection that I need. To begin, I am using xsltproc that conmes with Cygwin as my processor. I have no particular affinity to this processor except that it is open source and standards compliant. I don't like M$, but if using a M$ processing...
0
1101
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 Solution
0
1287
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: - WordML as a new input format;
3
4040
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
984
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" should be displayed when there is a mouse movement over <Doc>. Thanks.
0
1156
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" (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_wd2003_ta/html/odc_Wdnew2k3XMLOM.asp) I've got a few questions: 1.) They say, the first step to work with XML in a word document is to add the XML-Schema to the Application-Object. As I want to work with the WordML (Word Object Model), I suppose I need to load this
0
1447
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 example, in a web page, a user clicks on a link or button, the XML data from an external file is inserted into a WordML document, and then is offered for download to the user. The reason why I am using WordML is because we have 20-30 word documents...
1
3149
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 (XmlDocument). The document is tagged in certain places so that the C# application can search for those tags (using the System.Xml namepace) and fill
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.