Solved

ASP.net VB.net upload Word doc to site

Posted on 2013-06-03
5
419 Views
Last Modified: 2013-06-05
Hi

Is it possible to post upload a Word document to an ASP.net site so that
the rich text format in the Word doc can be displayed on the site?
If not is there another way to type formatted text similar to that held in a Word doc
so that it may be used on an ASP.net Website?
0
Comment
Question by:murbro
5 Comments
 
LVL 16

Assisted Solution

by:Kamal Khaleefa
Kamal Khaleefa earned 125 total points
ID: 39218070
you need to display the content of the uploaded file right?

in this case you have to create a function that access your file and read its content but it will not come in formatted way

you can control the style by creating CSS class and put all the attributes you need
0
 

Author Comment

by:murbro
ID: 39218830
Hi

Thanks

Would you know of an example of the code that would you would use for this?

Thanks
0
 
LVL 23

Assisted Solution

by:Roopesh Reddy
Roopesh Reddy earned 125 total points
ID: 39223053
Hi,

Check this article - http://roopeshreddy.wordpress.com/tag/view-uploaded-file/

Again you may have to build Online Viewer Google Docs or Office 365, which is bit complex!

Hope it helps u...
0
 
LVL 15

Accepted Solution

by:
jorge_toriz earned 250 total points
ID: 39224110
With the following interface
<div>Upload your file</div>
<asp:FileUpload ID="fuWordFile" runat="server"></asp:FileUpload>
<asp:Button ID="cmdUpload" runat="server" Text="Upload" OnClick="cmdUpload_Click" />

Open in new window

I would save the file and then convert it to a single page web site using Word, add a reference to Microsoft Word X.X Object Library (X.X) is the version and using this code:
fuWordFile.SaveAs(Server.MapPath("~/files/" + Path.GetFileName(fuWordFile.FileName)));
//Save Word as web
ApplicationClass wordApp = new ApplicationClass();
wordApp.Documents.Open(Server.MapPath("~/files/" + Path.GetFileName(fuWordFile.FileName)));
wordApp.ActiveDocument.SaveAs2(Server.MapPath("~/web/" + Path.GetFileNameWithoutExtension(fuWordFile.FileName) + ".mht"),
    9);

Response.Redirect("~/web/" + Path.GetFileNameWithoutExtension(fuWordFile.FileName) + ".mht", false);

wordApp.Quit(false);

Open in new window

Well, you must first create "files" and "web" folders.
0
 

Author Closing Comment

by:murbro
ID: 39224692
Thanks very much
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question