本文整理汇总了C#中DocumentFormat.OpenXml.Packaging.ImagePart.GetStream方法的典型用法代码示例。如果您正苦于以下问题:C# ImagePart.GetStream方法的具体用法?C# ImagePart.GetStream怎么用?C# ImagePart.GetStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentFormat.OpenXml.Packaging.ImagePart
的用法示例。
在下文中一共展示了ImagePart.GetStream方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImageData
public ImageData(OpenXmlPart contentPart, ImagePart part)
{
ContentType = part.ContentType;
ContentPart = contentPart;
using (Stream s = part.GetStream(FileMode.Open, FileAccess.Read))
{
Image = new byte[s.Length];
s.Read(Image, 0, (int)s.Length);
}
}
示例2: WriteImage
public void WriteImage(ImagePart part)
{
using (Stream s = part.GetStream(FileMode.Create, FileAccess.ReadWrite))
s.Write(Image, 0, Image.GetUpperBound(0) + 1);
}
示例3: ImageData
public ImageData(ImagePart part)
{
m_ContentType = part.ContentType;
using (Stream s = part.GetStream(FileMode.Open, FileAccess.Read))
{
m_Image = new byte[s.Length];
s.Read(m_Image, 0, (int)s.Length);
}
}
示例4: 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);
}
}
}