本文整理汇总了C#中System.ComponentModel.Model.AddSlideContent方法的典型用法代码示例。如果您正苦于以下问题:C# Model.AddSlideContent方法的具体用法?C# Model.AddSlideContent怎么用?C# Model.AddSlideContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ComponentModel.Model
的用法示例。
在下文中一共展示了Model.AddSlideContent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessLayer
/// <summary>
///
/// </summary>
/// <param name="tfc"></param>
/// <param name="shapes"></param>
/// <param name="range"></param>
/// <param name="deck"></param>
/// <param name="slide"></param>
/// <param name="disposition"></param>
/// <param name="emfHeight"></param>
/// <param name="startHeight">The starting height to place this sheet at</param>
private static void ProcessLayer( List<TaggedShape> layer, TempFileCollection tfc, PowerPoint.Shapes shapes, Model.Presentation.DeckModel deck,
Model.Presentation.SlideModel slide, float emfWidthRatio, float emfHeightRatio, int startHeight)
{
if (layer.Count < 1)
return;
//Create the image
int[] range = PPTDeckIO.BuildIntRange(layer);
PowerPoint.ShapeRange sr = shapes.Range(range);
PowerPoint.PpShapeFormat format;
string fileExt = "";
bool bitmapMode = layer[0].isImage;
if (bitmapMode) {
format = PowerPoint.PpShapeFormat.ppShapeFormatPNG;
fileExt = "png";
}
else {
format = PowerPoint.PpShapeFormat.ppShapeFormatEMF;
fileExt = "emf";
}
//Generate a new filename
string dirpath = tfc.BasePath;
string filename = PPTDeckIO.GenerateFilename();
filename = dirpath + "\\" + filename + "." + fileExt;
while (File.Exists(filename)) {
filename = PPTDeckIO.GenerateFilename();
filename = dirpath + "\\" + filename + "." + fileExt;
}
sr.Export(filename, format, 0, 0,
PowerPoint.PpExportMode.ppRelativeToSlide);
if (bitmapMode) {
// Starting with Office 2013, bitmaps may not be exported in the correct size.
double version;
if (!double.TryParse(((PowerPoint.Application)shapes.Application).Version, out version)) {
version = 0.0;
}
if (version >= 15.0) {
ScaleShapeImage(sr, filename);
}
}
tfc.AddFile(filename, false);
//Compute the MD5 of the BG
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
MD5 md5Provider = new MD5CryptoServiceProvider();
byte[] md5 = md5Provider.ComputeHash(fs);
fs.Seek(0, SeekOrigin.Begin);
Image image = Image.FromStream(fs);
if (bitmapMode)
image = DisassociateBitmap(image);
fs.Close();
//Calculate the geometry
int xCoord = 0;
int yCoord = 0;
int width = 0;
int height = 0;
PPTDeckIO.CalculateGeometry( image, shapes, range, emfWidthRatio, emfHeightRatio, ref xCoord, ref yCoord, ref width, ref height );
//Create the ImageSheet
ImageSheetModel sheet = new ImageSheetModel(deck, Guid.NewGuid(), layer[0].disp,
new Rectangle(xCoord, yCoord, width, height), (ByteArray)md5, startHeight);
//Add the ImageSheet to the Slide
slide.ContentSheets.Add(sheet);
//Add the Image+MD5 to the deck
deck.AddSlideContent((ByteArray)md5, image);
}