Guide for C# Core Document Formats HTML5 Web Viewer Additional Features
| C# Excel - Web Document Viewer for ExcelWeb Document Viewer for Viewing and Manipulating Excel Document Online
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:
asp.net pdf editor: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net mvc pdf editor: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
asp.net document viewer c#: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net text file viewer: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net word document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net 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.
- Create a new website or open your existing one;
- Add a new reference "RasterEdge.Imaging.WebViewer.dll" to your C#.NET web project and other dependencies will be included in the project automatically;
- Copy the content of Web.config in DocImage SDK for .NET package to your configuration file (Web.config);
- 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";
- Add a new Web Form (Default.aspx) to your C#.NET web project;
- 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, _excelViewer: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 //TextStyle:italic/oblique/normal 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 </script>
- 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> </div> </div>
- 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("")) { WorkRegistry.Reset(); LoadFileFromUrl(); } else if (command.Equals("OpenFile")) { LoadFileFromUpload(); } else if (command.Equals("SaveFile")) { 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 != "") this.RegisterStartupScript("", "<script>alert('" + result + "');</script>"); } } }
public void LoadFileFromUpload() { string uploadFile = Request.Form["uploadfile"]; string filename = "/RasterEdge_Cache/" + uploadFile; fid = Request.Form["Fid"]; string result = LoadFile(filename, fid); Response.Clear(); Response.Write(result); Response.End();
//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["saveFileName"]; string fid = Request.Form["Fid"]; Response.Clear(); Response.Write(fileName); Response.End(); }
private string LoadFile(string filename,string fid) { string result = ""; try { 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+
|