예제 #1
0
        /// <summary>
        /// Convert color in ClosedXML representation to specified OpenXML type.
        /// </summary>
        /// <typeparam name="T">The descendant of <see cref="X14.ColorType"/>.</typeparam>
        /// <param name="openXMLColor">The existing instance of ColorType.</param>
        /// <param name="xlColor">Color in ClosedXML format.</param>
        /// <param name="isDifferential">Flag specifiying that the color should be saved in
        /// differential format (affects the transparent color processing).</param>
        /// <returns>The original color in OpenXML format.</returns>
        public static T FromClosedXMLColor <T>(this X14.ColorType openXMLColor, XLColor xlColor, bool isDifferential = false)
            where T : X14.ColorType
        {
            var adapter = new X14ColorTypeAdapter(openXMLColor);

            FillFromClosedXMLColor(adapter, xlColor, isDifferential);
            return((T)adapter.ColorType);
        }
예제 #2
0
 /// <summary>
 /// Convert color in OpenXML representation to ClosedXML type.
 /// </summary>
 /// <param name="openXMLColor">Color in OpenXML format.</param>
 /// <param name="colorCache">The dictionary containing parsed colors to optimize performance.</param>
 /// <returns>The color in ClosedXML format.</returns>
 public static XLColor ToClosedXMLColor(this X14.ColorType openXMLColor, IDictionary <string, Drawing.Color> colorCache = null)
 {
     return(ConvertToClosedXMLColor(openXMLColor, colorCache));
 }
예제 #3
0
 /// <summary>
 /// Convert color in ClosedXML representation to specified OpenXML type.
 /// </summary>
 /// <typeparam name="T">The descendant of <see cref="X14.ColorType"/>.</typeparam>
 /// <param name="openXMLColor">The existing instance of ColorType.</param>
 /// <param name="xlColor">Color in ClosedXML format.</param>
 /// <param name="isDifferential">Flag specifiying that the color should be saved in
 /// differential format (affects the transparent color processing).</param>
 /// <returns>The original color in OpenXML format.</returns>
 public static T FromClosedXMLColor <T>(this X14.ColorType openXMLColor, XLColor xlColor, bool isDifferential = false)
     where T : X14.ColorType
 {
     FillFromClosedXMLColor(openXMLColor, xlColor, isDifferential);
     return((T)openXMLColor);
 }