Exemplo n.º 1
0
 protected void ImportDocx_Click(object sender, EventArgs e)
 {
     using (Stream docxStream = docxUpload.UploadedFiles[0].InputStream)
     {
         RadEditor1.LoadDocxContent(docxStream);
     }
 }
Exemplo n.º 2
0
        protected void saveBtn_Click(object sender, EventArgs e)
        {
            using (Stream docxStream = docxUpload.UploadedFiles[0].InputStream)
            {
                RadEditor1.LoadDocxContent(docxStream);
            }
            RadEditor1.ExportToDocx();

            populate();
        }
Exemplo n.º 3
0
 protected void ExportToDOCX_Click(object sender, EventArgs e)
 {
     try
     {
         RadEditor1.ExportToDocx();
     }
     catch (Exception ex)
     {
         ExportErrorLog.Text = "Exception: " + ex.Message;
     }
 }
Exemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         using (FileStream initialFileStream = new FileStream(Server.MapPath("~/App_Data/" + Request.QueryString["TopicsFile"].ToString()), FileMode.Open, FileAccess.Read))
         {
             RadEditor1.LoadDocxContent(initialFileStream);
         }
         //RadEditor1.Enabled = false;
     }
 }
Exemplo n.º 5
0
        protected void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
        {
            //the maximum allowed file inputs is one, so there should be no multiple files uploaded

            //see what is the uploaded file extension and attempt to import it accordingly
            try
            {
                string fileExt = e.File.GetExtension();
                switch (fileExt)
                {
                case ".doc":
                case ".docx":
                    RadEditor1.LoadDocxContent(e.File.InputStream);
                    break;

                case ".rtf":
                    RadEditor1.LoadRtfContent(e.File.InputStream);
                    break;

                case ".txt":
                case ".html":
                case ".htm":
                    using (StreamReader sr = new StreamReader(e.File.InputStream))
                    {
                        RadEditor1.Content = sr.ReadToEnd();
                    }
                    break;

                case ".md":
                    using (StreamReader sr = new StreamReader(e.File.InputStream))
                    {
                        RadEditor1.Content = sr.ReadToEnd();
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "importMarkdownScript", "TelerikDemo.setMarkdownContent();", true);
                    }
                    break;

                default:
                    RadNotification1.Show("The selected file is invalid. Please upload an MS Word document with an extension .doc, .docx or .rtf, or a .txt/.html file with HTML content!");
                    break;
                }
            }
            catch (Exception ex)
            {
                RadNotification1.Show("There was an error during the import operation. Try simplifying the content.");
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RadEditor1.Content = @"Contexts{#C_年龄_Age#}dfdsfdssfsdfs{#C_姓名_Name#}dkjfsfjsdkfjksdljffffffffffffffffffff<table style='width: 842px; height: 44px;'><colgroup><col /><col /><col /><col /></colgroup><tbody><tr><td>&nbsp;[#T_英语_Score_English#]</td><td>[#T_数学_Score_Math#]&nbsp;</td><td>&nbsp;[#T_语文_Score_Chinese#]</td><td>[#T_体育_Score_Sport#]&nbsp;</td></tr></tbody></table>fffffffffkskldf";
                RadEditor1.DisableFilter(EditorFilters.IndentHTMLContent);
            }

            //select the Home tab by default
            RadEditor1.RibbonBar.SelectedTabIndex = 1;
            //handle postbacks from the export commands
            try
            {
                string evtArg = Request["__EVENTARGUMENT"];
                switch (evtArg)
                {
                case "SaveAsDocx":
                    RadEditor1.ExportToDocx();
                    break;

                case "SaveAsRtf":
                    RadEditor1.ExportToRtf();
                    break;

                case "SaveAsPDF":
                    RadEditor1.ExportToPdf();
                    break;

                case "SaveAsMarkdown":
                    RadEditor1.ExportToMarkdown();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                RadNotification1.Show("There was an error during the export operation. Try simplifying the content and removing images/lists.");
            }
        }
Exemplo n.º 7
0
 protected void ExportToDOCX_Click(object sender, EventArgs e)
 {
     RadEditor1.ExportToDocx();
 }