Esempio n. 1
0
        private void Select_Click(object sender, EventArgs e)
        {
            FileDownloadClient client = new FileDownloadClient();
            string             ext    = "";

            Common.Models.Forms.Form     model;
            Common.Models.Matters.Matter matter;

            model  = (Common.Models.Forms.Form)FormResults.SelectedItem;
            matter = (Common.Models.Matters.Matter)MatterResults.SelectedItem;

            if (Path.HasExtension(model.Path))
            {
                ext = Path.GetExtension(model.Path);
            }

            // Save To
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.FileName        = DateTime.Now.ToString("yyyy-MM-dd") + " " + model.Title + ext;
            dialog.Filter          = "Word (*.docx,*.doc)|*.docx;*.doc|All files (*.*)|*.*";
            dialog.OverwritePrompt = true;
            DialogResult dr = dialog.ShowDialog();

            // Download
            if (dr == DialogResult.OK)
            {
                FileDownloadClient.DownloadFile(Globals.ThisAddIn.Settings.ServerUrl +
                                                "JsonInterface/DownloadForm/" + model.Id.Value, dialog.OpenFile());

                // Open
                Microsoft.Office.Interop.Word.Document doc = Globals.ThisAddIn.Application.Documents.Open(dialog.FileName);


                // Fill
                Microsoft.Office.Core.COMAddIn addin = doc.Application.COMAddIns.Item(@"OpenLawOffice.Word");

                IAddInUtilities utils = (IAddInUtilities)addin.Object;

                utils.DownloadFormDataForMatter(matter.Id.Value);
            }
        }
Esempio n. 2
0
        private void GenerateButton_Click(object sender, RibbonControlEventArgs e)
        {
            FileDownloadClient client = new FileDownloadClient();
            string ext = "";
            Common.Models.Forms.Form model;
            Common.Models.Matters.Matter matter;

            model = (Common.Models.Forms.Form)FormSelector.SelectedItem.Tag;

            if (Path.HasExtension(model.Path))
                ext = Path.GetExtension(model.Path);

            // Save To
            SaveFileDialog dialog = new SaveFileDialog();
            dialog.FileName = DateTime.Now.ToString("yyyy-MM-dd") + " " + model.Title + ext;
            dialog.Filter = "Word (*.docx,*.doc)|*.docx;*.doc|All files (*.*)|*.*";
            dialog.OverwritePrompt = true;
            DialogResult dr = dialog.ShowDialog();

            // Download
            if (dr == DialogResult.OK)
            {
                FileDownloadClient.DownloadFile(Globals.ThisAddIn.Settings.ServerUrl +
                    "JsonInterface/DownloadForm/" + model.Id.Value, dialog.OpenFile());

                // Open
                Microsoft.Office.Interop.Word.Document doc = Globals.ThisAddIn.Application.Documents.Open(dialog.FileName);


                // Fill
                Microsoft.Office.Core.COMAddIn addin = doc.Application.COMAddIns.Item(@"OpenLawOffice.Word");

                IAddInUtilities utils = (IAddInUtilities)addin.Object;

                utils.DownloadFormDataForMatter(Globals.ThisAddIn.ActiveMatter.Id.Value);
            }
        }