Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // load a default sample document
     if (IsPostBack != true)
     {
         TextControl1.LoadTextAsync(Server.MapPath("invoice.docx"), TXTextControl.Web.StreamType.WordprocessingML);
     }
 }
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        // 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 { }
        }
Ejemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     TextControl1.SetFileDirectoryAsync(Server.MapPath("documents"), TXTextControl.Web.FileType.Document);
 }
Ejemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     TextControl1.LoadTextAsync(Server.MapPath("documents/protected_document.docx"), TXTextControl.Web.StreamType.WordprocessingML);
 }