Exemplo n.º 1
1
 private void MonthClosed()
 {
     Microsoft.Office.Interop.PowerPoint.Application pptApp = new Microsoft.Office.Interop.PowerPoint.Application();
     Microsoft.Office.Core.MsoTriState ofalse = Microsoft.Office.Core.MsoTriState.msoFalse;
     Microsoft.Office.Core.MsoTriState otrue  = Microsoft.Office.Core.MsoTriState.msoTrue;
     pptApp.Visible = otrue;
     pptApp.Activate();
     Microsoft.Office.Interop.PowerPoint.Presentations ps = pptApp.Presentations;
     Microsoft.Office.Interop.PowerPoint.Presentation  p  = ps.Open(@"F:\Mess Managment\Mess Notice\PPTFormatNotice\MonthClosed.pptx", ofalse, ofalse, otrue);
     System.Diagnostics.Debug.Print(p.Windows.Count.ToString());
 }
Exemplo n.º 2
0
 private void bunifuThinButton23_Click(object sender, EventArgs e)
 {
     Microsoft.Office.Interop.PowerPoint.Application pptApp = new Microsoft.Office.Interop.PowerPoint.Application();
     Microsoft.Office.Core.MsoTriState ofalse = Microsoft.Office.Core.MsoTriState.msoFalse;
     Microsoft.Office.Core.MsoTriState otrue  = Microsoft.Office.Core.MsoTriState.msoTrue;
     pptApp.Visible = otrue;
     pptApp.Activate();
     Microsoft.Office.Interop.PowerPoint.Presentations ps = pptApp.Presentations;
     Microsoft.Office.Interop.PowerPoint.Presentation  p  = ps.Open(@"F:\Mess Managment\Mess Notice\PPTFormatNotice\PenaltyMeal.pptx", ofalse, ofalse, otrue);
     System.Diagnostics.Debug.Print(p.Windows.Count.ToString());
 }
Exemplo n.º 3
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="nameOfExcel">Имя ячейки (пример:"D8")</param>
 /// <param name="value">Значение ячейки</param>
 public PictureParameter(string pathPicture, Microsoft.Office.Core.MsoTriState linkToFile,
                         Microsoft.Office.Core.MsoTriState saveWithDocument, int left, int top, int width, int height)
 {
     _pathPicture      = pathPicture;
     _linkToFile       = linkToFile;
     _saveWithDocument = saveWithDocument;
     _left             = left;
     _top    = top;
     _width  = width;
     _height = height;
 }
Exemplo n.º 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     Microsoft.Office.Interop.PowerPoint.Application pptApp = new Microsoft.Office.Interop.PowerPoint.Application();
     Microsoft.Office.Core.MsoTriState ofalse = Microsoft.Office.Core.MsoTriState.msoFalse;
     Microsoft.Office.Core.MsoTriState otrue  = Microsoft.Office.Core.MsoTriState.msoTrue;
     pptApp.Visible = otrue;
     pptApp.Activate();
     Microsoft.Office.Interop.PowerPoint.Presentations ps = pptApp.Presentations;
     Microsoft.Office.Interop.PowerPoint.Presentation  p  = ps.Open(@"F:\Mess Managment\PersonalCostV.1.1.00V.pptx", ofalse, ofalse, otrue);
     System.Diagnostics.Debug.Print(p.Windows.Count.ToString());
     MessageBox.Show(pptApp.ActiveWindow.Caption);
 }
 protected override void OnStart(CustomForm Sender)
 {
     Microsoft.Office.Interop.PowerPoint.Application pptApp = new Microsoft.Office.Interop.PowerPoint.Application();
     Microsoft.Office.Core.MsoTriState ofalse = Microsoft.Office.Core.MsoTriState.msoFalse;
     Microsoft.Office.Core.MsoTriState otrue  = Microsoft.Office.Core.MsoTriState.msoTrue;
     pptApp.Visible = otrue;
     pptApp.Activate();
     Microsoft.Office.Interop.PowerPoint.Presentations ps = pptApp.Presentations;
     opApp = new Microsoft.Office.Interop.PowerPoint.Application();
     opApp.SlideShowNextSlide += OpApp_SlideShowNextSlide;
     ppPresentation            = ps.Open(@"c:\a.pptx", ofalse, ofalse, otrue);
     settings               = ppPresentation.SlideShowSettings;
     settings.RangeType     = Microsoft.Office.Interop.PowerPoint.PpSlideShowRangeType.ppShowSlideRange;
     settings.StartingSlide = StartingSlide;
     settings.Run();
 }
Exemplo n.º 6
0
        private static string SaveAsPptx(string pptPathIn)
        {
            Microsoft.Office.Interop.PowerPoint.Application presentationApp = new Microsoft.Office.Interop.PowerPoint.Application();
            string pptxPathOut = null;

            try
            {
                string pptDir          = Path.GetDirectoryName(pptPathIn);
                string pptFileNameOnly = Path.GetFileNameWithoutExtension(pptPathIn);
                pptxPathOut             = Path.Combine(pptDir, pptFileNameOnly + ".pptx");
                presentationApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;

                Microsoft.Office.Interop.PowerPoint.Presentations presentations = presentationApp.Presentations;

                Microsoft.Office.Core.MsoTriState readOnly   = Microsoft.Office.Core.MsoTriState.msoFalse;
                Microsoft.Office.Core.MsoTriState untitled   = Microsoft.Office.Core.MsoTriState.msoFalse;
                Microsoft.Office.Core.MsoTriState withWindow = Microsoft.Office.Core.MsoTriState.msoFalse;

                Debug.Print("Opening ppt file {0} ...", pptPathIn);
                Microsoft.Office.Interop.PowerPoint.Presentation presentation = presentations.Open(pptPathIn, readOnly, untitled, withWindow);

                Debug.Print("Starting creation of pptx from ppt {0}", pptPathIn);
                presentation.SaveCopyAs(pptxPathOut, PowerPoint.PpSaveAsFileType.ppSaveAsOpenXMLPresentation, Microsoft.Office.Core.MsoTriState.msoFalse);
                Debug.Print("Successfully created pptx {0} from ppt {1}", pptxPathOut, pptPathIn);
            }
            catch (Exception e)
            {
                Debug.Print("Error during creating pptx from ppt " + pptPathIn, e);
            }
            finally
            {
                presentationApp.Quit();
            }

            return(pptxPathOut);
        }
Exemplo n.º 7
0
 public Shape AddOLEObject(float Left = 0f, float Top = 0f, float Width = -1f, float Height = -1f, string ClassName = "", string FileName = "", Microsoft.Office.Core.MsoTriState DisplayAsIcon = Microsoft.Office.Core.MsoTriState.msoFalse, string IconFileName = "", int IconIndex = 0, string IconLabel = "", Microsoft.Office.Core.MsoTriState Link = Microsoft.Office.Core.MsoTriState.msoFalse)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 8
0
 public void PrintOut(int From, int To, string PrintToFile, int Copies, Microsoft.Office.Core.MsoTriState Collate)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 9
0
 public void SaveCopyAs(string FileName, PpSaveAsFileType FileFormat = PpSaveAsFileType.ppSaveAsDefault, Microsoft.Office.Core.MsoTriState EmbedTrueTypeFonts = Microsoft.Office.Core.MsoTriState.msoTriStateMixed)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 10
0
 public void ExportAsFixedFormat(string Path, PpFixedFormatType FixedFormatType, PpFixedFormatIntent Intent, Microsoft.Office.Core.MsoTriState FrameSlides, PpPrintHandoutOrder HandoutOrder, PpPrintOutputType OutputType, Microsoft.Office.Core.MsoTriState PrintHiddenSlides, PrintRange PrintRange, PpPrintRangeType RangeType, string SlideShowName, bool IncludeDocProperties, bool KeepIRMSettings, bool DocStructureTags, bool BitmapMissingFonts, bool UseISO19005_1, [System.Runtime.InteropServices.OptionalAttribute] object ExternalExporter)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 11
0
 public void MakeIntoTemplate(Microsoft.Office.Core.MsoTriState IsDesignTemplate)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 12
0
 public Effect ConvertToAnimateBackground(Effect Effect, Microsoft.Office.Core.MsoTriState AnimateBackground)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 13
0
 public Effect ConvertToAnimateInReverse(Effect Effect, Microsoft.Office.Core.MsoTriState animateInReverse)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 14
0
 public Shape AddPicture(string FileName, Microsoft.Office.Core.MsoTriState LinkToFile, Microsoft.Office.Core.MsoTriState SaveWithDocument, float Left, float Top, float Width = -1f, float Height = -1f)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 15
0
        private int IsValidShapes(PowerPoint.ShapeRange selectedShapes)
        {
            PowerPoint.Shape referenceShape = selectedShapes[1];

            if (referenceShape.Type == Microsoft.Office.Core.MsoShapeType.msoGroup)
            {
                return(ResizeLabErrorHandler.ErrorCodeGroupShapeNotSupported);
            }

            PowerPoint.Adjustments referenceAdjustments = referenceShape.Adjustments;
            bool isAutoShapeOrCallout = referenceShape.Type == Microsoft.Office.Core.MsoShapeType.msoAutoShape ||
                                        referenceShape.Type == Microsoft.Office.Core.MsoShapeType.msoCallout;
            bool isFreeform = referenceShape.Type == Microsoft.Office.Core.MsoShapeType.msoFreeform;

            Utils.PPShape referencePPShape;
            List <System.Drawing.PointF> referenceShapePoints = null;

            if (isFreeform)
            {
                referencePPShape     = new Utils.PPShape(referenceShape, false);
                referenceShapePoints = referencePPShape.Points;
            }

            for (int i = 2; i <= selectedShapes.Count; i++)
            {
                PowerPoint.Shape currentShape = selectedShapes[i];

                if (currentShape.Type == Microsoft.Office.Core.MsoShapeType.msoGroup)
                {
                    return(ResizeLabErrorHandler.ErrorCodeGroupShapeNotSupported);
                }

                if (currentShape.Type != referenceShape.Type || currentShape.AutoShapeType != referenceShape.AutoShapeType)
                {
                    return(ResizeLabErrorHandler.ErrorCodeNotSameShapes);
                }

                if (isAutoShapeOrCallout)
                {
                    PowerPoint.Adjustments currentAdjustments = currentShape.Adjustments;

                    if (currentAdjustments.Count != referenceAdjustments.Count)
                    {
                        return(ResizeLabErrorHandler.ErrorCodeNotSameShapes);
                    }

                    for (int j = 1; j <= referenceAdjustments.Count; j++)
                    {
                        if (currentAdjustments[j] != referenceAdjustments[j])
                        {
                            return(ResizeLabErrorHandler.ErrorCodeNotSameShapes);
                        }
                    }
                }
                else if (isFreeform)
                {
                    Microsoft.Office.Core.MsoTriState isAspectRatio = selectedShapes.LockAspectRatio;
                    selectedShapes.LockAspectRatio = Microsoft.Office.Core.MsoTriState.msoFalse;

                    PowerPoint.Shape duplicateCurrentShape = currentShape.Duplicate()[1];
                    duplicateCurrentShape.Width    = referenceShape.Width;
                    duplicateCurrentShape.Height   = referenceShape.Height;
                    duplicateCurrentShape.Rotation = referenceShape.Rotation;
                    duplicateCurrentShape.Left     = referenceShape.Left;
                    duplicateCurrentShape.Top      = referenceShape.Top;
                    Utils.PPShape currentPPShape = new Utils.PPShape(duplicateCurrentShape, false);
                    List <System.Drawing.PointF> currentShapePoints = currentPPShape.Points;
                    duplicateCurrentShape.Delete();

                    selectedShapes.LockAspectRatio = isAspectRatio;

                    if (!currentShapePoints.SequenceEqual(referenceShapePoints))
                    {
                        return(ResizeLabErrorHandler.ErrorCodeNotSameShapes);
                    }
                }
            }

            return(-1);
        }
Exemplo n.º 16
0
 public Shape AddMediaObject2(string FileName, Microsoft.Office.Core.MsoTriState LinkToFile = Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState SaveWithDocument = Microsoft.Office.Core.MsoTriState.msoTrue, float Left = 0f, float Top = 0f, float Width = -1f, float Height = -1f)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 17
0
 public ShapeRange PasteSpecial(PpPasteDataType DataType = PpPasteDataType.ppPasteDefault, Microsoft.Office.Core.MsoTriState DisplayAsIcon = Microsoft.Office.Core.MsoTriState.msoFalse, string IconFileName = "", int IconIndex = 0, string IconLabel = "", Microsoft.Office.Core.MsoTriState Link = Microsoft.Office.Core.MsoTriState.msoFalse)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 18
0
 public Shape AddTextEffect(Microsoft.Office.Core.MsoPresetTextEffect PresetTextEffect, string Text, string FontName, float FontSize, Microsoft.Office.Core.MsoTriState FontBold, Microsoft.Office.Core.MsoTriState FontItalic, float Left, float Top)
 {
     throw new NotImplementedException();
 }