コード例 #1
0
 public void checkin(PowerPoint.Presentation presentationDocument)
 {
     try
     {
         if (MessageBox.Show(resources.GetString("sure_check_in"), resources.GetString("checkin"), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
         {
             String localFileName = presentationDocument.FullName;
             presentationDocument.Save(); // save document
             presentationDocument.Close(); // close document
             docXML.refresh(); // Refresh document list
             if (docXML.isOpenKMDocument(localFileName))
             {
                 OKMDocument oKMDocument = docXML.getOpenKMDocument(localFileName);
                 docXML.remove(oKMDocument);
                 DocumentLogic.checkin(oKMDocument, configXML.getHost(), configXML.getUser(), configXML.getPassword());
                 if (File.Exists(localFileName))
                 {
                     File.Delete(localFileName);
                 }
             }
         }
     }
     catch (Exception e)
     {
         String errorMsg = "OpenKMPowerPointAddIn - (checkinButton_Click)\n" + e.Message + "\n\n" + e.StackTrace;
         MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
コード例 #2
0
ファイル: PowerPointCov.cs プロジェクト: Centny/cswf.doc
 public static PowerPoint Dequeue(string src)
 {
     PowerPoint app;
     if (Cached.TryDequeue(out app))
     {
         try
         {
             app.Doc = app.App.Presentations.Open(src, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
         }
         catch (Exception e)
         {
             Cached.Enqueue(app);
             throw e;
         }
         return app;
     }
     try
     {
         //ProcKiller.Shared.Lock();
         app = new PowerPoint(new Application());
         //app.App.Visible = MsoTriState.msoTrue;
         app.Doc = app.App.Presentations.Open(src, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
         app.Pid = CovProc.GetWindowThreadProcessId(app.App.HWND);
         ProcKiller.MarkUsed(app.Pid);
         //ProcKiller.AddRunning(app.Pid);
         //ProcKiller.Shared.Unlock();
     }
     catch (Exception e)
     {
         //ProcKiller.Shared.Unlock();
         throw e;
     }
     return app;
 }
コード例 #3
0
        public PPTViewModel(PowerPoint ppt, TreeViewItemViewModel tvivm)
            : base(tvivm, false)
        {
            this.ppt = ppt;

            this.Image = AppDomain.CurrentDomain.BaseDirectory + @"Resource\Ppt.png";

            ToolTip = ppt.Name;
        }
コード例 #4
0
        static void Main(string[] args)
        {
            //test exportExcel
            // Excel exportExcel = new Excel();
            // exportExcel.exportExcel();

            //test exportWord
            //Word exportWord = new Word();
            // exportWord.exportWord();

            //test exportPPT
            PowerPoint exportPPT = new PowerPoint();

            exportPPT.exportPPT();
        }
コード例 #5
0
ファイル: PowerPointCov.cs プロジェクト: Centny/cswf.doc
        public static void Enqueue(PowerPoint app)
        {
            try
            {
                if (app.Doc != null)
                {
                    app.Doc.Close();
                }
                app.Doc = null;
                Cached.Enqueue(app);
                ProcKiller.MarkDone(app.Pid);
            }
            catch (Exception e)
            {
                L.W(e, "Close PowerPoint fail with error->", e.Message);
            }

        }
コード例 #6
0
        private void btnAddPpt_Click(object sender, RoutedEventArgs e)
        {
            bool?ret = IsVideo(this.lbSelectedFiles.SelectedItem);

            if (ret != null && !ret.Value && !(this.lbSelectedFiles.SelectedItem is ViewModel.PPTViewModel))
            {
                int index = this.lbSelectedFiles.SelectedIndex;

                Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog()
                {
                    Filter       = "PowerPoint Document (*.PPT)|*.ppt",
                    AddExtension = true,
                    Multiselect  = true,
                };

                if (openFileDialog.ShowDialog().Value)
                {
                    foreach (string strPptFile in openFileDialog.FileNames)
                    {
                        // 11-30-2011 Scott
                        foreach (Object obj in this.lbSelectedFiles.Items)
                        {
                            if (obj is PPTViewModel && strPptFile == (obj as PPTViewModel).PptPath)
                            {
                                return;
                            }
                        }
                        // end

                        PowerPoint ppt = new PowerPoint(strPptFile);

                        PPTViewModel pptVM = new PPTViewModel(ppt, null);

                        this.lbSelectedFiles.Items.Insert(index + 1, pptVM);
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select a play or formation to add ppts");
            }
        }
コード例 #7
0
 public void PowerPointPart()
 {
     CommonPart(PowerPoint.Open(), MethodBase.GetCurrentMethod());
 }
コード例 #8
0
 public void PowerPointPart()
 {
     CommonPart(PowerPoint.Open(), CatchCurrentMethod());
 }
コード例 #9
0
        private async Task PowerPointImporter(string filepath, bool append, bool split)
        {
            string outpath;

            using (var powerpoint = new PowerPoint())
            {
                outpath = powerpoint.ConvertFileToImages(filepath);
            }

            if (outpath == null)
            {
                logger.WriteLine($"failed to create output path");
                return;
            }

            if (split)
            {
                using (var one = new OneNote())
                {
                    var section = await one.CreateSection(Path.GetFileNameWithoutExtension(filepath));

                    var sectionId = section.Attribute("ID").Value;
                    var ns        = one.GetNamespace(section);

                    await one.NavigateTo(sectionId);

                    int i = 1;
                    foreach (var file in Directory.GetFiles(outpath, "*.jpg"))
                    {
                        one.CreatePage(sectionId, out var pageId);
                        var page = one.GetPage(pageId);
                        page.Title = $"Slide {i}";
                        var container = page.EnsureContentContainer();

                        LoadImage(container, ns, file);

                        await one.Update(page);

                        i++;
                    }

                    logger.WriteLine("created section");
                }
            }
            else
            {
                using (var one = new OneNote())
                {
                    Page page;
                    if (append)
                    {
                        page = one.GetPage();
                    }
                    else
                    {
                        one.CreatePage(one.CurrentSectionId, out var pageId);
                        page       = one.GetPage(pageId);
                        page.Title = Path.GetFileName(filepath);
                    }

                    var container = page.EnsureContentContainer();

                    foreach (var file in Directory.GetFiles(outpath, "*.jpg"))
                    {
                        using (var image = Image.FromFile(file))
                        {
                            LoadImage(container, page.Namespace, file);
                        }
                    }

                    await one.Update(page);

                    if (!append)
                    {
                        await one.NavigateTo(page.PageId);
                    }
                }
            }

            try
            {
                Directory.Delete(outpath, true);
            }
            catch (Exception exc)
            {
                logger.WriteLine($"error cleaning up {outpath}", exc);
            }
        }
コード例 #10
0
        public static string ParseSync(FileInfo file)
        {
            string text = null;

            try
            {
                FileStream fileStream = file.OpenRead();

                if (file.Extension.ToLower().EndsWith("docx"))
                {
                    text = Word.Parse(fileStream);
                }
                else if (file.Extension.ToLower().EndsWith("doc"))
                {
                    text = OldWord.Parse(fileStream);
                }
                else if (file.Extension.ToLower().EndsWith("txt") || file.Extension.ToLower().EndsWith("csv") || file.Extension.ToLower().EndsWith("htm") || file.Extension.ToLower().EndsWith("html"))
                {
                    StreamReader sr = new StreamReader(fileStream, Encoding.UTF8);
                    return(sr.ReadToEnd());
                }
                else if (file.Extension.ToLower().EndsWith("xlsx"))
                {
                    text = Excel.Parse(fileStream);
                }
                else if (file.Extension.ToLower().EndsWith("xls"))
                {
                    text = OldExcel.Parse(fileStream);
                }
                else if (file.Extension.ToLower().EndsWith("eml") || file.Extension.ToLower().EndsWith("msg"))
                {
                    text = Outlook.Parse(fileStream);
                }
                else if (file.Extension.ToLower().EndsWith("pptx"))
                {
                    text = PowerPoint.Parse(fileStream);
                }
                else if (file.Extension.ToLower().EndsWith("pdf"))
                {
                    text = Pdf.Parse(fileStream);
                }

                if (text != null && text != "")
                {
                    text += " " + file.FullName;
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to start Parser for: " + file.FullName);
                Counter.Add("failed_to_open", 1);
                return(null);
            }

            if (text.Length == 0)
            {
                Counter.Add("empty_file", 1);
            }

            return(text);
        }
コード例 #11
0
ファイル: TouchManager.cs プロジェクト: Cestt/Swarmpositorio
	/// <param name="powerPoint">Power point.</param>
	public void UnitToPowerPoint(PowerPoint powerPoint){
		Hero hero = (Hero) selected;
		hero.ConquestPowerPoint (powerPoint);
	}
コード例 #12
0
ファイル: Unit.cs プロジェクト: Cestt/Swarmpositorio
	public void DeletePowerPoint(){
		powerPoint = null;
	}
コード例 #13
0
ファイル: Unit.cs プロジェクト: Cestt/Swarmpositorio
	public void ConquestPowerPoint(PowerPoint _powerPoint){
		powerPoint = _powerPoint;
	}
コード例 #14
0
        public void SetPresentation()
        {
            lbSelectedFiles.Items.Clear();

            foreach (PresentationPlay pPlay in Presentation.Plays)
            {
                string strStandardFilePath = new System.IO.FileInfo(pPlay.PlayPath).FullName;

                if (strStandardFilePath.EndsWith(".Ttl", true, null))
                {
                    Title title = new Title(strStandardFilePath);

                    TitleViewModel tvm = new TitleViewModel(title, null);

                    lbSelectedFiles.Items.Add(tvm);
                }
                else
                {
                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Offensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Offensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Offensive"))
                    {
                        Formation formation = new Formation(strStandardFilePath);

                        FormationViewModel fvm = new FormationViewModel(formation, null);

                        lbSelectedFiles.Items.Add(fvm);
                    }

                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Defensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Defensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Defensive"))
                    {
                        Formation formation = new Formation(strStandardFilePath);

                        FormationViewModel fvm = new FormationViewModel(formation, null);

                        lbSelectedFiles.Items.Add(fvm);
                    }

                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Kicks") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Kicks") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Kicks"))
                    {
                        Formation formation = new Formation(strStandardFilePath);

                        FormationViewModel fvm = new FormationViewModel(formation, null);

                        lbSelectedFiles.Items.Add(fvm);
                    }

                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Playbook") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Playbook") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Playbook"))
                    {
                        Play play = new Play(strStandardFilePath);

                        PlayViewModel pvm = new PlayViewModel(play, null);

                        lbSelectedFiles.Items.Add(pvm);
                    }
                }

                foreach (Object objVideo in pPlay.Videos)
                {
                    if (objVideo.ToString().EndsWith(".ppt", true, null))
                    {
                        PowerPoint ppt = new PowerPoint(objVideo.ToString());

                        PPTViewModel pptVM = new PPTViewModel(ppt, null);

                        lbSelectedFiles.Items.Add(pptVM);
                    }
                    else
                    {
                        VideoCoachingPointInfo vcpi = null;

                        if (!(objVideo is VideoCoachingPointInfo))
                        {
                            vcpi = new VideoCoachingPointInfo(objVideo.ToString());
                        }
                        else
                        {
                            vcpi = objVideo as VideoCoachingPointInfo;
                        }

                        VideoViewModel vvm = new VideoViewModel(vcpi, null);

                        this.lbSelectedFiles.Items.Add(vvm);
                    }
                }
            }
        }
コード例 #15
0
 // Show tree form
 public void showTreeForm(PowerPoint.Presentation presentation)
 {
     try
     {
         presentation.Save(); // Saves the document
         if (treeForm == null)
         {
             treeForm = new TreeForm(presentation.FullName, configXML);
         }
         else
         {
             treeForm.setApplication(presentation.FullName);
         }
         treeForm.Show();
         treeForm.startUp();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #16
0
 // Show explorer form
 public void showExplorerForm(PowerPoint.Presentations presentations)
 {
     try
     {
         if (explorerForm == null)
         {
             explorerForm = new ExplorerForm(presentations, OKMDocumentType.TYPE_POWER_POINT, configXML, docXML);
         }
         explorerForm.Show();
         explorerForm.startUp();
     }
     catch (Exception e)
     {
         throw e;
     }
 }