Solved

ASP.net VB.net upload Word doc to site

Posted on 2013-06-03
5
423 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 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: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 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:Murray Brown
ID: 39224692
Thanks very much
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

623 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