Add Controls to a Project
Rich Text Editor
You can add a Rich Text Editor to a Razor file (.cshtml) as shown below.
@Html.DevExpress().RichEdit("richEdit")
Use the HTML helper’s fluent API to configure the control:
@(Html.DevExpress().RichEdit("richEdit")
.Width("100%")
.Height(800)
.ExportUrl(Url.Action("Export"))
.AutoCorrect(a => a
.CorrectTwoInitialCapitals(true)
.ReplaceTextAsYouType(true)
.ReplaceInfoCollectionSettings(s => {
s.CaseSensitive(true);
s.ReplaceInfoCollection(c => {
c.Add().What("(c)").With("©");
c.Add().What("wnwd").With("well-nourished, well-developed");
});
})
)
.Bookmarks(b => b
.Visibility(DevExpress.AspNetCore.RichEdit.Visibility.Visible)
.Color(System.Drawing.Color.Blue)
)
.Ribbon(ribbon => ribbon
.ActiveTabIndex(0)
)
.Open("Documents/Example.docx")
)
Spreadsheet
Follow the steps below to add a Spreadsheet to a web page:
- Create a new controller or open an existing controller (for example, the HomeController.cs file), and add an action that handles document commands as shown below:
using DevExpress.AspNetCore.Spreadsheet;
...
public class HomeController : Controller
{
[HttpPost]
[HttpGet]
public IActionResult DxDocRequest() {
return SpreadsheetRequestProcessor.GetResponse(HttpContext);
}
/// ...
}
- Use the Spreadsheet helper to add a spreadsheet to a Razor file (.cshtml):
@(Html.DevExpress()
.Spreadsheet("spreadsheet")
.DocumentRequestHandlerUrl(Url.Action("DxDocRequest")))