コード例 #1
0
ファイル: Utils.cs プロジェクト: DR2010/FCM2
        ///// <summary>
        ///// Open document for Document type
        ///// </summary>
        ///// <param name="document"></param>
        //public static void OpenDocument(Document.Document document, object vkReadOnly)
        //{
        //    if (document.DocumentType == Utils.DocumentType.WORD)
        //    {
        //        string filePathName =
        //            Utils.getFilePathName(document.Location,
        //                                  document.Name );

        //        WordDocumentTasks.OpenDocument(filePathName, vkReadOnly);
        //    }

        //}

        // Open document for Location and Name
        //
        public static ResponseStatus OpenDocument(string Location, string Name, string Type, object vkReadOnly, bool isFromWeb)
        {
            if (Type == DocumentType.WORD)
            {
                string filePathName =
                    getFilePathName(Location,
                                    Name);

                var response = WordDocumentTasks.OpenDocument(filePathName, vkReadOnly, isFromWeb);

                if (response.ReturnCode < 1)
                {
                    return(response);
                }
            }

            if (Type == DocumentType.EXCEL)
            {
                string filePathName =
                    getFilePathName(Location,
                                    Name);

                var response = ExcelSpreadsheetTasks.OpenDocument(filePathName);
                if (response.ReturnCode < 1)
                {
                    return(response);
                }
            }
            if (Type == DocumentType.PDF)
            {
                string filePathName =
                    getFilePathName(Location,
                                    Name);
                Process proc  = new Process();
                var     adobe = CodeValue.GetCodeValueExtended(iCodeType: MakConstant.CodeTypeString.SYSTSET, iCodeValueID: "PDFEXEPATH");

                if (!File.Exists(adobe))
                {
                    MessageBox.Show("I can't find Adobe Reader. Please configure SYSTSET.PDFEXTPATH.");

                    var error = new ResponseStatus(MessageType.Error);
                    error.Message = "Adobe Reader can't be found. Please configure SYSTSET.PDFEXTPATH.";
                    return(error);
                }

                proc.StartInfo.FileName  = adobe;
                proc.StartInfo.Arguments = filePathName;
                proc.Start();
            }

            return(new ResponseStatus(MessageType.Informational));
        }
コード例 #2
0
        // Open document for Location and Name
        //
        public static void OpenDocument(string Location, string Name, string Type, object vkReadOnly, bool isFromWeb = false)
        {
            if (Type == MackkadoITFramework.Helper.Utils.DocumentType.WORD)
            {
                string filePathName =
                    Utils.getFilePathName(Location,
                                          Name);

                WordDocumentTasks.OpenDocument(filePathName, vkReadOnly, isFromWeb);
            }

            if (Type == MackkadoITFramework.Helper.Utils.DocumentType.EXCEL)
            {
                string filePathName =
                    Utils.getFilePathName(Location,
                                          Name);

                var Response = ExcelSpreadsheetTasks.OpenDocument(filePathName);
                if (Response.ReturnCode < 1)
                {
                    MessageBox.Show(Response.Message);
                }
            }
            if (Type == MackkadoITFramework.Helper.Utils.DocumentType.PDF)
            {
                string filePathName =
                    Utils.getFilePathName(Location,
                                          Name);
                System.Diagnostics.Process proc = new System.Diagnostics.Process();
                var adobe = CodeValue.GetCodeValueExtended(iCodeType: FCMConstant.CodeTypeString.SYSTSET, iCodeValueID: "PDFEXEPATH");

                if (!File.Exists(adobe))
                {
                    MessageBox.Show("I can't find Adobe Reader. Please configure SYSTSET.PDFEXTPATH.");
                    return;
                }

                proc.StartInfo.FileName  = adobe;
                proc.StartInfo.Arguments = filePathName;
                proc.Start();
            }
        }