public ActionResult RichEditCustomPartial(int?position) { ViewData["RTF"] = rtf; if (position != null) { MemoryStream memoryStream = new MemoryStream(); RichEditExtension.SaveCopy("RichEdit", memoryStream, DocumentFormat.Rtf); memoryStream.Position = 0; var server = new RichEditDocumentServer(); server.LoadDocument(memoryStream, DocumentFormat.Rtf); var pos = server.Document.CreatePosition(position.Value); server.Document.InsertRtfText(pos, rtf); memoryStream = new MemoryStream(); server.SaveDocument(memoryStream, DocumentFormat.Rtf); var model = new RichEditData { DocumentId = Guid.NewGuid().ToString(), Document = memoryStream.ToArray(), DocumentFormat = DocumentFormat.Rtf }; return(PartialView("_RichEditPartial", model)); } return(PartialView("_RichEditPartial")); }
public ActionResult Index() { var model = new RichEditData() { DocumentId = Guid.NewGuid().ToString(), DocumentFormat = DocumentFormat.Rtf, Document = System.Text.Encoding.Default.GetString(DataHelper.GetDocument()) }; return(View(model)); }
public ActionResult RichEditPartial() { var model = new RichEditData() { DocumentId = Guid.NewGuid().ToString(), DocumentFormat = DocumentFormat.Rtf, Document = DataHelper.GetDocument() }; return(PartialView(model)); }