private void ExcuteOpenImage() { if (PPT.LastPage == 0) { OpenFileDialog openFile = new OpenFileDialog(); openFile.DefaultExt = "jpg"; openFile.Filter = "그림 파일 (*.jpg;)|*.jpg;"; openFile.ShowDialog(); if (openFile.FileName.Length > 0) { PPTManager powerPoint = new PPTManager(); byte[] byteImage = powerPoint.ConvertImageToByte(openFile.FileName); // 비동기 처리 필요 List <byte[]> bytePPT = new List <byte[]>(); bytePPT.Add(byteImage); if (bytePPT.Count > 0) { PPT.OpenPPT(bytePPT); } else { MessageBox.Show("그림을 불러오는 데 실패했습니다.", AppConst.AppName); } } } else { PPT.ResetPPT(); } }
private void ExcuteOpenPPT() { if (PPT.LastPage == 0) { OpenFileDialog openFile = new OpenFileDialog(); openFile.DefaultExt = "pptx"; openFile.Filter = "PowerPoint 프레젠테이션 (*.pptx;*.ppt)|*.pptx;*.ppt"; openFile.ShowDialog(); if (openFile.FileName.Length > 0) { PPTManager powerPoint = new PPTManager(); List <byte[]> bytePPT = powerPoint.ConvertPPT(openFile.FileName); // 비동기 처리 필요 if (bytePPT.Count > 0) { PPT.OpenPPT(bytePPT); } else { MessageBox.Show("PPT를 불러오는 데 실패했습니다.", AppConst.AppName); } } } else { PPT.ResetPPT(); } }
public void VerificaVendedorPedra() { PPT ppt = new PPT("João", "Marcos"); ppt.jogador1_material = "Pedra"; ppt.jogador2_material = "Tesoura"; Assert.Equal("João", ppt.vencedor()); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); PPT ppt = new PPT("João", "Marcos"); ppt.jogador1_material = "Papel"; ppt.jogador2_material = "Pedra"; System.Console.WriteLine(ppt.vencedor()); }
private static void SetSlideFooter(PPT.Slide slide, int slideNumber) { // Insert the textboxes var textShape1 = PptShapeManager.AddTextBoxToSlide( slide, MsoTextOrientation.msoTextOrientationHorizontal, 905f, 512f, 100f, 40f); // Set the text in the textboxes PptShapeManager.SetTextBoxText(textShape1, "slide " + slideNumber); textShape1.TextEffect.FontBold = MsoTriState.msoFalse; textShape1.TextEffect.FontSize = 14f; }
private static void Cleanup(PPT.Presentation presentation, PPT.Application powerPointApplication) { PptPresentationManager.SavePresentationAs( presentation, Environment.CurrentDirectory + ResourceFolder + OutputFile, PPT.PpSaveAsFileType.ppSaveAsOpenXMLPresentation, true); // Step 100b. Export all slides in the presentation as PNG PptSlideManager.ExportAll( presentation, Environment.CurrentDirectory + ResourceFolder, ImageFormats.Formats.png); PptPresentationManager.ClosePresentation(presentation); PptApplicationManager.ClosePowerPointApplication(powerPointApplication); }
private static void DecorateSlideFour(PPT.Slide slide) { var starShape = PptShapeManager.DrawShape(slide, MsoAutoShapeType.msoShape16pointStar, 45f, 25f, 150f, 150f); var upArrowShape = PptShapeManager.DrawShape( slide, MsoAutoShapeType.msoShapeUpArrow, 250f, 100f, 150f, 250f); var downArrowShape = PptShapeManager.DrawShape( slide, MsoAutoShapeType.msoShapeDownArrow, 500f, 100f, 150f, 250f); starShape.Fill.ForeColor.RGB = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Gold); starShape.Line.ForeColor.RGB = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Yellow); // Insert the textboxes var textShape0 = PptShapeManager.AddTextBoxToSlide( slide, MsoTextOrientation.msoTextOrientationHorizontal, 70f, 75f, 100f, 100f); var textShape1 = PptShapeManager.AddTextBoxToSlide( slide, MsoTextOrientation.msoTextOrientationHorizontal, 100f, 195f, 200f, 300f); var textShape2 = PptShapeManager.AddTextBoxToSlide( slide, MsoTextOrientation.msoTextOrientationHorizontal, 650f, 120f, 200f, 300f); // Set the text in the textboxes PptShapeManager.SetTextBoxText(textShape0, "Important" + "\nFact!"); textShape0.TextEffect.Alignment = MsoTextEffectAlignment.msoTextEffectAlignmentCentered; textShape0.Rotation = -45f; textShape0.TextFrame.TextRange.Font.Color.RGB = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red); textShape0.TextEffect.FontSize = 20f; PptShapeManager.SetTextBoxText( textShape1, "The number of C# developers has grown" + "\nby 25% over the past quarter."); textShape1.TextEffect.FontSize = 18f; PptShapeManager.SetTextBoxText( textShape2, "The number of VB.Net developers has declined" + "\nby 40% over the past quarter."); textShape2.TextEffect.FontSize = 18f; SetSlideFooter(slide, 4); }
private static void DecorateSlideThree(PPT.Slide slide) { var columnsList = new string[] { "C#", "VB.Net", "Perl", "Python", "Java" }; var series1 = new ChartSeries() { name = "Blog Statistics", seriesData = new string[] { "8200", "3900", "890", "300", "3278" }, seriesType = XlChartType.xl3DColumn }; var chartData = new List<ChartSeries>() { series1 }; var chart = PptChartManager.CreateChart(XlChartType.xlColumnStacked, slide, columnsList, chartData); var chartTitle = new ChartTitle() { bold = true, italic = false, fontSize = 40, titleText = "Users by Software Language", underline = false }; PptChartManager.AddChartTitle(chart, chartTitle); SetSlideFooter(slide, 3); }
private static void DecorateSlideTwo(PPT.Slide slide) { // Insert the textboxes var textShape1 = PptShapeManager.AddTextBoxToSlide( slide, MsoTextOrientation.msoTextOrientationHorizontal, 100f, 100f, 800f, 40f); // Set the text in the textboxes PptShapeManager.SetTextBoxText( textShape1, "This PowerPoint presentation helps to show you what you can achieve with the CodeSharper PowerPoint helper library." + "\nWe hope that you will find this library helpful." + "\nFeel free to contact email any questions to" + "\[email protected]"); textShape1.TextEffect.FontSize = 16f; SetSlideFooter(slide, 2); }
private static void DecorateSlideOne(PPT.Slide slide) { // Insert the graphic for the slide var pictureShape = PptShapeManager.AddPicture( slide, Environment.CurrentDirectory + ResourceFolder + Slide1Graphic, 100f, 220f, 200f, 200f); // Insert the textboxes var textShape1 = PptShapeManager.AddTextBoxToSlide( slide, MsoTextOrientation.msoTextOrientationHorizontal, 320f, 280f, 400f, 40f); var textShape2 = PptShapeManager.AddTextBoxToSlide( slide, MsoTextOrientation.msoTextOrientationHorizontal, 320f, 320f, 400f, 40f); // Set the text in the textboxes PptShapeManager.SetTextBoxText(textShape1, "CodeSharper PowerPoint Helper"); textShape1.TextEffect.FontBold = MsoTriState.msoTrue; textShape1.TextEffect.FontSize = 42f; PptShapeManager.SetTextBoxText(textShape2, "A Demonstration"); textShape2.TextEffect.FontBold = MsoTriState.msoTrue; textShape1.TextEffect.FontSize = 28f; SetSlideFooter(slide, 1); }
private static void DecorateSlides(PPT.Presentation pptPresentation) { DecorateSlideOne(pptPresentation.Slides[1]); DecorateSlideTwo(pptPresentation.Slides[2]); DecorateSlideThree(pptPresentation.Slides[3]); DecorateSlideFour(pptPresentation.Slides[4]); }
private void timer1_Tick(object sender, EventArgs e) { // See if background image has been changed. if (!Properties.Settings.Default.bgImage.Contains("Properties.Resources.Adelaide_Convention_Centre")) { try { BackgroundImage = new Bitmap(Properties.Settings.Default.bgImage); } catch { BackgroundImage = Properties.Resources.Adelaide_Convention_Centre; } } // If settings have been changed, make the option invisible if (Properties.Settings.Default.settingsVisible == false) { //SettingsButton.Visible = false; //disable for debugging } // If clear settings is pressed, we update the list to reflect that. if (Properties.Settings.Default.updateList == true) { PresList.Clear(); InitializeListView(); Properties.Settings.Default.updateList = false; Properties.Settings.Default.Save(); } try { //CreateSettingsCFG(); //create settings CFG if doesnt exist using (FileStream fs = new FileStream(@"settings.cfg", FileMode.Open)) { using (StreamReader reader = new StreamReader(fs, Encoding.UTF8)) { string line = null; /* ^ Start of string \d+ "\d" means "digit" - 0-9. The "+" means "one or more." So this means "one or more digits." \t This matches a tab. (\d+) This also matches one or more digits. This time, though, we capture it using brackets. This means we can access it using the Group method. \t Another tab. .+? "." means "anything." So "one or more of anything". In addition, it's lazy. This is to stop it grabbing everything in sight - it'll only grab as much as it needs to for the regex to work. \t Another tab. (item\\[^\t]+\.ddj) Here's the meat. This matches: "item\<one or more of anything but a tab>.ddj"*/ while ((line = reader.ReadLine()) != null) { editPres.Enabled = true; StartPresButton.Enabled = true; PPT Pres = new PPT(); Pres.Time = reader.ReadLine(); Pres.Day = reader.ReadLine(); Pres.Name = reader.ReadLine(); Pres.Room = reader.ReadLine(); Pres.File = reader.ReadLine(); Pres.Type = reader.ReadLine(); // Problem here is that Pres.File is actually original file location (USB for example, so we need to change that to the new file) Pres.File = Pres.Type; if (Pres.Type=="") { Pres.Type = "PowerPoint"; programtype = "ppt"; } // Add Pres to ArrayList List<PPT> presArray = new List<PPT>(); presArray.Add(Pres); // Sort file types if (Pres.Type.EndsWith(".pdf")) { Pres.Type = "Adobe Reader"; programtype = "adobe"; } if (Pres.Type.EndsWith(".ppt") || Pres.Type.EndsWith(".pptx")) { Pres.Type = "PowerPoint"; programtype = "ppt"; } if (Pres.Type.EndsWith("Prezi.exe")) { Pres.Type = "Prezi"; programtype = "prezi"; } if (Pres.Type.EndsWith(".exe")) { Pres.Type = "Executable"; programtype = "exe"; } if (Pres.Type.EndsWith(".zip") || Pres.Type.EndsWith(".rar")) { Pres.Type = "Archive"; programtype = "exe"; } if (Pres.Type.EndsWith(".txt") || Pres.Type.EndsWith(".text")) { Pres.Type = "Text Document"; programtype = "text"; } if (Pres.Type.EndsWith(".doc") || Pres.Type.EndsWith(".docx")) { Pres.Type = "Word Document"; programtype = "word"; } if (Pres.Type.EndsWith(".html") || Pres.Type.EndsWith(".htm")) { Pres.Type = "HTML"; programtype = "html"; } // assuming you had a pre-existing item ListViewItem item = PresList.FindItemWithText(Pres.File); if (item == null) { foreach (PPT pre in presArray) { string[] row = { Pres.Time, Pres.Day, Pres.Name, Pres.Room, Pres.File, Pres.Type }; var listViewItem = new ListViewItem(row); PresList.Items.Add(listViewItem); } } else { } } } } } catch (Exception) { //MessageBox.Show("There was an error updating the list: \n" + error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private static void DecorateSlideOne(PPT.Slide slide) { // Insert the graphic for the slide var pictureShape = PptShapeManager.AddPicture( slide, Environment.CurrentDirectory + ResourceFolder + Slide1Graphic, 100f, 220f, 200f, 200f); // Insert the graphic for the slide var pictureShape2 = PptShapeManager.AddPicture( slide, Environment.CurrentDirectory + ResourceFolder + Slide1Graphic, 100f, 420f, 75f, 75f); // Insert the textboxes var textShape1 = PptShapeManager.AddTextBoxToSlide( slide, MsoTextOrientation.msoTextOrientationHorizontal, 320f, 280f, 400f, 40f); var textShape2 = PptShapeManager.AddTextBoxToSlide( slide, MsoTextOrientation.msoTextOrientationHorizontal, 320f, 320f, 400f, 40f); // Set the text in the textboxes PptShapeManager.SetTextBoxText(textShape1, "CodeSharper PowerPoint Helper"); textShape1.TextEffect.FontBold = MsoTriState.msoTrue; textShape1.TextEffect.FontSize = 42f; PptShapeManager.SetTextBoxText(textShape2, "A Demonstration"); textShape2.TextEffect.FontBold = MsoTriState.msoTrue; textShape1.TextEffect.FontSize = 28f; // Configure a click event hyperlink for the pictureShape PptShapeManager.AddHyperLinkToWebsite(pictureShape, "http://www.codesharper.co.uk"); // Configure a click event navigate backword for the textshape1 PptShapeManager.AddClickedActionToShape(pictureShape2, PPT.PpActionType.ppActionEndShow); SetSlideFooter(slide, 1); }
private void timer1_Tick(object sender, EventArgs e) { // See if background image has been changed. if (!Properties.Settings.Default.bgImage.Contains("Properties.Resources.Adelaide_Convention_Centre")) { try { BackgroundImage = new Bitmap(Properties.Settings.Default.bgImage); } catch { DebugLog("Error: there was an error changing the background image... reverting to default image.\nStack trace: " + e); BackgroundImage = Properties.Resources.Adelaide_Convention_Centre; } } // If settings have been changed, make the option invisible if (Properties.Settings.Default.settingsVisible == false) { //SettingsButton.Visible = false; //disable for debugging } // If clear settings is pressed, we update the list to reflect that. if (Properties.Settings.Default.updateList == true) { PresList.Clear(); InitializeListView(); Properties.Settings.Default.updateList = false; Properties.Settings.Default.Save(); } try { //CreateSettingsCFG(); //create settings CFG if doesnt exist using (FileStream fs = new FileStream(@"settings.cfg", FileMode.Open)) { using (StreamReader reader = new StreamReader(fs, Encoding.UTF8)) { string line = null; /* * ^ Start of string * \d+ "\d" means "digit" - 0-9. The "+" means "one or more." * So this means "one or more digits." * \t This matches a tab. * (\d+) This also matches one or more digits. This time, though, we capture it * using brackets. This means we can access it using the Group method. * \t Another tab. * .+? "." means "anything." So "one or more of anything". In addition, it's lazy. * This is to stop it grabbing everything in sight - it'll only grab as much * as it needs to for the regex to work. * \t Another tab. * * (item\\[^\t]+\.ddj) * Here's the meat. This matches: "item\<one or more of anything but a tab>.ddj"*/ while ((line = reader.ReadLine()) != null) { editPres.Enabled = true; StartPresButton.Enabled = true; PPT Pres = new PPT(); Pres.Time = reader.ReadLine(); Pres.Day = reader.ReadLine(); Pres.Name = reader.ReadLine(); Pres.Room = reader.ReadLine(); Pres.File = reader.ReadLine(); Pres.Type = reader.ReadLine(); // Problem here is that Pres.File is actually original file location (USB for example, so we need to change that to the new file) Pres.File = Pres.Type; if (Pres.Type == "") { Pres.Type = "PowerPoint"; programtype = "ppt"; } // Add Pres to ArrayList List <PPT> presArray = new List <PPT>(); presArray.Add(Pres); // Sort file types if (Pres.Type.EndsWith(".pdf")) { Pres.Type = "Adobe Reader"; programtype = "adobe"; } if (Pres.Type.EndsWith(".ppt") || Pres.Type.EndsWith(".pptx")) { Pres.Type = "PowerPoint"; programtype = "ppt"; } if (Pres.Type.EndsWith("Prezi.exe")) { Pres.Type = "Prezi"; programtype = "prezi"; } if (Pres.Type.EndsWith(".exe")) { Pres.Type = "Executable"; programtype = "exe"; } if (Pres.Type.EndsWith(".zip") || Pres.Type.EndsWith(".rar")) { Pres.Type = "Archive"; programtype = "exe"; } if (Pres.Type.EndsWith(".txt") || Pres.Type.EndsWith(".text")) { Pres.Type = "Text Document"; programtype = "text"; } if (Pres.Type.EndsWith(".doc") || Pres.Type.EndsWith(".docx")) { Pres.Type = "Word Document"; programtype = "word"; } if (Pres.Type.EndsWith(".html") || Pres.Type.EndsWith(".htm")) { Pres.Type = "HTML"; programtype = "html"; } // assuming you had a pre-existing item ListViewItem item = PresList.FindItemWithText(Pres.File); if (item == null) { foreach (PPT pre in presArray) { string[] row = { Pres.Time, Pres.Day, Pres.Name, Pres.Room, Pres.File, Pres.Type }; var listViewItem = new ListViewItem(row); PresList.Items.Add(listViewItem); } } else { } } } } } catch (Exception) { //MessageBox.Show("There was an error updating the list: \n" + error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }