本文整理汇总了C#中Microsoft.Office.Interop.PowerPoint.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.PowerPoint.Delete方法的具体用法?C# Microsoft.Office.Interop.PowerPoint.Delete怎么用?C# Microsoft.Office.Interop.PowerPoint.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Office.Interop.PowerPoint
的用法示例。
在下文中一共展示了Microsoft.Office.Interop.PowerPoint.Delete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertToPictureForShape
private static void ConvertToPictureForShape(PowerPoint.Shape shape)
{
float rotation = 0;
try
{
rotation = shape.Rotation;
shape.Rotation = 0;
}
catch (Exception e)
{
PowerPointLabsGlobals.LogException(e, "Chart cannot be rotated.");
}
shape.Copy();
float x = shape.Left;
float y = shape.Top;
float width = shape.Width;
float height = shape.Height;
shape.Delete();
var pic = PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.PasteSpecial(PowerPoint.PpPasteDataType.ppPastePNG)[1];
pic.Left = x + (width - pic.Width) / 2;
pic.Top = y + (height - pic.Height) / 2;
pic.Rotation = rotation;
pic.Select();
}
示例2: RenderSpotlightPicture
/// <summary>
/// Export formatted spotlight picture as a new picture,
/// then use the new pic to replace the formatted one.
/// Thus when it's displayed, no need to render the effect (which's very slow)
/// </summary>
/// <param name="spotlightPicture"></param>
private void RenderSpotlightPicture(PowerPoint.Shape spotlightPicture)
{
string dirOfRenderedPicture = Path.GetTempPath() + @"\rendered_" + spotlightPicture.Name;
//Render process:
//export formatted spotlight picture to a temp folder
spotlightPicture.Export(dirOfRenderedPicture, PowerPoint.PpShapeFormat.ppShapeFormatPNG);
//then add the exported new picture back
var renderedPicture = PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.AddPicture(
dirOfRenderedPicture, Office.MsoTriState.msoFalse, Office.MsoTriState.msoTrue,
spotlightPicture.Left, spotlightPicture.Top, spotlightPicture.Width, spotlightPicture.Height);
renderedPicture.Name = spotlightPicture.Name + "_rendered";
spotlightPicture.Delete();
}
示例3: GenerateTable
//.........这里部分代码省略.........
{
tableShape.Table.Cell(rowCounter, columnCounter + merge_count - 1).Borders[PowerPoint.PpBorderType.ppBorderRight].ForeColor.RGB = 0x0;
tableShape.Table.Cell(rowCounter, columnCounter + merge_count - 1).Borders[PowerPoint.PpBorderType.ppBorderRight].DashStyle = MsoLineDashStyle.msoLineSolid;
}
// set cell alignment
switch (mset.Columns[0].alignment)
{
case 'l':
shape.TextFrame2.TextRange.ParagraphFormat.Alignment = MsoParagraphAlignment.msoAlignLeft;
break;
case 'c':
shape.TextFrame2.TextRange.ParagraphFormat.Alignment = MsoParagraphAlignment.msoAlignCenter;
break;
case 'r':
shape.TextFrame2.TextRange.ParagraphFormat.Alignment = MsoParagraphAlignment.msoAlignRight;
break;
case 'p':
shape.TextFrame2.TextRange.ParagraphFormat.Alignment = MsoParagraphAlignment.msoAlignJustify;
break;
default:
break;
}
// skip merged columns
columnCounter += merge_count - 1;
}
}
}
}
}
else if(node.Type == "hline")
{
if (rowCounter == 0)
{
tableShape.Table.Rows[1].Cells.Borders[PowerPoint.PpBorderType.ppBorderTop].ForeColor.RGB = 0x0;
tableShape.Table.Rows[1].Cells.Borders[PowerPoint.PpBorderType.ppBorderTop].DashStyle = MsoLineDashStyle.msoLineSolid;
}
else
{
tableShape.Table.Rows[rowCounter].Cells.Borders[PowerPoint.PpBorderType.ppBorderBottom].ForeColor.RGB = 0x0;
tableShape.Table.Rows[rowCounter].Cells.Borders[PowerPoint.PpBorderType.ppBorderBottom].DashStyle = MsoLineDashStyle.msoLineSolid;
}
}
else if (node.Type == "cline")
{
Regex regex = new Regex(@"^([0-9]+)-([0-9]+)$", RegexOptions.IgnoreCase);
string range = node.Content as string;
Match match = regex.Match(range.Trim());
if (match.Success)
{
int x, y;
if (int.TryParse(match.Groups[1].Value, out x) && int.TryParse(match.Groups[2].Value, out y))
{
for (int i = Math.Min(x,y); i <= Math.Max(x,y); i++)
{
if (rowCounter == 0)
{
tableShape.Table.Rows[1].Cells[i].Borders[PowerPoint.PpBorderType.ppBorderTop].ForeColor.RGB = 0x0;
tableShape.Table.Rows[1].Cells[i].Borders[PowerPoint.PpBorderType.ppBorderTop].DashStyle = MsoLineDashStyle.msoLineSolid;
}
else
{
tableShape.Table.Rows[rowCounter].Cells[i].Borders[PowerPoint.PpBorderType.ppBorderBottom].ForeColor.RGB = 0x0;
tableShape.Table.Rows[rowCounter].Cells[i].Borders[PowerPoint.PpBorderType.ppBorderBottom].DashStyle = MsoLineDashStyle.msoLineSolid;
}
}
}
}
}
}
// resize table
Misc.AutoFitColumn(tableShape, settings);
// if processing was paused remove all lines after pause commands (columns are not supported yet)
if (paused)
{
if (pausedAfter == 0)
{
tableShape.Delete();
tableShape = null;
}
else
{
for (int i = tableShape.Table.Rows.Count; i > pausedAfter; i--)
{
tableShape.Table.Rows[i].Delete();
}
}
return false;
}
return true;
}
示例4: RemoveShapesForUngroupAll
private static void RemoveShapesForUngroupAll(PowerPoint.Shape shape, List<string> ungroupedShapes, Queue<PowerPoint.Shape> queue)
{
shape.Delete();
if (ungroupedShapes.Count > 0)
{
PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.Range(ungroupedShapes.ToArray()).Delete();
}
while (queue.Count != 0)
{
queue.Dequeue().Delete();
}
}
示例5: FillInShapeWithScreenshot
private static PowerPoint.Shape FillInShapeWithScreenshot(PowerPoint.Shape shape, double magnifyRatio = 1.0)
{
if (shape.Type != Office.MsoShapeType.msoGroup)
{
CreateFillInBackgroundForShape(shape, magnifyRatio);
shape.Fill.UserPicture(FillInBackgroundPicture);
}
else
{
using (var slideImage = (Bitmap)Image.FromFile(SlidePicture))
{
foreach (var shapeGroupItem in (from PowerPoint.Shape sh in shape.GroupItems select sh))
{
CreateFillInBackground(shapeGroupItem, slideImage);
shapeGroupItem.Fill.UserPicture(FillInBackgroundPicture);
}
}
}
shape.Line.Visible = Office.MsoTriState.msoFalse;
shape.Copy();
var shapeToReturn = PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.Paste()[1];
shape.Delete();
return shapeToReturn;
}
示例6: RecreateCorruptedShape
private static void RecreateCorruptedShape(PowerPoint.Shape s)
{
s.Copy();
PowerPoint.Shape newShape = PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.Paste()[1];
newShape.Select();
newShape.Name = s.Name;
newShape.Left = s.Left;
newShape.Top = s.Top;
while (newShape.ZOrderPosition > s.ZOrderPosition)
{
newShape.ZOrder(Microsoft.Office.Core.MsoZOrderCmd.msoSendBackward);
}
s.Delete();
}
示例7: CreateQuestionnaireSlideRecord
private async void CreateQuestionnaireSlideRecord(PowerPoint.Slide slide, QuestionnaireModel questionnaire)
{
try
{
var created = await _questionnaireUtil.CreateAsync(questionnaire);
_questionnaireUtil.Mark(slide, created);
}
catch (WebException)
{
slide.Delete();
MessageBox.Show("问卷添加失败了, 这可能是个网络错误.");
}
}
示例8: PictureTransparencyHandler
private void PictureTransparencyHandler(PowerPoint.Shape picture)
{
var rotation = picture.Rotation;
picture.Rotation = 0;
var tempPicPath = Path.Combine(Path.GetTempPath(), "tempPic.png");
Utils.Graphics.ExportShape(picture, tempPicPath);
var shapeHolder =
PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.AddShape(
Office.MsoAutoShapeType.msoShapeRectangle,
picture.Left,
picture.Top,
picture.Width,
picture.Height);
var oriZOrder = picture.ZOrderPosition;
picture.Delete();
// move shape holder to original z-order
while (shapeHolder.ZOrderPosition > oriZOrder)
{
shapeHolder.ZOrder(Office.MsoZOrderCmd.msoSendBackward);
}
shapeHolder.Line.Visible = Office.MsoTriState.msoFalse;
shapeHolder.Fill.UserPicture(tempPicPath);
shapeHolder.Fill.Transparency = 0.5f;
shapeHolder.Rotation = rotation;
File.Delete(tempPicPath);
}
示例9: DeleteSlide
/// <summary>
/// Delete the specified slide from the presentation
/// </summary>
/// <param name="slide">PPT.Slide object instance to delete</param>
public void DeleteSlide(PPT.Slide slide)
{
slide.Delete();
}