Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.net VB.net upload Word doc to site

Posted on 2013-06-03
5
Medium Priority
?
425 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:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 16

Assisted Solution

by:Kamal Khaleefa
Kamal Khaleefa earned 500 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:Murray Brown
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 500 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 1000 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:Murray Brown
ID: 39224692
Thanks very much
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

730 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