Esempio n. 1
0
        ///<summary>
        ///Determines if the two font settings supplied are the same.
        ///</summary>
        protected internal static bool CompareFont(SpreadsheetStyle font1, SpreadsheetStyle font2)
        {
            if (!font1.Italic.Compare(font2.Italic))
            {
                return(false);
            }
            if (!font1.Bold.Compare(font2.Bold))
            {
                return(false);
            }
            if (!font1.Underline.Compare(font2.Underline))
            {
                return(false);
            }

            if (!font1.Color.Compare(font2.Color))
            {
                return(false);
            }
            if (!font1.FontSize.Compare(font2.FontSize))
            {
                return(false);
            }
            if (!font1.FontName.Compare(font2.FontName))
            {
                return(false);
            }
            if (!font1.FontFamily.Compare(font2.FontFamily))
            {
                return(false);
            }
            if (!font1.FontScheme.Compare(font2.FontScheme))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        ///<summary>
        ///Creates or gets an existing number format.
        ///</summary>
        public static uint CreateNumberFormat(SpreadsheetStyle style, WorkbookStylesPart styles)
        {
            NumberingFormat formatMatch = null;
            uint            formatIndex = 0; //starts at 164

            //Loop through and see if there is a matching border style
            if (styles.Stylesheet.NumberingFormats != null)
            {
                foreach (var formatElement in styles.Stylesheet.NumberingFormats)
                {
                    var format = (NumberingFormat)formatElement;

                    //If we have a match then use this font
                    if (SpreadsheetStyle.CompareNumberFormat(format, style))
                    {
                        formatMatch = format;
                        break;
                    }
                    formatIndex += Convert.ToUInt32(1);
                }
            }

            //Add the new number format if not found
            if (formatMatch == null)
            {
                NumberingFormat format = style.ToNumberFormat();

                format.NumberFormatId = formatIndex + Convert.ToUInt32(164);
                if (styles.Stylesheet.NumberingFormats == null)
                {
                    styles.Stylesheet.NumberingFormats = new NumberingFormats();
                }
                styles.Stylesheet.NumberingFormats.AppendChild <NumberingFormat>(format);
                styles.Stylesheet.NumberingFormats.Count = formatIndex + Convert.ToUInt32(1);
            }

            return(formatIndex + Convert.ToUInt32(164));
        }
Esempio n. 3
0
 ///<summary>
 ///Determines if the two format settings supplied are the same.
 ///</summary>
 protected internal static bool CompareNumberFormat(NumberingFormat format1, SpreadsheetStyle format2)
 {
     return(CompareNumberFormat(new SpreadsheetStyle(format1), format2));
 }
Esempio n. 4
0
 ///<summary>
 ///Determines if the two alignment settings supplied are the same.
 ///</summary>
 protected internal static bool CompareAlignment(Alignment alignment1, SpreadsheetStyle alignment2)
 {
     return(CompareAlignment(new SpreadsheetStyle(alignment1), alignment2));
 }
Esempio n. 5
0
 ///<summary>
 ///Determines if the two border settings supplied are the same.
 ///</summary>
 protected internal static bool CompareBorder(Border border1, SpreadsheetStyle border2)
 {
     return(CompareBorder(new SpreadsheetStyle(border1), border2));
 }
Esempio n. 6
0
 ///<summary>
 ///Determines if the two fill settings supplied are the same.
 ///</summary>
 protected internal static bool CompareFill(Fill fill1, SpreadsheetStyle fill2)
 {
     return(CompareFill(new SpreadsheetStyle(fill1), fill2));
 }
Esempio n. 7
0
 ///<summary>
 ///Determines if the two font settings supplied are the same.
 ///</summary>
 protected internal static bool CompareFont(Font font1, SpreadsheetStyle font2)
 {
     return(CompareFont(new SpreadsheetStyle(font1), font2));
 }