Guide for C#
Core Document Formats
HTML5 Web Viewer
Additional Features

C# Excel - Web Document Viewer for Excel

Web Document Viewer for Viewing and Manipulating Excel Document Online

Visual C#
Home > .NET Imaging SDK > C# > Create C# Excel Web Viewer
If this is your first time to use our DocImageSDK, we strongly suggest you reading How to Start first!

.NET Web Document Viewer DLL is one of core DLLs of DocImage SDK for .NET. Definitely, it is easy to integrate into your own ASP.NET project and enables C#.NET programmers to create Web document viewer to load, view, annotate, convert and save Excel (.xlsx) document at fast speed. If you want to use this mature DLL assembly for commercial use, you should make an order for .NET Core SDK license(s).
Related .net document control helps: pdf editor: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents mvc pdf editor: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC document viewer c#: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer... sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint text file viewer: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET word document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications document viewer: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
It's easy to create Web Excel Document Viewer in Visual C#.NET application. On this page, step-by-step tutorial will be illustrated. At the very beginning, please make sure your .NET Framework is 2.0, 3.0,3.5, 4.0, or 4.5 version. Also, Visual Studio should be 2005 or later versions. Now, let's firstly look at the main fetures of RasterEdge.Imaging.WebViewer.dll.
.NET Web Document Viewer for Excel - Main Features
  • Advanced Excel document viewing solution, fully wirtten in managed ASP.NET and C# codes
  • Use latest HTML5 technology and is based on JavaScript
  • Compativle with most commonly used web browsers, like FireFox, Chrome, Safari, IE, etc.
  • High fidelity transform of web Excel document to raster images and vector image and display image(s) to view
  • Support adding text and graphics annotations on Excel spreadsheet in C#.NET web document viewer
  • Support saving modified Excel document PDF and TIFF files within C#.NET web program
If you want to have a quick evaluation for web document viewer, please see online demo here.
.NET Web Document Viewer for Excel - Creation in C#
This section illustrates how to set up a web page in C#.NET project, containing an embedded Web Excel Document Viewer. In all, it includes setting up your ASP.NET website and adding Excel Document Viewer into your ASPX web page.
  1. Create a new website or open your existing one;
  2. Add a new reference "RasterEdge.Imaging.WebViewer.dll" to your C#.NET web project and other dependencies will be included in the project automatically;
  3. Copy the content of Web.config in DocImage SDK for .NET package to your configuration file (Web.config);
  4. Copy Web Excel Document Viewer resources to the root of your C#.NET web project, which include "RasterEdge_Imaging_Files", "RasterEdge_Demo_Docs" and "RasterEdge_Cache";
  5. Add a new Web Form (Default.aspx) to your C#.NET web project;
  6. Copy Visual C# code to the head of Default.aspx to load the necessary resources for creating web Excel document viewer objects and initializing the viewer;
<link href="RasterEdge_Imaging_Files/RasterEdge.css" rel="stylesheet"type="text/css"/>
<script src="RasterEdge_Imaging_Files/RasterEdge.js" type="text/javascript"></script>
<script src="RasterEdge_Imaging_Files/CreateViewerToolBar.js" type="text/javascript"></script>
<script type="text/javascript">
_fid = "<%=fid %>";
_viewer = new RasterEdgeViewer({
_serverUrl: "/RasterEdge_Imaging_Files/WebHandler.ashx",
//0 represent png, 1 represent svg
_pdfViewer: 1,
_wordViewer: 1,

//Set width and height of the webViewer(pixel)
_viewerWidth: 1024,
_viewerHeight: 730,

//define annotation style
//annotation style
//Color:Hexadecimal color can be used
//Transparency:1 on behalf of saturated, 0 represents completely transparent
TextAnnoStyle = new AnnoStyle({FillColor: "White", ShowedText: "double click to edit", TextColor: "Black", TextFont: "Arial", TextSize: 12, TextStyle :"normal"});
FreehandAnnoStyle = new AnnoStyle({OutLineColor: "Red", OutLineWidth: 5.0});
HighlightAnnoStyle = new AnnoStyle({FillColor: "Yellow"});
RectangleAnnoStyle = new AnnoStyle({OutLineColor: "Black", OutLineWidth: 3.0});
FilledRectangleAnnoStyle = new AnnoStyle({OutLineColor: "Black", OutLineWidth: 3.0, FillColor: "Black", Transparency: 1});
EllipseAnnoStyle = new AnnoStyle({FillColor: "Orange"});
RubberStampAnnoStyle = new AnnoStyle({OutLineColor: "Tomato", OutLineWidth: 3.0, FillColor: "Red", ShowedText: "Good", TextColor: "Black", TextFont: "Arial", TextSize: 12, TextStyle: "Italic"});
PolygonLinesAnnoStyle = new AnnoStyle({OutLineColor: "Red", OutLineWidth: 5.0});
PolygonAnnoStyle = new AnnoStyle({OutLineColor: "OrangeRed", OutLineWidth: 3.0, FillColor: "OrangeRed"});
LineAnnoStyle = new AnnoStyle({OutLineColor: "Red", OutLineWidth: 5.0});
ArrowAnnoStyle = new AnnoStyle({OutLineColor: "Red", OutLineWidth: 5.0, FillColor: "Red",Transparency:0.8});

//Set whether the toolbar shows the corresponding icon(true or false)
//You can set the item including:_toolbar/_fileToolbar/_annoToolbar/_fullToolbar
//_uploadToolbar/_printToolbar/_saveToolbar/_convertToolbar //_textToolbar/_freehandToolbar/_arrowToolbar/_lineToolbar/_polygonLinesToolbar/_filledRectangleToolbar/_rectangleToolbar/_highlightToolbar/_ellipseToolbar/_polygonToolbar/_rubberStampToolbar/_deleteToolbar
  1. Copy the following HTML into your document's body to create Excel document viewing area;
<div class="re_container">
<div class = "re_func_toolbar"></div>
<div id="_tblImgs"class="re_content" style="width:100%">
<div class="RE_WebViewer" id="REWebViewer1"></div>
  1. Here are some snippets of Default.aspx. In order to use certain functions, you may select some codes below to Default.aspx.cs file in your C#.NET web project. Two methods, "OpenFile();" and "SaveFile();", allow C#.NET users to customize the way to open and store Excel files online.
public string mode;
public string fid;
protected void Page_Load(object sender, EventArgs e)
string command = Request.Form["RECommand"];
if (command == null || command.Equals(""))
else if (command.Equals("OpenFile"))
else if (command.Equals("SaveFile"))

public void LoadFileFromUrl()
string file = Request.QueryString["file"];
if (file != null &&file != "")
file = file.Trim();
string initFilePath = file;
string projectName = System.Web.HttpContext.Current.Request.PhysicalApplicationPath.Replace("\\", "/");
string path = projectName + "
/RasterEdge_Demo_Docs/" + initFilePath;
if (File.Exists(path))
fid = REDocumentControl.GenerateId();
string result = LoadFile("
RasterEdge_Demo_Docs" + initFilePath, fid);
if (result != "
", "<script>alert('" + result + "');</script>");

public void LoadFileFromUpload()
string uploadFile = Request.Form["
string filename = "
/RasterEdge_Cache/" + uploadFile;
fid = Request.Form["
string result = LoadFile(filename, fid);

//load document from stream
//REDocumentControl.LoadFile(Stream stream, fid);

//load document from array
//REDocumentControl.LoadFile(byte[] array, fid);

public void SaveFile()
string fileName = Request.Form["
string fid = Request.Form["

private string LoadFile(string filename,string fid)
string result = "
REDocumentControl.LoadFile(filename, fid);
catch (Exceptionex)
result = ex.Message.ToString();
return result;
For more Web Excel Document Viewer customization, please directly refer to developer guide in the download package.

Recommend this to Google+ is professional provider of ASP.NET MVC Document Viewer, ASP.NET PDF Viewer, MVC PDF Viewer document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2023 Raster