protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { RichEditDocumentServer server = new RichEditDocumentServer(); server.LoadDocument(Server.MapPath("~/SpellChecking.docx")); DocumentManager.CloseDocument(documentId); RichEdit.Open(documentId, DocumentFormat.OpenXml, () => server.OpenXmlBytes); } }
protected void RichEdit_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e) { string path = MapPath(UploadControl.FileSystemSettings.UploadFolder) + "\\" + e.Parameter; using (MemoryStream stream = new MemoryStream()) { using (RichEditDocumentServer server = new RichEditDocumentServer()) { server.LoadDocument(path); server.SaveDocument(stream, DocumentFormat.OpenXml); stream.Position = 0; DocumentManager.CloseDocument(uploadedDocId); RichEdit.Open(uploadedDocId, DocumentFormat.OpenXml, () => stream); } } File.Delete(path); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { using (MemoryStream stream = new MemoryStream()) { RichEditDocumentServer server = new RichEditDocumentServer(); server.CreateNewDocument(); server.Document.AppendText("Hello world!"); server.Document.Paragraphs.Append(); server.Document.AppendText("Some text..."); server.SaveDocument(stream, DocumentFormat.OpenXml); stream.Position = 0; DocumentManager.CloseDocument(documentId); RichEdit.Open(documentId, DocumentFormat.OpenXml, () => stream); } RichEdit.Focus(); } }
protected void OpenFromByteArrayBtn_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(EditedDocuemntID)) { DocumentManager.CloseDocument(DocumentManager.FindDocument(EditedDocuemntID).DocumentId); EditedDocuemntID = string.Empty; } DataView view = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); if (view.Count != 0) { EditedDocuemntID = view.Table.Rows[0]["Id"].ToString(); // Guid type } RichEdit.Open( EditedDocuemntID, DocumentFormat.Rtf, () => { return((byte[])view.Table.Rows[0]["DocBytes"]); } ); }