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:
The night prior to discovering the Excel Automation craziness alluded to above, I read Scott Berkun’s
- 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
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
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.
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
Simply upload a PowerPoint, Excel, Visio, or
Word document and a link will be created on the page in which it was submitted.
And, the link itself is opened in a separate page
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.