コード例 #1
0
ファイル: Form1.cs プロジェクト: SoloAs/DocX-BD-Trial
 private void ChooseTemplateBtn_Click(object sender, EventArgs e)
 {
     OpenTemplateDialog.ShowDialog();
     try
     {
         textOperator.FileName = OpenTemplateDialog.FileName;
         textOperator.Doc      = DocX.Load(OpenTemplateDialog.FileName);
         TemplateIsReady       = true;
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
コード例 #2
0
        private void LoadTemplateLL_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            OpenTemplateDialog.Title = "Open an existing Scan Template";

            while (OpenTemplateDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    FileInfo     OpenedFile  = new FileInfo(OpenTemplateDialog.FileName);
                    StreamReader Reader      = new StreamReader(OpenedFile.FullName);
                    string       TemplateXml = Reader.ReadToEnd();
                    Reader.Close();
                    LoadSettingsFromTemplate(TemplateXml);
                    ScanTemplateNameLbl.Text = string.Format("Loaded template file - {0}", OpenedFile.Name);
                    break;
                }
                catch (Exception Exp)
                {
                    MessageBox.Show(string.Format("Unable to open file: {0}", new object[] { Exp.Message }));
                }
            }
        }