• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Packaging.ImagePart类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DocumentFormat.OpenXml.Packaging.ImagePart的典型用法代码示例。如果您正苦于以下问题:C# ImagePart类的具体用法?C# ImagePart怎么用?C# ImagePart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ImagePart类属于DocumentFormat.OpenXml.Packaging命名空间,在下文中一共展示了ImagePart类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
     }
 }
开发者ID:mvlasenko,项目名称:TridionDesktopTools,代码行数:10,代码来源:DocumentBuilder.cs


示例2: ConvertBack

 public static XLPictureType ConvertBack(ImagePart imagePart)
 {
     switch (imagePart.ContentType)
     {
         case "image/bmp": return XLPictureType.Bmp;
         case "image/gif": return XLPictureType.Gif;
         case "image/png": return XLPictureType.Png;
         case "image/jpeg": return XLPictureType.Jpeg;
         case "image/tif": return XLPictureType.Tiff;
         default:
             throw new ArgumentException("not-supported content-type: " + imagePart.ContentType);
     }
 }
开发者ID:hal1932,项目名称:ClosedXML,代码行数:13,代码来源:XLPictureType.cs


示例3: WriteImage

 public void WriteImage(ImagePart part)
 {
     using (Stream s = part.GetStream(FileMode.Create, FileAccess.ReadWrite))
         s.Write(Image, 0, Image.GetUpperBound(0) + 1);
 }
开发者ID:BogdanDamianC,项目名称:Open-Xml-PowerTools,代码行数:5,代码来源:PtOpenXmlUtil.cs


示例4: ManageImageCopy

 // General function for handling images that tries to use an existing image if they are the same
 private static ImageData ManageImageCopy(ImagePart oldImage, OpenXmlPart newContentPart, List<ImageData> images)
 {
     ImageData oldImageData = new ImageData(newContentPart, oldImage);
     foreach (ImageData item in images)
     {
         if (newContentPart != item.ContentPart)
             continue;
         if (item.Compare(oldImageData))
             return item;
     }
     images.Add(oldImageData);
     return oldImageData;
 }
开发者ID:jecabana,项目名称:Portal-Vanity-Daniel-en-stand-by,代码行数:14,代码来源:DocumentBuilder.cs


示例5: 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);
     }
 }
开发者ID:huamouse,项目名称:Taoqi,代码行数:9,代码来源:DocumentBuilder.cs


示例6: ManageImageCopy

 // General function for handling images that tries to use an existing image if they are the same
 private static ImageData ManageImageCopy(ImagePart oldImage, List<ImageData> images)
 {
     ImageData oldImageData = new ImageData(oldImage);
     foreach (ImageData item in images)
     {
         if (item.Compare(oldImageData))
             return item;
     }
     images.Add(oldImageData);
     return oldImageData;
 }
开发者ID:huamouse,项目名称:Taoqi,代码行数:12,代码来源:DocumentBuilder.cs


示例7: AddImagePart

 /// <summary>
 /// Adds a ImagePart to the WorksheetPart.
 /// </summary>
 /// <param name="contentType">the content type of the ImagePart.</param>
 /// <param name="id">The relationship id.</param>
 /// <returns>The newly added part.</returns>
 public ImagePart AddImagePart(string contentType, string id)
 {
     ImagePart childPart = new ImagePart();
     this.InitPart(childPart, contentType, id);
     return childPart;
 }
开发者ID:RicardoLo,项目名称:Open-XML-SDK,代码行数:12,代码来源:package.cs


示例8: CreatePartCore

        /// <summary>
        /// Create an instance of OpenXmlPart according to the given relationship type.
        /// </summary>
        /// <param name="openXmlPackage">The container OpenXmlPackage.</param>
        /// <param name="relationshipType">The relationship type of the target part.</param>
        /// <param name="openXmlPart">The created instance of OpenXmlPart.</param>
        /// <remarks>This partial method will be generated by code generaotr.</remarks>
        static partial void CreatePartCore(OpenXmlPackage openXmlPackage, string relationshipType, ref OpenXmlPart openXmlPart)
        {
            if (openXmlPackage == null)
            {
				throw new ArgumentNullException("openXmlPackage");
            }
            if (relationshipType == null)
            {
                throw new ArgumentNullException("relationshipType");
            }
            
            if (openXmlPackage is WordprocessingDocument)
            {
                switch (relationshipType)
                {
					case MainDocumentPart.RelationshipTypeConstant:
	openXmlPart = new MainDocumentPart();
	return;
case CustomXmlPart.RelationshipTypeConstant:
	openXmlPart = new CustomXmlPart();
	return;
case CustomXmlPropertiesPart.RelationshipTypeConstant:
	openXmlPart = new CustomXmlPropertiesPart();
	return;
case GlossaryDocumentPart.RelationshipTypeConstant:
	openXmlPart = new GlossaryDocumentPart();
	return;
case WordprocessingCommentsPart.RelationshipTypeConstant:
	openXmlPart = new WordprocessingCommentsPart();
	return;
case AlternativeFormatImportPart.RelationshipTypeConstant:
	openXmlPart = new AlternativeFormatImportPart();
	return;
case ChartPart.RelationshipTypeConstant:
	openXmlPart = new ChartPart();
	return;
case ChartDrawingPart.RelationshipTypeConstant:
	openXmlPart = new ChartDrawingPart();
	return;
case ImagePart.RelationshipTypeConstant:
	openXmlPart = new ImagePart();
	return;
case EmbeddedPackagePart.RelationshipTypeConstant:
	openXmlPart = new EmbeddedPackagePart();
	return;
case ThemeOverridePart.RelationshipTypeConstant:
	openXmlPart = new ThemeOverridePart();
	return;
case ChartStylePart.RelationshipTypeConstant:
	openXmlPart = new ChartStylePart();
	return;
case ChartColorStylePart.RelationshipTypeConstant:
	openXmlPart = new ChartColorStylePart();
	return;
case DiagramColorsPart.RelationshipTypeConstant:
	openXmlPart = new DiagramColorsPart();
	return;
case DiagramDataPart.RelationshipTypeConstant:
	openXmlPart = new DiagramDataPart();
	return;
case SlidePart.RelationshipTypeConstant:
	openXmlPart = new SlidePart();
	return;
case DiagramPersistLayoutPart.RelationshipTypeConstant:
	openXmlPart = new DiagramPersistLayoutPart();
	return;
case DiagramLayoutDefinitionPart.RelationshipTypeConstant:
	openXmlPart = new DiagramLayoutDefinitionPart();
	return;
case DiagramStylePart.RelationshipTypeConstant:
	openXmlPart = new DiagramStylePart();
	return;
case EmbeddedObjectPart.RelationshipTypeConstant:
	openXmlPart = new EmbeddedObjectPart();
	return;
case VmlDrawingPart.RelationshipTypeConstant:
	openXmlPart = new VmlDrawingPart();
	return;
case LegacyDiagramTextPart.RelationshipTypeConstant:
	openXmlPart = new LegacyDiagramTextPart();
	return;
case EmbeddedControlPersistenceBinaryDataPart.RelationshipTypeConstant:
	openXmlPart = new EmbeddedControlPersistenceBinaryDataPart();
	return;
case NotesSlidePart.RelationshipTypeConstant:
	openXmlPart = new NotesSlidePart();
	return;
case NotesMasterPart.RelationshipTypeConstant:
	openXmlPart = new NotesMasterPart();
	return;
case ThemePart.RelationshipTypeConstant:
	openXmlPart = new ThemePart();
	return;
//.........这里部分代码省略.........
开发者ID:RicardoLo,项目名称:Open-XML-SDK,代码行数:101,代码来源:package.cs


示例9: GenerateImagePart1Content

 // Generates content of imagePart1.
 private void GenerateImagePart1Content(ImagePart imagePart1)
 {
     System.IO.Stream data = GetBinaryDataStream(imagePart1Data);
     imagePart1.FeedData(data);
     data.Close();
 }
开发者ID:javierlov,项目名称:PautasElectronica,代码行数:7,代码来源:csOP_CALENDARIO_NUMERICO.cs


示例10: RemovePictures

        /// <summary>
        /// Removes pictures in a excel sheet
        /// </summary>
        /// <param name="worksheetPart">WorksheetPart</param>
        private static void RemovePictures(WorksheetPart worksheetPart)
        {
            ImagePart[] imageParts = new ImagePart[worksheetPart.DrawingsPart.ImageParts.Count()];
            worksheetPart.DrawingsPart.ImageParts.ToList().CopyTo(imageParts);
            foreach (var imagePart in imageParts)
            {
                worksheetPart.DrawingsPart.DeletePart(imagePart);
            }

            foreach (var val in worksheetPart.DrawingsPart.WorksheetDrawing.Descendants<ss.Picture>())
            {
                val.Parent.Remove();
            }
        }
开发者ID:CDLUC3,项目名称:DataUp_Dataverse,代码行数:18,代码来源:ExcelFileHelper.cs


示例11: GenerateImagePartTopicRankContent

 // Generates content of imagePart7.
 private void GenerateImagePartTopicRankContent(ImagePart imagePart, string imageStringData)
 {
     System.IO.Stream data = GetBinaryDataStream(imageStringData);
     imagePart.FeedData(data);
     data.Close();
 }
开发者ID:julienblin,项目名称:RadarPOC,代码行数:7,代码来源:OpinionDocument-GeneratedOpenXml.cs


示例12: GenerateImagePartOverallEvalContent

 // Generates content of imagePart4.
 private void GenerateImagePartOverallEvalContent(ImagePart imagePart, string imagePartData)
 {
     System.IO.Stream data = GetBinaryDataStream(imagePartData);
     imagePart.FeedData(data);
     data.Close();
 }
开发者ID:julienblin,项目名称:RadarPOC,代码行数:7,代码来源:OpinionDocument-GeneratedOpenXml.cs


示例13: 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);
                    }

                }
            }
        }
开发者ID:vandersmissenc,项目名称:OpenXmlDocumentGenerator,代码行数:37,代码来源:OpenXmlHelper.cs


示例14: 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);
         }
     }
 }
开发者ID:rahmatsyaparudin,项目名称:KP_Raport,代码行数:13,代码来源:WorksheetFunctions.cs


示例15: GetIdOfImagePart

 /// <summary>
 /// Gets the relationship ID of a given image part.
 /// </summary>
 /// <param name="imagePart">The image part.</param>
 /// <returns>The relationship ID of the image part.</returns>
 internal string GetIdOfImagePart(ImagePart imagePart)
 {
     return this.slidePart.GetIdOfPart(imagePart);
 }
开发者ID:wuqingman,项目名称:PptxTemplater,代码行数:9,代码来源:PptxSlide.cs


示例16: SetImagePart

 internal void SetImagePart(ImagePart part)
 {
     ImagePart = part;
 }
开发者ID:hal1932,项目名称:ClosedXML,代码行数:4,代码来源:XLPicture.cs



注:本文中的DocumentFormat.OpenXml.Packaging.ImagePart类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Packaging.MainDocumentPart类代码示例发布时间:2022-05-24
下一篇:
C# Drawing.Paragraph类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap