Click here to Skip to main content
15,395,065 members
Articles / Programming Languages / C# 4.0
Posted 3 Jan 2013

Tagged as


9 bookmarked

Microsoft Office Automation - Poor Man's SharePoint Server

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
3 Jan 2013CPOL3 min read
A poor man's SharePoint web solution allowing the upload and convertion of PowerPoint, Excel, Visio, and Word documents to HTML.

Sample Image


I was at work one day unraveling years of mistakes written by my predecessors when I stumbled across one of the biggest No No’s a Developer can ever make during enterprise web server solution development:  Office Automation.   

The night prior to discovering the Excel Automation craziness alluded to above,  I read Scott Berkun’s  “#46  - Why Software Sucks” article and I figured I would take Suck to the Max and write an ASP.NET web server application relying heavily on Offices Automation.  I wanted to stress the web application via automated testing to determine how bad of an idea this actually is.

By the way, here is link discussing the reason not to do this:

Of course, I ran into almost every issue described in the link above.  Having not worked with Office Automation in years, I was impressed with the “SaveAsWeb” functionality supported across most Office applications.  About an hour into this project, I threw caution to the wind (and proper OOP practices) and ended up with a converter class (OfficeHTMLConverter) that is capable of converting Excel, PowerPoint, Visio, and Word files to HTML web pages. 

The OfficeToHTMLWeb project is the host for this class and employs a MasterPage of which handles document uploading, conversion, and a few other extras such as Page Trending and a Personal Notepad per each page.  The Page Trends are displayed only on the Home Page, and the Personal Notepad feature only works if one is logged in.  However, each page hosts an Uploaded Documents section in its footer.   Rather than bothering with a Database I opted to use local XML datasets to track data.  These datasets are managed via my BusinessObjectFramework DLL of which I’ve included in the Solution.  Sorry, I cannot release the source code for this framework.  However, you are  welcome to use this DLL in your own projects.   I have included a SampleBusinessObject Project demonstrating its use, although the web application only uses the BusinessObjectFramework helper functions.

Solution and Project Structure

The Visual Studio 2012 Solution and Project structure is shown below, along with a few points of interest.

Sample Image

Office Document Uploading and HTML Coversion

Any web page of which is based on the MasterPage will render an Uploaded Documents section in the footer of the page. Any Microsoft Office Power Point, Excel, Visio, or Word document can be uploaded. Upon upload, the Office document is converted to HTML via the OfficeHTMLConverter.Converter class.

Sample Image

Simply upload a PowerPoint, Excel, Visio, or Word document and a link will be created on the page in which it was submitted.

Sample Image

All uploaded document links feature a JavaScript preview window…

Sample Image

And, the link itself is opened in a separate page after clicking…

Sample Image

Points of Interest

Rather than boring you with the technical details, I will leave this fully functional, license free solution with you to investigate.  Most of the heavy lifting occurs in Site.Master.cs. The BusinesObjectFramework.DLL provides the XML dataset read/write functionality.


  • 27 December, 2012: Initial post.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Don Ashworth
Software Developer (Senior)
United States United States
No Biography provided

Comments and Discussions

GeneralMy vote of 5 Pin
rickkwilliams9-Jan-13 5:08
Memberrickkwilliams9-Jan-13 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.