public ThumbnailPart AddThumbnailPart(ThumbnailPartType partType) { var contentType = ThumbnailPartTypeInfo.GetContentType(partType); var partExtension = ThumbnailPartTypeInfo.GetTargetExtension(partType); OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension); return(AddThumbnailPart(contentType)); }
/// <summary> /// Adds a ThumbnailPart to the WordprocessingDocument. /// </summary> /// <param name="partType">The type of the ThumbnailPart.</param> /// <returns>The newly added ThumbnailPart.</returns> public ThumbnailPart AddThumbnailPart(ThumbnailPartType partType) { string contentType = ThumbnailPartTypeInfo.GetContentType(partType); string partExtension = ThumbnailPartTypeInfo.GetTargetExtension(partType); PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension); return(AddThumbnailPart(contentType)); }
internal static string GetTargetExtension(ThumbnailPartType imageType) { switch (imageType) { case ThumbnailPartType.Jpeg: return(".jpg"); case ThumbnailPartType.Emf: return(".emf"); case ThumbnailPartType.Wmf: return(".wmf"); default: return(".image"); } }
internal static string GetContentType(ThumbnailPartType imageType) { switch (imageType) { case ThumbnailPartType.Jpeg: return("image/jpeg"); case ThumbnailPartType.Emf: return("image/x-emf"); case ThumbnailPartType.Wmf: return("image/x-wmf"); default: throw new ArgumentOutOfRangeException(nameof(imageType)); } }
/// <summary> /// Adds a ThumbnailPart to the MainDocumentPart. /// </summary> /// <param name="partType">The part type of the ThumbnailPart.</param> /// <param name="id">The relationship id.</param> /// <returns>The newly added part.</returns> public ThumbnailPart AddThumbnailPart(ThumbnailPartType partType, string id) { string contentType = ThumbnailPartTypeInfo.GetContentType(partType); string partExtension = ThumbnailPartTypeInfo.GetTargetExtension(partType); OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension); return AddThumbnailPart(contentType, id); }
internal static string GetTargetExtension(ThumbnailPartType imageType) { switch (imageType) { case ThumbnailPartType.Jpeg: return ".jpg"; case ThumbnailPartType.Emf: return ".emf"; case ThumbnailPartType.Wmf: return ".wmf"; default: return ".image"; } }
internal static string GetContentType(ThumbnailPartType imageType) { switch (imageType) { case ThumbnailPartType.Jpeg: return "image/jpeg"; case ThumbnailPartType.Emf: return "image/x-emf"; case ThumbnailPartType.Wmf: return "image/x-wmf"; default: throw new ArgumentOutOfRangeException("imageType"); } }
internal static string GetContentType(ThumbnailPartType imageType) => imageType switch {