本文整理汇总了C#中DocumentFormat.OpenXml.Packaging.ImagePart.FeedData方法的典型用法代码示例。如果您正苦于以下问题:C# ImagePart.FeedData方法的具体用法?C# ImagePart.FeedData怎么用?C# ImagePart.FeedData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentFormat.OpenXml.Packaging.ImagePart
的用法示例。
在下文中一共展示了ImagePart.FeedData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateImagePart1Content
// Generates content of imagePart1.
private void GenerateImagePart1Content(ImagePart imagePart1)
{
System.IO.Stream data = GetBinaryDataStream(imagePart1Data);
imagePart1.FeedData(data);
data.Close();
}
示例2: GenerateImagePartTopicRankContent
// Generates content of imagePart7.
private void GenerateImagePartTopicRankContent(ImagePart imagePart, string imageStringData)
{
System.IO.Stream data = GetBinaryDataStream(imageStringData);
imagePart.FeedData(data);
data.Close();
}
示例3: GenerateImage
/// <summary>
/// Generates an image icon to display inline for file representation.
/// </summary>
/// <param name="imagePart">The area to embed the icon.</param>
/// <param name="fileName">Text to display below the image.</param>
private void GenerateImage(ImagePart imagePart, String fileName)
{
int width = 1200;
int height = 800;
Bitmap bitmap = new Bitmap(width, height);
bitmap.SetResolution(600.0f, 600.0f);
using (MemoryStream ms = new MemoryStream())
{
System.Drawing.Imaging.ImageFormat format = System.Drawing.Imaging.ImageFormat.Png;
bitmap.Save(ms, format);
ms.Position = 0;
using (Graphics graphics = Graphics.FromImage(bitmap))
{
using (System.Drawing.Font font = new System.Drawing.Font("Arial", 0.3f, FontStyle.Regular, GraphicsUnit.Inch))
{
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
int centerx = (width / 4);
graphics.DrawIcon(GetIcon(Path.GetExtension(fileName)), new Rectangle(new Point(centerx, 0), new Size((width * 2) / 4, (height * 3) / 4)));
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
graphics.DrawString(fileName, font, new SolidBrush(System.Drawing.Color.Black), new Point(bitmap.Width / 2, bitmap.Height / 2), sf);
bitmap.Save(ms, format);
ms.Position = 0;
imagePart.FeedData(ms);
}
}
}
}
示例4: GenerateImagePartOverallEvalContent
// Generates content of imagePart4.
private void GenerateImagePartOverallEvalContent(ImagePart imagePart, string imagePartData)
{
System.IO.Stream data = GetBinaryDataStream(imagePartData);
imagePart.FeedData(data);
data.Close();
}
示例5: FeedDataImagePart
internal void FeedDataImagePart(ImagePart NewPart, ImagePart ExistingPart)
{
System.Drawing.Imaging.ImageFormat imgtype = SLTool.TranslateImageContentType(ExistingPart.ContentType);
using (System.Drawing.Bitmap bm = new System.Drawing.Bitmap(ExistingPart.GetStream()))
{
using (MemoryStream ms = new MemoryStream())
{
bm.Save(ms, imgtype);
ms.Position = 0;
NewPart.FeedData(ms);
}
}
}