protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) { List <MergeBlock> blocks; using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) { tx.Create(); byte[] data = null; TextControl1.SaveText(out data, TXTextControl.Web.BinaryStreamType.InternalUnicodeFormat); tx.Load(data, TXTextControl.BinaryStreamType.InternalUnicodeFormat); blocks = MergeBlock.GetMergeBlocksFlattened(tx); } // select the selected block in the TextControl.Web foreach (MergeBlock block in blocks) { if (block.Name == TreeView1.SelectedValue) { TextControl1.Selection = new TXTextControl.Web.Selection(block.StartMarker.Start, block.Length); break; } } }
protected void dummyButton_Click(object sender, EventArgs e) { byte[] data; TextControl1.SaveText(out data, TXTextControl.Web.BinaryStreamType.InternalUnicodeFormat); ScriptManager.RegisterClientScriptBlock( this.Page, this.Page.GetType(), "alert", "alert('Successfully saved.');", true); }
protected void Button1_Click(object sender, EventArgs e) { string data; // save the document to a string variable TextControl1.SaveText(out data, TXTextControl.Web.StringStreamType.RichTextFormat); System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('Your document has been saved.');", true); }
protected void btnStore_Click(object sender, EventArgs e) { // save the document and store in a hidden field // as a Base64 encoded string byte[] data; TextControl1.SaveText(out data, TXTextControl.Web.BinaryStreamType.InternalUnicodeFormat); hiddenDocument.Value = Convert.ToBase64String(data); // call the 'storeDocument()' JS function System.Web.UI.ScriptManager.RegisterClientScriptBlock( this, this.GetType(), "CallStoreDocument", "storeDocument();", true); }
protected void dummyButton_Click(object sender, EventArgs e) { // save the document as PDF in a session variable byte[] data; TextControl1.SaveText(out data, TXTextControl.Web.BinaryStreamType.AdobePDF); Session["document"] = data; // create a new IFRAME and call this ASPX with QueryString // to load document from session data ScriptManager.RegisterClientScriptBlock( this.Page, this.Page.GetType(), "alert", "var iframe = document.createElement('iframe');iframe.src = 'index.aspx?download=1';iframe.style.display = 'none';document.body.appendChild(iframe);", true); }
// read all blocks from the current document and fill the TreeView private void updateNavigationPanel() { List <MergeBlock> blocks; try { using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) { tx.Create(); byte[] data = null; TextControl1.SaveText(out data, TXTextControl.Web.BinaryStreamType.InternalUnicodeFormat); tx.Load(data, TXTextControl.BinaryStreamType.InternalUnicodeFormat); blocks = MergeBlock.GetMergeBlocks(MergeBlock.GetBlockMarkersOrdered(tx), tx); } TreeView1.Nodes.Clear(); fillTreeView(blocks); TreeView1.ExpandAll(); } catch { } }