Ejemplo n.º 1
0
 public void InitForm()
 {
     RichTextBoxEx.Visible     = true;
     WinWordControlEx.Visible  = false;
     WinExcelControlEx.Visible = false;
     if (flag)
     {
         TbxTitle.Text          = template.Title;
         TbxKey.Text            = template.Key;
         CbxState.SelectedIndex = template.State;
         if (template.Type == Framework.Entity.Template.RTF)
         {
             RichTextBoxEx.Visible     = true;
             WinWordControlEx.Visible  = false;
             WinExcelControlEx.Visible = false;
             RichTextBoxEx.SetContent(System.Text.Encoding.Default.GetString(template.Content));
         }
         else if (template.Type == Framework.Entity.Template.DOC)
         {
             RichTextBoxEx.Visible     = false;
             WinWordControlEx.Visible  = true;
             WinExcelControlEx.Visible = false;
             path = WinWordControlEx.RandomPath;
             WinWordControlEx.SetWordStream(template.Content, path);
         }
         else
         {
             RichTextBoxEx.Visible     = false;
             WinWordControlEx.Visible  = false;
             WinExcelControlEx.Visible = true;
             path = WinExcelControlEx.RandomPath;
             WinExcelControlEx.ShowExcel(template.Content, path);
         }
     }
 }
Ejemplo n.º 2
0
 public FrmExcel(Framework.Entity.Chapter chapter)
 {
     InitializeComponent();
     System.Reflection.Assembly   ass          = System.Reflection.Assembly.LoadFrom(System.Windows.Forms.Application.ExecutablePath.Replace("\\" + System.Windows.Forms.Application.StartupPath, ""));
     System.Collections.ArrayList templateList = contentService.GetContentTemplateByTitle(chapter.Title);
     Framework.Entity.Template    template     = (Framework.Entity.Template)templateList[0];
     WinExcelControlEx.ShowExcel(template.Content, WinExcelControlEx.RandomPath);
 }
Ejemplo n.º 3
0
 private void BtnImportExcel_Click(object sender, System.EventArgs e)
 {
     System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
     openFileDialog.FileName = "Excel文档";
     openFileDialog.Filter   = "Excel文档(*.xls)|*.xls";
     if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         RichTextBoxEx.Visible     = false;
         WinWordControlEx.Visible  = false;
         WinExcelControlEx.Visible = true;
         path = openFileDialog.FileName;
         WinExcelControlEx.ShowExcel(path);
     }
 }