本文整理汇总了C#中PowerPointLabs.Models.PowerPointSlide类的典型用法代码示例。如果您正苦于以下问题:C# PowerPointSlide类的具体用法?C# PowerPointSlide怎么用?C# PowerPointSlide使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PowerPointSlide类属于PowerPointLabs.Models命名空间,在下文中一共展示了PowerPointSlide类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareForZoomToArea
private void PrepareForZoomToArea(PowerPointSlide slideToPanFrom, PowerPointSlide slideToPanTo)
{
//Delete all shapes from slide excpet last magnified shape
List<PowerPoint.Shape> shapes = _slide.Shapes.Cast<PowerPoint.Shape>().ToList();
var matchingShapes = shapes.Where(current => (!current.Name.Contains("PPTLabsMagnifyAreaGroup")));
foreach (PowerPoint.Shape s in matchingShapes)
s.Delete();
panShapeFrom = GetShapesWithPrefix("PPTLabsMagnifyAreaGroup")[0];
panShapeTo = slideToPanTo.GetShapesWithPrefix("PPTLabsMagnifyAreaGroup")[0];
//Add fade animation to existing shapes
shapes = _slide.Shapes.Cast<PowerPoint.Shape>().ToList();
matchingShapes = shapes.Where(current => (!(current.Equals(indicatorShape) || current.Equals(panShapeFrom))));
foreach (PowerPoint.Shape s in matchingShapes)
{
DeleteShapeAnimations(s);
PowerPoint.Effect effectFade = _slide.TimeLine.MainSequence.AddEffect(s, PowerPoint.MsoAnimEffect.msoAnimEffectFade, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
effectFade.Exit = Office.MsoTriState.msoTrue;
effectFade.Timing.Duration = 0.25f;
}
DeleteSlideNotes();
DeleteSlideMedia();
ManageSlideTransitions();
indicatorShape = AddPowerPointLabsIndicator();
}
示例2: AddFrameMotionAnimation
public static void AddFrameMotionAnimation(PowerPointSlide animationSlide, PowerPoint.Shape initialShape, PowerPoint.Shape finalShape, float duration)
{
float initialX = (initialShape.Left + (initialShape.Width) / 2);
float initialY = (initialShape.Top + (initialShape.Height) / 2);
float initialRotation = initialShape.Rotation;
float initialWidth = initialShape.Width;
float initialHeight = initialShape.Height;
float initialFont = 0.0f;
float finalX = (finalShape.Left + (finalShape.Width) / 2);
float finalY = (finalShape.Top + (finalShape.Height) / 2);
float finalRotation = finalShape.Rotation;
float finalWidth = finalShape.Width;
float finalHeight = finalShape.Height;
float finalFont = 0.0f;
if (initialShape.HasTextFrame == Office.MsoTriState.msoTrue && (initialShape.TextFrame.HasText == Office.MsoTriState.msoTriStateMixed || initialShape.TextFrame.HasText == Office.MsoTriState.msoTrue) && initialShape.TextFrame.TextRange.Font.Size != finalShape.TextFrame.TextRange.Font.Size)
{
finalFont = finalShape.TextFrame.TextRange.Font.Size;
initialFont = initialShape.TextFrame.TextRange.Font.Size;
}
int numFrames = (int)(duration / 0.04f);
numFrames = (numFrames > 30) ? 30 : numFrames;
float incrementWidth = ((finalWidth / initialWidth) - 1.0f) / numFrames;
float incrementHeight = ((finalHeight / initialHeight) - 1.0f) / numFrames;
float incrementRotation = PowerPointLabsGlobals.GetMinimumRotation(initialRotation, finalRotation) / numFrames;
float incrementLeft = (finalX - initialX) / numFrames;
float incrementTop = (finalY - initialY) / numFrames;
float incrementFont = (finalFont - initialFont) / numFrames;
AddFrameAnimationEffects(animationSlide, initialShape, incrementLeft, incrementTop, incrementWidth, incrementHeight, incrementRotation, incrementFont, duration, numFrames);
}
示例3: GetShapesFromLinesInText
private static List<PowerPoint.Shape> GetShapesFromLinesInText(PowerPointSlide currentSlide, Office.TextRange2 text, PowerPoint.Shape shape)
{
List<PowerPoint.Shape> shapesToAnimate = new List<PowerPoint.Shape>();
foreach (Office.TextRange2 line in text.Lines)
{
PowerPoint.Shape highlightShape = currentSlide.Shapes.AddShape(
Office.MsoAutoShapeType.msoShapeRoundedRectangle,
line.BoundLeft,
line.BoundTop,
line.BoundWidth,
line.BoundHeight);
highlightShape.Adjustments[1] = 0.25f;
highlightShape.Fill.ForeColor.RGB = Utils.Graphics.ConvertColorToRgb(backgroundColor);
highlightShape.Fill.Transparency = 0.50f;
highlightShape.Line.Visible = Office.MsoTriState.msoFalse;
Utils.Graphics.MoveZToJustBehind(highlightShape, shape);
highlightShape.Name = "PPTLabsHighlightTextFragmentsShape" + Guid.NewGuid().ToString();
highlightShape.Tags.Add("HighlightTextFragment", highlightShape.Name);
highlightShape.Select(Office.MsoTriState.msoFalse);
shapesToAnimate.Add(highlightShape);
}
return shapesToAnimate;
}
示例4: AddZoomToAreaAnimation
public void AddZoomToAreaAnimation(PowerPointSlide slideToPanFrom, PowerPointSlide slideToPanTo)
{
PrepareForZoomToArea(slideToPanFrom, slideToPanTo);
DefaultMotionAnimation.AddZoomToAreaPanAnimation(this, panShapeFrom, panShapeTo, PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious);
DefaultMotionAnimation.PreloadShape(this, panShapeFrom);
indicatorShape.ZOrder(Office.MsoZOrderCmd.msoBringToFront);
}
示例5: AddMultiSlideZoomToArea
private static List<PowerPointSlide> AddMultiSlideZoomToArea(PowerPointSlide currentSlide, List<PowerPoint.Shape> shapesToZoom)
{
var addedSlides = new List<PowerPointSlide>();
int shapeCount = 1;
PowerPointSlide lastMagnifiedSlide = null;
PowerPointMagnifyingSlide magnifyingSlide = null;
PowerPointMagnifiedSlide magnifiedSlide = null;
PowerPointMagnifiedPanSlide magnifiedPanSlide = null;
PowerPointDeMagnifyingSlide deMagnifyingSlide = null;
foreach (PowerPoint.Shape selectedShape in shapesToZoom)
{
magnifyingSlide = (PowerPointMagnifyingSlide)currentSlide.CreateZoomMagnifyingSlide();
magnifyingSlide.AddZoomToAreaAnimation(selectedShape);
magnifiedSlide = (PowerPointMagnifiedSlide)magnifyingSlide.CreateZoomMagnifiedSlide();
magnifiedSlide.AddZoomToAreaAnimation(selectedShape);
addedSlides.Add(magnifiedSlide);
if (shapeCount != 1)
{
magnifiedPanSlide = (PowerPointMagnifiedPanSlide)lastMagnifiedSlide.CreateZoomPanSlide();
magnifiedPanSlide.AddZoomToAreaAnimation(lastMagnifiedSlide, magnifiedSlide);
addedSlides.Add(magnifiedPanSlide);
}
if (shapeCount == shapesToZoom.Count)
{
deMagnifyingSlide = (PowerPointDeMagnifyingSlide)magnifyingSlide.CreateZoomDeMagnifyingSlide();
deMagnifyingSlide.MoveTo(magnifyingSlide.Index + 2);
deMagnifyingSlide.AddZoomToAreaAnimation(selectedShape);
addedSlides.Add(deMagnifyingSlide);
}
selectedShape.Delete();
if (shapeCount != 1)
{
magnifyingSlide.Delete();
magnifiedSlide.MoveTo(magnifiedPanSlide.Index);
if (deMagnifyingSlide != null)
deMagnifyingSlide.MoveTo(magnifiedSlide.Index);
lastMagnifiedSlide = magnifiedSlide;
}
else
{
addedSlides.Add(magnifyingSlide);
lastMagnifiedSlide = magnifiedSlide;
}
shapeCount++;
}
Graphics.SortByIndex(addedSlides);
return addedSlides;
}
示例6: AddNewShapesToAnimate
//Add highlight shape for paragraphs within selected shape which have bullets or with text selected by user
private static bool AddNewShapesToAnimate(PowerPointSlide currentSlide, List<PowerPoint.Shape> shapesToUse, Office.TextRange2 selectedText)
{
bool anySelected = false;
foreach (var sh in shapesToUse)
{
sh.Name = "HighlightBackgroundShape" + Guid.NewGuid();
}
if (userSelection == HighlightBackgroundSelection.kTextSelected)
{
foreach (var sh in shapesToUse)
{
foreach (Office.TextRange2 paragraph in sh.TextFrame2.TextRange.Paragraphs)
{
if (paragraph.Start <= selectedText.Start + selectedText.Length
&& selectedText.Start <= paragraph.Start + paragraph.Length - 1
&& paragraph.TrimText().Length > 0)
{
GenerateHighlightShape(currentSlide, paragraph, sh);
anySelected = true;
}
}
}
}
else
{
foreach (var sh in shapesToUse)
{
bool anySelectedForShape = false;
foreach (Office.TextRange2 paragraph in sh.TextFrame2.TextRange.Paragraphs)
{
if (paragraph.ParagraphFormat.Bullet.Visible == Office.MsoTriState.msoTrue
&& paragraph.TrimText().Length > 0)
{
GenerateHighlightShape(currentSlide, paragraph, sh);
anySelected = true;
anySelectedForShape = true;
}
}
if (anySelectedForShape)
{
continue;
}
foreach (Office.TextRange2 paragraph in sh.TextFrame2.TextRange.Paragraphs)
{
if (paragraph.TrimText().Length > 0)
{
GenerateHighlightShape(currentSlide, paragraph, sh);
anySelected = true;
}
}
}
}
return anySelected;
}
示例7: PostFormatShapeOnCurrentSlide
private static void PostFormatShapeOnCurrentSlide(PowerPointSlide currentSlide, PowerPoint.Shape spotShape)
{
//Format selected shape on current slide
spotShape.Fill.ForeColor.RGB = 0xaaaaaa;
spotShape.Fill.Transparency = 0.7f;
spotShape.Line.Visible = Office.MsoTriState.msoTrue;
spotShape.Line.ForeColor.RGB = 0x000000;
Utils.Graphics.MakeShapeViewTimeInvisible(spotShape, currentSlide);
}
示例8: InSlideAnimateSingleShape
private static void InSlideAnimateSingleShape(PowerPointSlide currentSlide, PowerPoint.Shape shapeToAnimate)
{
PowerPoint.Effect appear = currentSlide.TimeLine.MainSequence.AddEffect(
shapeToAnimate,
PowerPoint.MsoAnimEffect.msoAnimEffectAppear,
PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone,
PowerPoint.MsoAnimTriggerType.msoAnimTriggerOnPageClick);
PowerPoint.Effect disappear = currentSlide.TimeLine.MainSequence.AddEffect(
shapeToAnimate, PowerPoint.MsoAnimEffect.msoAnimEffectAppear,
PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone,
PowerPoint.MsoAnimTriggerType.msoAnimTriggerOnPageClick);
disappear.Exit = Office.MsoTriState.msoTrue;
}
示例9: Decode
public static AgendaSlide Decode(PowerPointSlide slide)
{
if (slide == null) return null;
try
{
return Decode(slide.Name);
}
catch (COMException e)
{
// sometims the shape is inaccessible (perhaps deleted. never occurred to me before.)
// in this case, a COMException is thrown. so we return null.
return null;
}
}
示例10: AddZoomToAreaMotionAnimation
//Use initial shape and final shape to calculate intial and final positions.
//Add motion and resize animations to shapeToZoom
public static void AddZoomToAreaMotionAnimation(PowerPointSlide animationSlide, PowerPoint.Shape shapeToZoom, PowerPoint.Shape initialShape, PowerPoint.Shape finalShape, float duration, PowerPoint.MsoAnimTriggerType trigger)
{
float initialWidth = initialShape.Width;
float finalWidth = finalShape.Width;
float initialHeight = initialShape.Height;
float finalHeight = finalShape.Height;
float initialX = (initialShape.Left + (initialShape.Width) / 2) * (finalWidth / initialWidth);
float finalX = (finalShape.Left + (finalShape.Width) / 2) * (finalWidth / initialWidth);
float initialY = (initialShape.Top + (initialShape.Height) / 2) * (finalHeight / initialHeight);
float finalY = (finalShape.Top + (finalShape.Height) / 2) * (finalHeight / initialHeight);
AddMotionAnimation(animationSlide, shapeToZoom, initialX, initialY, finalX, finalY, duration, ref trigger);
AddResizeAnimation(animationSlide, shapeToZoom, initialWidth, initialHeight, finalWidth, finalHeight, duration, ref trigger);
}
示例11: AddStepBackMotionAnimation
//Use shapeToZoom and reference shape to calculate intial and final positions
//Add motion and resize animations to shapeToZoom
public static void AddStepBackMotionAnimation(PowerPointSlide animationSlide, PowerPoint.Shape shapeToZoom, PowerPoint.Shape referenceShape, float duration, PowerPoint.MsoAnimTriggerType trigger)
{
float initialX = (shapeToZoom.Left + (shapeToZoom.Width) / 2);
float finalX = (referenceShape.Left + (referenceShape.Width) / 2);
float initialY = (shapeToZoom.Top + (shapeToZoom.Height) / 2);
float finalY = (referenceShape.Top + (referenceShape.Height) / 2);
float initialWidth = shapeToZoom.Width;
float finalWidth = referenceShape.Width;
float initialHeight = shapeToZoom.Height;
float finalHeight = referenceShape.Height;
AddMotionAnimation(animationSlide, shapeToZoom, initialX, initialY, finalX, finalY, duration, ref trigger);
AddResizeAnimation(animationSlide, shapeToZoom, initialWidth, initialHeight, finalWidth, finalHeight, duration, ref trigger);
}
示例12: AddDrillDownMotionAnimation
//Use reference shape and slide dimensions to calculate intial and final positions
//Add motion and resize animations to shapeToZoom
public static void AddDrillDownMotionAnimation(PowerPointSlide animationSlide, PowerPoint.Shape shapeToZoom, PowerPoint.Shape referenceShape, float duration, PowerPoint.MsoAnimTriggerType trigger)
{
float finalWidth = PowerPointPresentation.Current.SlideWidth;
float initialWidth = referenceShape.Width;
float finalHeight = PowerPointPresentation.Current.SlideHeight;
float initialHeight = referenceShape.Height;
float finalX = (PowerPointPresentation.Current.SlideWidth / 2) * (finalWidth / initialWidth);
float initialX = (referenceShape.Left + (referenceShape.Width) / 2) * (finalWidth / initialWidth);
float finalY = (PowerPointPresentation.Current.SlideHeight / 2) * (finalHeight / initialHeight);
float initialY = (referenceShape.Top + (referenceShape.Height) / 2) * (finalHeight / initialHeight);
AddMotionAnimation(animationSlide, shapeToZoom, initialX, initialY, finalX, finalY, duration, ref trigger);
AddResizeAnimation(animationSlide, shapeToZoom, initialWidth, initialHeight, finalWidth, finalHeight, duration, ref trigger);
}
示例13: SyncBulletAgendaSlide
private static void SyncBulletAgendaSlide(PowerPointSlide refSlide, List<AgendaSection> sections,
AgendaSection currentSection, List<string> deletedShapeNames, PowerPointSlide targetSlide)
{
SyncShapesFromReferenceSlide(refSlide, targetSlide, deletedShapeNames);
var referenceContentShape = refSlide.GetShape(AgendaShape.WithPurpose(ShapePurpose.ContentShape));
var targetContentShape = targetSlide.GetShape(AgendaShape.WithPurpose(ShapePurpose.ContentShape));
var bulletFormats = BulletFormats.ExtractFormats(referenceContentShape);
Graphics.SetText(targetContentShape, sections.Where(section => section.Index > 1)
.Select(section => section.Name));
Graphics.SyncShape(referenceContentShape, targetContentShape, pickupTextContent: false,
pickupTextFormat: false);
ApplyBulletFormats(targetContentShape.TextFrame2.TextRange, bulletFormats, currentSection);
targetSlide.DeletePlaceholderShapes();
}
示例14: AddCaptionBoxToSlide
private static Shape AddCaptionBoxToSlide(string caption, PowerPointSlide s)
{
float slideWidth = PowerPointPresentation.Current.SlideWidth;
float slideHeight = PowerPointPresentation.Current.SlideHeight;
Shape textBox = s.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, slideHeight - 100,
slideWidth, 100);
textBox.TextFrame.AutoSize = PpAutoSize.ppAutoSizeShapeToFitText;
textBox.TextFrame.TextRange.Text = caption;
textBox.TextFrame.WordWrap = MsoTriState.msoTrue;
textBox.TextEffect.Alignment = MsoTextEffectAlignment.msoTextEffectAlignmentCentered;
textBox.TextFrame.TextRange.Font.Size = 12;
textBox.Fill.BackColor.RGB = 0;
textBox.Fill.Transparency = 0.2f;
textBox.TextFrame.TextRange.Font.Color.RGB = 0xffffff;
textBox.Top = slideHeight - textBox.Height;
return textBox;
}
示例15: EmbedOnSlide
// before we embed we need to check if we have any old shape on the slide. If
// we have, we need to delete it AFTER the new shape is inserted to preserve
// the original timeline.
public void EmbedOnSlide(PowerPointSlide slide, int clickNumber)
{
var isOnClick = clickNumber > 0;
var shapeName = Name;
if (slide != null)
{
// embed new shape using two-turn method. In the first turn, embed the shape, name it to
// something special to distinguish from the old shape; in the second turn, delete the
// old shape using timeline invariant deletion, and rename the new shape to the correct
// name.
try
{
var audioShape = AudioHelper.InsertAudioFileOnSlide(slide, SaveName);
audioShape.Name = "#";
slide.RemoveAnimationsForShape(audioShape);
if (isOnClick)
{
slide.SetShapeAsClickTriggered(audioShape, clickNumber, MsoAnimEffect.msoAnimEffectMediaPlay);
}
else
{
slide.SetAudioAsAutoplay(audioShape);
}
// delete old shape
slide.DeleteShapesWithPrefixTimelineInvariant(Name);
audioShape.Name = shapeName;
}
catch (COMException)
{
// Adding the file failed for one reason or another - probably cancelled by the user.
}
}
else
{
MessageBox.Show("Slide selection error");
}
}