本文整理汇总了C#中Slide.Export方法的典型用法代码示例。如果您正苦于以下问题:C# Slide.Export方法的具体用法?C# Slide.Export怎么用?C# Slide.Export使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slide
的用法示例。
在下文中一共展示了Slide.Export方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsSameLooking
public static void IsSameLooking(Slide expSlide, Slide actualSlide)
{
var hashCode = DateTime.Now.GetHashCode();
actualSlide.Export(PathUtil.GetTempPath("actualSlide" + hashCode), "PNG");
expSlide.Export(PathUtil.GetTempPath("expSlide" + hashCode), "PNG");
IsSameLooking("expSlide" + hashCode, "actualSlide" + hashCode);
}
示例2: SlideData
private SlideData(Slide slide)
{
var hashCode = DateTime.Now.GetHashCode();
SlideImage = "slide" + hashCode;
slide.Export(Path.GetTempPath() + SlideImage, "PNG");
Animation = new List<IEffectData>();
var seq = slide.TimeLine.MainSequence;
for (int i = 1; i <= seq.Count; ++i)
{
var effect = seq[i];
Animation.Add(EffectData.FromEffect(effect));
}
}
示例3: GetSlideImage
private static Image GetSlideImage(Slide s, MemoryStream ms)
{
// Export the slide to a temporary file
string filename = tfc.BasePath + "\\" + Guid.NewGuid().ToString() + ".emf";
tfc.AddFile(filename, false);
s.Export(filename, "EMF", 0, 0);
// Create a Metafile from that file and serialize it for transport
// Pri2: Shouldn't this just be the EMF stream bytes, more cross platform?
Image image = Image.FromFile(filename);
// Check for size overage and downconvert to JPG if EMF is too large
// Note: By default EMF is the best, but we switch to JPG after a larger size
// TODO: The max EMF size should be read from the UI or config file
if (ImageSize(image, ms) > 250000)
{
image.Dispose();
filename = tfc.BasePath + "\\" + Guid.NewGuid().ToString() + ".jpeg";
tfc.AddFile(filename, false);
// TODO: The width/height should be read from the UI or config file
s.Export(filename, "JPG", 1200, 900);
image = Image.FromFile(filename);
// TODO: EMF is better quality than JPG, so we have to ensure that we are not
// creating a bigger file with less quality
}
return image;
}
示例4: GenerateThumbnail
private void GenerateThumbnail(Slide slide)
{
var Width = Convert.ToInt32(ThisAddIn.instance.Application.ActivePresentation.SlideMaster.Width);
var Height = Convert.ToInt32(ThisAddIn.instance.Application.ActivePresentation.SlideMaster.Height);
var filename = System.IO.Directory.GetCurrentDirectory().ToString() + "\\pptSlideThumbnail" + slide.SlideNumber + ".png";
try
{
slide.Export(filename, "PNG", Width, Height);
}
catch (Exception ex)
{
}
BitmapImage img = new BitmapImage();
MemoryStream ms = new MemoryStream(File.ReadAllBytes(filename));
PngBitmapDecoder bd = new PngBitmapDecoder(ms, BitmapCreateOptions.IgnoreImageCache, BitmapCacheOption.None);
ImageSource image = bd.Frames[0];
if (slideThumbs.Any(c => c.slideNumber == slide.SlideNumber))
slideThumbs.Remove(slideThumbs.Where(c => c.slideNumber == slide.SlideNumber).First());
slideThumbs.Add(new SlideThumbnail { thumbnail = image, slideNumber = slide.SlideNumber });
}
示例5: GetSlideByteArray
/// <summary>
/// Gets the image data of the entire given <code>Slide</code>.
/// </summary>
/// <param name="slide">The <code>Slide</code>.</param>
/// <returns>The image data of the entire slide.</returns>
private byte[] GetSlideByteArray(Slide slide)
{
// get a temp filename
String filename = Path.GetTempFileName();
// export the slide to this file location
slide.Export(filename, Constants.EXPORT_FILETYPE, Constants.EXPORT_WIDTH, Constants.EXPORT_HEIGHT);
// read all contents into the buffer
byte[] buffer = File.ReadAllBytes(filename);
// and remove the file afterwards, because that's nice
File.Delete(filename);
return buffer;
}
示例6: ExportSlide
public static void ExportSlide(Slide slide, string exportPath)
{
slide.Export(exportPath,
"PNG",
(int) GetDesiredExportWidth(),
(int) GetDesiredExportHeight());
}
示例7: Ppt2imgProc
protected virtual int Ppt2imgProc(Slide slide, int idx, int file_c)
{
this.Total[idx] = 1;
var spath = String.Format(this.AsDstF, file_c);
var as_dir = Path.GetDirectoryName(spath);
if (!Directory.Exists(as_dir))
{
Directory.CreateDirectory(as_dir);
}
if (this.ShowLog)
{
L.D("ppt2img parsing file({0},{1}) to {2}", this.AsSrc, file_c, spath);
}
slide.Export(spath, this.FilterName, 0, 0);
var rspath = String.Format(this.DstF, this.Beg + file_c);
this.Result.Count += 1;
this.Result.Files.Add(rspath);
this.Done[idx] = 1;
this.OnDone();
return 1;
}
示例8: GetSlideImage
private static Image GetSlideImage(Slide s, MemoryStream ms)
{
// Export the slide to a temporary file
string filename = tfc.BasePath + "\\" + Guid.NewGuid().ToString() + ".emf";
tfc.AddFile(filename, false);
s.Export(filename, "EMF", 0, 0);
// Create a Metafile from that file and serialize it for transport
// Pri2: Shouldn't this just be the EMF stream bytes, more cross platform?
Image image = Image.FromFile(filename);
// Check for size overage and downconvert to JPG if EMF is too large
// Note: By default EMF is the best, but we switch to JPG after a larger size
// TODO: The max EMF size should be read from the UI or config file
if (ImageSize(image, ms) > 250000)
{
image.Dispose();
//We can get reasonable reliability and quality by exporting wmf from PPT, then using
//.Net to make jpg. Exporting directly to jpg was found to be flaky with some
//PPT versions, and to result in worse quality.
string wmffilename = tfc.BasePath + "\\" + Guid.NewGuid().ToString() + ".wmf";
string jpgfilename = tfc.BasePath + "\\" + Guid.NewGuid().ToString() + ".jpg";
tfc.AddFile(wmffilename, false);
tfc.AddFile(jpgfilename, false);
s.Export(wmffilename, "WMF", 0, 0);
//Convert to jpg
Image img = Image.FromFile(wmffilename);
img.Save(jpgfilename, ImageFormat.Jpeg);
img.Dispose();
image = Image.FromFile(jpgfilename);
}
return image;
}
示例9: UploadAsync
public Task<dynamic> UploadAsync(Slide slide)
{
var tempFileString = Guid.NewGuid().ToString();
var questionnaireImageFile = _tempPath + tempFileString + ".png";
slide.Export(questionnaireImageFile, "png", 640, (int)(640 * slide.Master.Height / slide.Master.Width));
return Task.Factory.StartNew(()=> UploadTempFile(questionnaireImageFile));
}
示例10: GetSlideMd5
//deprecated
public string GetSlideMd5(Slide slide)
{
var questionnaire = Deserialize(slide);
var questionnaireImageFile = _tempPath + questionnaire.id + ".png";
if (File.Exists(questionnaireImageFile))
{
File.Delete(questionnaireImageFile);
}
slide.Export(questionnaireImageFile, "png", 640, (int)(640 * slide.Master.Height / slide.Master.Width));
return GetFileMd5Code(questionnaireImageFile);
}