示例#1
0
            public CellFormatSpecification CreateCellFormat(string name, int fontSize)
            {
                CellFormatSpecification cellFormatSpecification = new CellFormatSpecification(name);

                InitializeFont(this.startRange.Font, cellFormatSpecification);

                cellFormatSpecification.Font.Size = fontSize;

                return(cellFormatSpecification);
            }
示例#2
0
            public CellFormatSpecification CreateCellFormat(string name, int fontSize, XlHAlign horizontalAlignment)
            {
                CellFormatSpecification cellFormatSpecification = new CellFormatSpecification(name);

                InitializeFont(this.startRange.Font, cellFormatSpecification);

                cellFormatSpecification.Font.Size           = fontSize;
                cellFormatSpecification.HorizontalAlignment = horizontalAlignment;

                return(cellFormatSpecification);
            }
示例#3
0
            public CellFormatSpecification CreateCellFormat(string name, int fontSize, Excel.MakeBold makeBold, XlOrientation orientation)
            {
                CellFormatSpecification cellFormatSpecification = new CellFormatSpecification(name);

                InitializeFont(this.startRange.Font, cellFormatSpecification);

                cellFormatSpecification.Font.Size   = fontSize;
                cellFormatSpecification.Font.Bold   = makeBold;
                cellFormatSpecification.Orientation = orientation;

                return(cellFormatSpecification);
            }
示例#4
0
            public CellFormatSpecification CreateCellFormat(string name, CellFormatSpecification sourceFormat)
            {
                CellFormatSpecification newCellFormatSpecification = new CellFormatSpecification(name);

                InitializeFont(sourceFormat, newCellFormatSpecification);

                newCellFormatSpecification.HorizontalAlignment = sourceFormat.HorizontalAlignment;
                newCellFormatSpecification.NumberFormat        = sourceFormat.NumberFormat;
                newCellFormatSpecification.Orientation         = sourceFormat.Orientation;
                newCellFormatSpecification.VerticalAlignment   = sourceFormat.VerticalAlignment;
                newCellFormatSpecification.WrapText            = sourceFormat.WrapText;

                return(newCellFormatSpecification);
            }
示例#5
0
 public static void InitializeFont(CellFormatSpecification source, CellFormatSpecification target)
 {
     target.Font.Background    = source.Font.Background;
     target.Font.Bold          = source.Font.Bold;
     target.Font.Color         = source.Font.Color;
     target.Font.ColorIndex    = source.Font.ColorIndex;
     target.Font.FontStyle     = source.Font.FontStyle;
     target.Font.Italic        = source.Font.Italic;
     target.Font.Name          = source.Font.Name;
     target.Font.OutlineFont   = source.Font.OutlineFont;
     target.Font.Shadow        = source.Font.Shadow;
     target.Font.Size          = source.Font.Size;
     target.Font.Strikethrough = source.Font.Strikethrough;
     target.Font.Subscript     = source.Font.Subscript;
     target.Font.Superscript   = source.Font.Superscript;
     target.Font.Underline     = source.Font.Underline;
     // null by default
     //target.Font.ThemeColor = source.Font.ThemeColor;
     target.Font.TintAndShade = source.Font.TintAndShade;
     target.Font.ThemeFont    = source.Font.ThemeFont;
 }
示例#6
0
 public static void InitializeFont(Microsoft.Office.Interop.Excel.Font rangeFont, CellFormatSpecification formatSpecification)
 {
     formatSpecification.Font.Background    = rangeFont.Background;
     formatSpecification.Font.Bold          = rangeFont.Bold;
     formatSpecification.Font.Color         = rangeFont.Color;
     formatSpecification.Font.ColorIndex    = rangeFont.ColorIndex;
     formatSpecification.Font.FontStyle     = rangeFont.FontStyle;
     formatSpecification.Font.Italic        = rangeFont.Italic;
     formatSpecification.Font.Name          = rangeFont.Name;
     formatSpecification.Font.OutlineFont   = rangeFont.OutlineFont;
     formatSpecification.Font.Shadow        = rangeFont.Shadow;
     formatSpecification.Font.Size          = rangeFont.Size;
     formatSpecification.Font.Strikethrough = rangeFont.Strikethrough;
     formatSpecification.Font.Subscript     = rangeFont.Subscript;
     formatSpecification.Font.Superscript   = rangeFont.Superscript;
     formatSpecification.Font.Underline     = rangeFont.Underline;
     // null by default
     //formatSpecification.Font.ThemeColor = rangeFont.ThemeColor;
     formatSpecification.Font.TintAndShade = rangeFont.TintAndShade;
     formatSpecification.Font.ThemeFont    = rangeFont.ThemeFont;
 }