/// <summary> /// Apply a named cell style to a range of columns. Existing styles are kept, unless the chosen named cell style overrides those styles. /// </summary> /// <param name="StartColumnIndex">The column index of the starting column.</param> /// <param name="EndColumnIndex">The column index of the ending column.</param> /// <param name="NamedCellStyle">The named cell style to be applied.</param> /// <returns>True if the column indices are valid. False otherwise.</returns> public bool ApplyNamedCellStyleToColumn(int StartColumnIndex, int EndColumnIndex, SLNamedCellStyleValues NamedCellStyle) { int iStartColumnIndex = 1, iEndColumnIndex = 1; bool result = false; if (StartColumnIndex < EndColumnIndex) { iStartColumnIndex = StartColumnIndex; iEndColumnIndex = EndColumnIndex; } else { iStartColumnIndex = EndColumnIndex; iEndColumnIndex = StartColumnIndex; } SLStyle style = new SLStyle(SimpleTheme.MajorLatinFont, SimpleTheme.MinorLatinFont, SimpleTheme.listThemeColors, SimpleTheme.listIndexedColors); if (iStartColumnIndex >= 1 && iStartColumnIndex <= SLConstants.ColumnLimit && iEndColumnIndex >= 1 && iEndColumnIndex <= SLConstants.ColumnLimit) { result = true; int i = 0; for (i = iStartColumnIndex; i <= iEndColumnIndex; ++i) { style = this.GetColumnStyle(i); style.ApplyNamedCellStyle(NamedCellStyle); this.SetColumnStyle(i, style); slws.RowColumnStyleHistory.Add(new SLRowColumnStyleHistory(false, i)); } } return result; }
/// <summary> /// Apply a named cell style to a row. Existing styles are kept, unless the chosen named cell style overrides those styles. /// </summary> /// <param name="RowIndex">The row index.</param> /// <param name="NamedCellStyle">The named cell style to be applied.</param> /// <returns>True if the row index is valid. False otherwise.</returns> public bool ApplyNamedCellStyleToRow(int RowIndex, SLNamedCellStyleValues NamedCellStyle) { return ApplyNamedCellStyleToRow(RowIndex, RowIndex, NamedCellStyle); }
/// <summary> /// Apply a named cell style to a column. Existing styles are kept, unless the chosen named cell style overrides those styles. /// </summary> /// <param name="ColumnIndex">The column index.</param> /// <param name="NamedCellStyle">The named cell style to be applied.</param> /// <returns>True if the column index is valid. False otherwise.</returns> public bool ApplyNamedCellStyleToColumn(int ColumnIndex, SLNamedCellStyleValues NamedCellStyle) { return ApplyNamedCellStyleToColumn(ColumnIndex, ColumnIndex, NamedCellStyle); }
/// <summary> /// Apply a named cell style to a range of cells. Existing styles are kept, unless the chosen named cell style overrides those styles. /// </summary> /// <param name="StartRowIndex">The row index of the starting row.</param> /// <param name="StartColumnIndex">The column index of the starting column.</param> /// <param name="EndRowIndex">The row index of the ending row.</param> /// <param name="EndColumnIndex">The column index of the ending column.</param> /// <param name="NamedCellStyle">The named cell style to be applied.</param> /// <returns>True if successful. False otherwise.</returns> public bool ApplyNamedCellStyle(int StartRowIndex, int StartColumnIndex, int EndRowIndex, int EndColumnIndex, SLNamedCellStyleValues NamedCellStyle) { int iStartRowIndex = 1, iEndRowIndex = 1, iStartColumnIndex = 1, iEndColumnIndex = 1; bool result = false; if (StartRowIndex < EndRowIndex) { iStartRowIndex = StartRowIndex; iEndRowIndex = EndRowIndex; } else { iStartRowIndex = EndRowIndex; iEndRowIndex = StartRowIndex; } if (StartColumnIndex < EndColumnIndex) { iStartColumnIndex = StartColumnIndex; iEndColumnIndex = EndColumnIndex; } else { iStartColumnIndex = EndColumnIndex; iEndColumnIndex = StartColumnIndex; } SLStyle style = new SLStyle(SimpleTheme.MajorLatinFont, SimpleTheme.MinorLatinFont, SimpleTheme.listThemeColors, SimpleTheme.listIndexedColors); if (SLTool.CheckRowColumnIndexLimit(iStartRowIndex, iStartColumnIndex) && SLTool.CheckRowColumnIndexLimit(iEndRowIndex, iEndColumnIndex)) { result = true; int i = 0, j = 0; for (i = iStartRowIndex; i <= iEndRowIndex; ++i) { for (j = iStartColumnIndex; j <= iEndColumnIndex; ++j) { style = this.GetCellStyle(i, j); style.ApplyNamedCellStyle(NamedCellStyle); this.SetCellStyle(i, j, style); } } } return result; }
/// <summary> /// Apply a named cell style to a range of cells. Existing styles are kept, unless the chosen named cell style overrides those styles. /// </summary> /// <param name="StartCellReference">The cell reference of the start cell of the cell range, such as "A1". This is typically the top-left cell.</param> /// <param name="EndCellReference">The cell reference of the end cell of the cell range, such as "A1". This is typically the bottom-right cell.</param> /// <param name="NamedCellStyle">The named cell style to be applied.</param> /// <returns>True if successful. False otherwise.</returns> public bool ApplyNamedCellStyle(string StartCellReference, string EndCellReference, SLNamedCellStyleValues NamedCellStyle) { int iStartRowIndex = -1; int iStartColumnIndex = -1; int iEndRowIndex = -1; int iEndColumnIndex = -1; if (!SLTool.FormatCellReferenceToRowColumnIndex(StartCellReference, out iStartRowIndex, out iStartColumnIndex) || !SLTool.FormatCellReferenceToRowColumnIndex(EndCellReference, out iEndRowIndex, out iEndColumnIndex)) { return false; } return ApplyNamedCellStyle(iStartRowIndex, iStartColumnIndex, iEndRowIndex, iEndColumnIndex, NamedCellStyle); }
/// <summary> /// Apply a named cell style to a cell. Existing styles are kept, unless the chosen named cell style overrides those styles. /// </summary> /// <param name="RowIndex">The row index.</param> /// <param name="ColumnIndex">The column index.</param> /// <param name="NamedCellStyle">The named cell style to be applied.</param> /// <returns>True if successful. False otherwise.</returns> public bool ApplyNamedCellStyle(int RowIndex, int ColumnIndex, SLNamedCellStyleValues NamedCellStyle) { return ApplyNamedCellStyle(RowIndex, ColumnIndex, RowIndex, ColumnIndex, NamedCellStyle); }
/// <summary> /// Apply a named cell style to a cell. Existing styles are kept, unless the chosen named cell style overrides those styles. /// </summary> /// <param name="CellReference">The cell reference, such as "A1".</param> /// <param name="NamedCellStyle">The named cell style to be applied.</param> /// <returns>True if successful. False otherwise.</returns> public bool ApplyNamedCellStyle(string CellReference, SLNamedCellStyleValues NamedCellStyle) { int iRowIndex = -1; int iColumnIndex = -1; if (!SLTool.FormatCellReferenceToRowColumnIndex(CellReference, out iRowIndex, out iColumnIndex)) { return false; } return ApplyNamedCellStyle(iRowIndex, iColumnIndex, NamedCellStyle); }
/// <summary> /// Apply a named cell style. Existing styles are kept, unless the chosen named cell style overrides those styles. /// </summary> /// <param name="NamedCellStyle">The named cell style to be applied.</param> public void ApplyNamedCellStyle(SLNamedCellStyleValues NamedCellStyle) { SLFont font; SLFill fill; SLBorder border; switch (NamedCellStyle) { case SLNamedCellStyleValues.Normal: RemoveFormatCode(); font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); this.Font = font; RemoveFill(); RemoveBorder(); // normal is the only one that removes alignment RemoveAlignment(); break; case SLNamedCellStyleValues.Bad: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.FontColor = System.Drawing.Color.FromArgb(0xFF, 0x9C, 0, 0x06); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xC7, 0xCE)); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Good: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.FontColor = System.Drawing.Color.FromArgb(0xFF, 0, 0x61, 0); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(System.Drawing.Color.FromArgb(0xFF, 0xC6, 0xEF, 0xCE)); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Neutral: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.FontColor = System.Drawing.Color.FromArgb(0xFF, 0x9C, 0x65, 0); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xEB, 0x9C)); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Calculation: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.Bold = true; font.FontColor = System.Drawing.Color.FromArgb(0xFF, 0xFA, 0x7D, 0); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(System.Drawing.Color.FromArgb(0xFF, 0xF2, 0xF2, 0xF2)); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; border = new SLBorder(this.listThemeColors, this.listIndexedColors); border.LeftBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x7F, 0x7F, 0x7F); border.LeftBorder.BorderStyle = BorderStyleValues.Thin; border.RightBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x7F, 0x7F, 0x7F); border.RightBorder.BorderStyle = BorderStyleValues.Thin; border.TopBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x7F, 0x7F, 0x7F); border.TopBorder.BorderStyle = BorderStyleValues.Thin; border.BottomBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x7F, 0x7F, 0x7F); border.BottomBorder.BorderStyle = BorderStyleValues.Thin; this.Border = border; break; case SLNamedCellStyleValues.CheckCell: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.Bold = true; font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(System.Drawing.Color.FromArgb(0xFF, 0xA5, 0xA5, 0xA5)); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; border = new SLBorder(this.listThemeColors, this.listIndexedColors); border.LeftBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x3F, 0x3F, 0x3F); border.LeftBorder.BorderStyle = BorderStyleValues.Double; border.RightBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x3F, 0x3F, 0x3F); border.RightBorder.BorderStyle = BorderStyleValues.Double; border.TopBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x3F, 0x3F, 0x3F); border.TopBorder.BorderStyle = BorderStyleValues.Double; border.BottomBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x3F, 0x3F, 0x3F); border.BottomBorder.BorderStyle = BorderStyleValues.Double; this.Border = border; break; case SLNamedCellStyleValues.ExplanatoryText: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.Italic = true; font.FontColor = System.Drawing.Color.FromArgb(0xFF, 0x7F, 0x7F, 0x7F); this.Font = font; // no change to fill // no change to border break; case SLNamedCellStyleValues.Input: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.FontColor = System.Drawing.Color.FromArgb(0xFF, 0x3F, 0x3F, 0x76); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xCC, 0x99)); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; border = new SLBorder(this.listThemeColors, this.listIndexedColors); border.LeftBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x7F, 0x7F, 0x7F); border.LeftBorder.BorderStyle = BorderStyleValues.Thin; border.RightBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x7F, 0x7F, 0x7F); border.RightBorder.BorderStyle = BorderStyleValues.Thin; border.TopBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x7F, 0x7F, 0x7F); border.TopBorder.BorderStyle = BorderStyleValues.Thin; border.BottomBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x7F, 0x7F, 0x7F); border.BottomBorder.BorderStyle = BorderStyleValues.Thin; this.Border = border; break; case SLNamedCellStyleValues.LinkedCell: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.FontColor = System.Drawing.Color.FromArgb(0xFF, 0xFA, 0x7D, 0); this.Font = font; // no change to fill border = new SLBorder(this.listThemeColors, this.listIndexedColors); border.BottomBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x80, 0x01); border.BottomBorder.BorderStyle = BorderStyleValues.Double; this.Border = border; break; case SLNamedCellStyleValues.Note: // no change to format code // Note doesn't change font or font size fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xFF, 0xCC)); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; border = new SLBorder(this.listThemeColors, this.listIndexedColors); border.LeftBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0xB2, 0xB2, 0xB2); border.LeftBorder.BorderStyle = BorderStyleValues.Thin; border.RightBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0xB2, 0xB2, 0xB2); border.RightBorder.BorderStyle = BorderStyleValues.Thin; border.TopBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0xB2, 0xB2, 0xB2); border.TopBorder.BorderStyle = BorderStyleValues.Thin; border.BottomBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0xB2, 0xB2, 0xB2); border.BottomBorder.BorderStyle = BorderStyleValues.Thin; this.Border = border; break; case SLNamedCellStyleValues.Output: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.Bold = true; font.FontColor = System.Drawing.Color.FromArgb(0xFF, 0x3F, 0x3F, 0x3F); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(System.Drawing.Color.FromArgb(0xFF, 0xF2, 0xF2, 0xF2)); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; border = new SLBorder(this.listThemeColors, this.listIndexedColors); border.LeftBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x3F, 0x3F, 0x3F); border.LeftBorder.BorderStyle = BorderStyleValues.Thin; border.RightBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x3F, 0x3F, 0x3F); border.RightBorder.BorderStyle = BorderStyleValues.Thin; border.TopBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x3F, 0x3F, 0x3F); border.TopBorder.BorderStyle = BorderStyleValues.Thin; border.BottomBorder.Color = System.Drawing.Color.FromArgb(0xFF, 0x3F, 0x3F, 0x3F); border.BottomBorder.BorderStyle = BorderStyleValues.Thin; this.Border = border; break; case SLNamedCellStyleValues.WarningText: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.FontColor = System.Drawing.Color.FromArgb(0xFF, 0xFF, 0, 0); this.Font = font; // no change to fill // no change to border break; case SLNamedCellStyleValues.Heading1: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.Heading1FontSize); font.Bold = true; font.SetFontThemeColor(SLThemeColorIndexValues.Dark2Color); this.Font = font; // no change to fill border = new SLBorder(this.listThemeColors, this.listIndexedColors); border.BottomBorder.SetBorderThemeColor(SLThemeColorIndexValues.Accent1Color); border.BottomBorder.BorderStyle = BorderStyleValues.Thick; this.Border = border; break; case SLNamedCellStyleValues.Heading2: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.Heading2FontSize); font.Bold = true; font.SetFontThemeColor(SLThemeColorIndexValues.Dark2Color); this.Font = font; // no change to fill border = new SLBorder(this.listThemeColors, this.listIndexedColors); border.BottomBorder.SetBorderThemeColor(SLThemeColorIndexValues.Accent1Color, 0.499984740745262); border.BottomBorder.BorderStyle = BorderStyleValues.Thick; this.Border = border; break; case SLNamedCellStyleValues.Heading3: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.Bold = true; font.SetFontThemeColor(SLThemeColorIndexValues.Dark2Color); this.Font = font; // no change to fill border = new SLBorder(this.listThemeColors, this.listIndexedColors); border.BottomBorder.SetBorderThemeColor(SLThemeColorIndexValues.Accent1Color, 0.399975585192419); border.BottomBorder.BorderStyle = BorderStyleValues.Medium; this.Border = border; break; case SLNamedCellStyleValues.Heading4: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.Bold = true; font.SetFontThemeColor(SLThemeColorIndexValues.Dark2Color); this.Font = font; // no change to fill // no change to border break; case SLNamedCellStyleValues.Title: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Major, SLConstants.TitleFontSize); font.Bold = true; font.SetFontThemeColor(SLThemeColorIndexValues.Dark2Color); this.Font = font; // no change to fill // no change to border break; case SLNamedCellStyleValues.Total: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.Bold = true; font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; // no change to fill border = new SLBorder(this.listThemeColors, this.listIndexedColors); border.TopBorder.SetBorderThemeColor(SLThemeColorIndexValues.Accent1Color); border.TopBorder.BorderStyle = BorderStyleValues.Thin; border.BottomBorder.SetBorderThemeColor(SLThemeColorIndexValues.Accent1Color); border.BottomBorder.BorderStyle = BorderStyleValues.Double; this.Border = border; break; case SLNamedCellStyleValues.Accent1: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent1Color); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent1Percentage20: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent1Color, 0.799981688894314); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent1Percentage40: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent1Color, 0.599993896298105); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent1Percentage60: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent1Color, 0.399975585192419); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent2: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent2Color); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent2Percentage20: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent2Color, 0.799981688894314); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent2Percentage40: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent2Color, 0.599993896298105); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent2Percentage60: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent2Color, 0.399975585192419); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent3: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent3Color); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent3Percentage20: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent3Color, 0.799981688894314); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent3Percentage40: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent3Color, 0.599993896298105); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent3Percentage60: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent3Color, 0.399975585192419); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent4: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent4Color); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent4Percentage20: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent4Color, 0.799981688894314); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent4Percentage40: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent4Color, 0.599993896298105); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent4Percentage60: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent4Color, 0.399975585192419); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent5: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent5Color); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent5Percentage20: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent5Color, 0.799981688894314); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent5Percentage40: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent5Color, 0.599993896298105); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent5Percentage60: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent5Color, 0.399975585192419); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent6: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent6Color); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent6Percentage20: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent6Color, 0.799981688894314); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent6Percentage40: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Dark1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent6Color, 0.599993896298105); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Accent6Percentage60: // no change to format code font = new SLFont(this.MajorFont, this.MinorFont, this.listThemeColors, this.listIndexedColors); font.SetFont(FontSchemeValues.Minor, SLConstants.DefaultFontSize); font.SetFontThemeColor(SLThemeColorIndexValues.Light1Color); this.Font = font; fill = new SLFill(this.listThemeColors, this.listIndexedColors); fill.SetPatternForegroundColor(SLThemeColorIndexValues.Accent6Color, 0.399975585192419); fill.SetPatternType(PatternValues.Solid); this.Fill = fill; // no change to border break; case SLNamedCellStyleValues.Comma: this.FormatCode = "_(* #,##0.00_);_(* \\(#,##0.00\\);_(* \"-\"??_);_(@_)"; // not using the "builtin" format ID //this.nfFormatCode.NumberFormatId = 43; // the font, fill and border are not changed // TODO get "actual" comma character from regional settings? break; case SLNamedCellStyleValues.Comma0: this.FormatCode = "_(* #,##0_);_(* \\(#,##0\\);_(* \"-\"_);_(@_)"; // not using the "builtin" format ID //this.nfFormatCode.NumberFormatId = 41; // the font, fill and border are not changed // TODO get "actual" comma character from regional settings? break; case SLNamedCellStyleValues.Currency: this.FormatCode = "_(\"$\"* #,##0.00_);_(\"$\"* \\(#,##0.00\\);_(\"$\"* \"-\"??_);_(@_)"; // not using the "builtin" format ID //this.nfFormatCode.NumberFormatId = 44; // the font, fill and border are not changed // TODO get "actual" currency character from regional settings? break; case SLNamedCellStyleValues.Currency0: this.FormatCode = "_(\"$\"* #,##0_);_(\"$\"* \\(#,##0\\);_(\"$\"* \"-\"_);_(@_)"; // not using the "builtin" format ID //this.nfFormatCode.NumberFormatId = 42; // the font, fill and border are not changed // TODO get "actual" currency character from regional settings? break; case SLNamedCellStyleValues.Percentage: this.FormatCode = "0%"; // not using the "builtin" format ID //this.nfFormatCode.NumberFormatId = 9; // the font, fill and border are not changed break; } }