static Fonts GenerateFonts() { var fonts = new Fonts { Count = 1U, KnownFonts = true }; var font1 = new Font(); var fontSize1 = new FontSize { Val = 10D }; var color1 = new Color { Theme = 1U }; var fontName1 = new FontName { Val = "Times New Roman" }; var fontFamilyNumbering1 = new FontFamilyNumbering { Val = 1 }; var fontCharSet1 = new FontCharSet { Val = 204 }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontCharSet1); fonts.Append(font1); return(fonts); }
private static Font Font3() { var font = new Font(); var fontSize1 = new FontSize { Val = 13D }; var color1 = new Color { Theme = 1U }; var fontName1 = new FontName { Val = "Calibri" }; var fontFamilyNumbering1 = new FontFamilyNumbering { Val = 2 }; var fontScheme1 = new FontScheme { Val = FontSchemeValues.Minor }; var bold1 = new Bold(); // ReSharper disable PossiblyMistakenUseOfParamsMethod font.Append(bold1); font.Append(fontSize1); font.Append(color1); font.Append(fontName1); font.Append(fontFamilyNumbering1); font.Append(fontScheme1); // ReSharper restore PossiblyMistakenUseOfParamsMethod return(font); }
public static OpenXml.Color MapToColor(this Color color) { var c = new OpenXml.Color(); MapColor(c, color); return(c); }
private static void CreateBasicFont(Fonts fonts, Color color) { Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.AppendChild(fontSize1); font1.AppendChild(color); font1.AppendChild(fontName1); font1.AppendChild(fontFamilyNumbering1); font1.AppendChild(fontScheme1); fonts.AppendChild(font1); }
private static void CreateThemeFont(Fonts fonts) { Color color = new Color() { Theme = 1U }; CreateBasicFont(fonts, color); }
private static Border Border1() { // ReSharper disable PossiblyMistakenUseOfParamsMethod var border1 = new Border(); var leftBorder1 = new LeftBorder { Style = BorderStyleValues.Thin }; var color1 = new Color { Indexed = 64U }; leftBorder1.Append(color1); var rightBorder1 = new RightBorder { Style = BorderStyleValues.Thin }; color1 = new Color { Indexed = 64U }; rightBorder1.Append(color1); var topBorder1 = new TopBorder { Style = BorderStyleValues.Thin }; color1 = new Color { Indexed = 64U }; topBorder1.Append(color1); var bottomBorder1 = new BottomBorder { Style = BorderStyleValues.Thin }; color1 = new Color { Indexed = 64U }; bottomBorder1.Append(color1); var diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); return(border1); // ReSharper restore PossiblyMistakenUseOfParamsMethod }
private static UInt32Value CreateFont( Stylesheet styleSheet, string fontName, double?fontSize, bool isBold, System.Drawing.Color foreColor) { DocumentFormat.OpenXml.Spreadsheet.Font font = new DocumentFormat.OpenXml.Spreadsheet.Font(); if (!string.IsNullOrEmpty(fontName)) { FontName name = new FontName() { Val = fontName }; font.Append(name); } if (fontSize.HasValue) { DocumentFormat.OpenXml.Spreadsheet.FontSize size = new DocumentFormat.OpenXml.Spreadsheet.FontSize() { Val = fontSize.Value }; font.Append(size); } if (isBold == true) { Bold bold = new Bold(); font.Append(bold); } DocumentFormat.OpenXml.Spreadsheet.Color color = new DocumentFormat.OpenXml.Spreadsheet.Color() { Rgb = new HexBinaryValue() { Value = System.Drawing.ColorTranslator.ToHtml( System.Drawing.Color.FromArgb( foreColor.A, foreColor.R, foreColor.G, foreColor.B)).Replace("#", "") } }; font.Append(color); styleSheet.Fonts.Append(font); UInt32Value result = styleSheet.Fonts.Count; styleSheet.Fonts.Count++; return(result); }
private static void CreateColorFont(Fonts fonts) { Color color = new Color() { Rgb = new HexBinaryValue() { Value = "FFFFFF" } }; CreateBasicFont(fonts, color); }
static private void GenerateWorkbookStylesPartContent(WorkbookStylesPart workbookStylesPart1) { Stylesheet stylesheet1 = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); Fonts fonts1 = new Fonts() { Count = (UInt32Value)2U, KnownFonts = true }; DocumentFormat.OpenXml.Spreadsheet.Font font1 = new DocumentFormat.OpenXml.Spreadsheet.Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; DocumentFormat.OpenXml.Spreadsheet.Color color1 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); DocumentFormat.OpenXml.Spreadsheet.Font font2 = new DocumentFormat.OpenXml.Spreadsheet.Font(); Bold bold1 = new Bold(); FontSize fontSize2 = new FontSize() { Val = 11D }; DocumentFormat.OpenXml.Spreadsheet.Color color2 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Theme = (UInt32Value)1U }; FontName fontName2 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme2 = new FontScheme() { Val = FontSchemeValues.Minor }; font2.Append(bold1); font2.Append(fontSize2); font2.Append(color2); font2.Append(fontName2); font2.Append(fontFamilyNumbering2); font2.Append(fontScheme2); fonts1.Append(font1); fonts1.Append(font2); Fills fills1 = new Fills() { Count = (UInt32Value)2U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); fills1.Append(fill1); fills1.Append(fill2); Borders borders1 = new Borders() { Count = (UInt32Value)2U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); Border border2 = new Border(); LeftBorder leftBorder2 = new LeftBorder() { Style = BorderStyleValues.Thin }; DocumentFormat.OpenXml.Spreadsheet.Color color3 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Indexed = (UInt32Value)64U }; leftBorder2.Append(color3); RightBorder rightBorder2 = new RightBorder() { Style = BorderStyleValues.Thin }; DocumentFormat.OpenXml.Spreadsheet.Color color4 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Indexed = (UInt32Value)64U }; rightBorder2.Append(color4); TopBorder topBorder2 = new TopBorder() { Style = BorderStyleValues.Thin }; DocumentFormat.OpenXml.Spreadsheet.Color color5 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Indexed = (UInt32Value)64U }; topBorder2.Append(color5); BottomBorder bottomBorder2 = new BottomBorder() { Style = BorderStyleValues.Thin }; DocumentFormat.OpenXml.Spreadsheet.Color color6 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Indexed = (UInt32Value)64U }; bottomBorder2.Append(color6); DiagonalBorder diagonalBorder2 = new DiagonalBorder(); border2.Append(leftBorder2); border2.Append(rightBorder2); border2.Append(topBorder2); border2.Append(bottomBorder2); border2.Append(diagonalBorder2); borders1.Append(border1); borders1.Append(border2); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)3U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyBorder = true }; CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyBorder = true }; cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; StylesheetExtensionList stylesheetExtensionList1 = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.SlicerStyles slicerStyles1 = new X14.SlicerStyles() { DefaultSlicerStyle = "SlicerStyleLight1" }; stylesheetExtension1.Append(slicerStyles1); StylesheetExtension stylesheetExtension2 = new StylesheetExtension() { Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}" }; stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); X15.TimelineStyles timelineStyles1 = new X15.TimelineStyles() { DefaultTimelineStyle = "TimeSlicerStyleLight1" }; stylesheetExtension2.Append(timelineStyles1); stylesheetExtensionList1.Append(stylesheetExtension1); stylesheetExtensionList1.Append(stylesheetExtension2); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); workbookStylesPart1.Stylesheet = stylesheet1; }
private static Stylesheet CreateStylesheet() { Stylesheet stylesheet1 = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); Fonts fonts1 = new Fonts() { Count = (UInt32Value)2U, KnownFonts = true }; //Normal Font DocumentFormat.OpenXml.Spreadsheet.Font font1 = new DocumentFormat.OpenXml.Spreadsheet.Font(); DocumentFormat.OpenXml.Spreadsheet.FontSize fontSize1 = new DocumentFormat.OpenXml.Spreadsheet.FontSize() { Val = 11D }; DocumentFormat.OpenXml.Spreadsheet.Color color1 = new DocumentFormat.OpenXml.Spreadsheet.Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); fonts1.Append(font1); //Bold Font DocumentFormat.OpenXml.Spreadsheet.Font bFont = new DocumentFormat.OpenXml.Spreadsheet.Font(); DocumentFormat.OpenXml.Spreadsheet.FontSize bfontSize = new DocumentFormat.OpenXml.Spreadsheet.FontSize() { Val = 11D }; DocumentFormat.OpenXml.Spreadsheet.Color bcolor = new DocumentFormat.OpenXml.Spreadsheet.Color() { Theme = (UInt32Value)1U }; FontName bfontName = new FontName() { Val = "Calibri" }; FontFamilyNumbering bfontFamilyNumbering = new FontFamilyNumbering() { Val = 2 }; FontScheme bfontScheme = new FontScheme() { Val = FontSchemeValues.Minor }; Bold bFontBold = new Bold(); bFont.Append(bfontSize); bFont.Append(bcolor); bFont.Append(bfontName); bFont.Append(bfontFamilyNumbering); bFont.Append(bfontScheme); bFont.Append(bFontBold); fonts1.Append(bFont); Fills fills1 = new Fills() { Count = (UInt32Value)6U }; // FillId = 0 Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); // FillId = 1 Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); // FillId = 2,RED Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor1 = new ForegroundColor() { Rgb = "5c881a" }; BackgroundColor backgroundColor1 = new BackgroundColor() { Indexed = (UInt32Value)64U }; // patternFill3.Append(foregroundColor1); patternFill3.Append(backgroundColor1); fill3.Append(patternFill3); // FillId = 3,BLUE Fill fill4 = new Fill(); PatternFill patternFill4 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor2 = new ForegroundColor() { Rgb = "0070c0" }; BackgroundColor backgroundColor2 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill4.Append(foregroundColor2); patternFill4.Append(backgroundColor2); fill4.Append(patternFill4); // FillId = 4,YELLO Fill fill5 = new Fill(); PatternFill patternFill5 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor3 = new ForegroundColor() { Rgb = "FFFFFF00" }; BackgroundColor backgroundColor3 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill5.Append(foregroundColor3); patternFill5.Append(backgroundColor3); fill5.Append(patternFill5); // FillId = 5,RED and BOLD Text Fill fill6 = new Fill(); PatternFill patternFill6 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor4 = new ForegroundColor() { Rgb = "5c881a" }; BackgroundColor backgroundColor4 = new BackgroundColor() { Indexed = (UInt32Value)64U }; Bold bold1 = new Bold(); patternFill6.Append(bold1); patternFill6.Append(foregroundColor4); patternFill6.Append(backgroundColor4); fill6.Append(patternFill6); fills1.Append(fill1); fills1.Append(fill2); fills1.Append(fill3); fills1.Append(fill4); fills1.Append(fill5); fills1.Append(fill6); Borders borders1 = new Borders() { Count = (UInt32Value)1U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); borders1.Append(border1); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)4U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true }; CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true }; CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)4U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true }; cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); cellFormats1.Append(cellFormat5); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleMedium9" }; StylesheetExtensionList stylesheetExtensionList1 = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.SlicerStyles slicerStyles1 = new X14.SlicerStyles() { DefaultSlicerStyle = "SlicerStyleLight1" }; stylesheetExtension1.Append(slicerStyles1); stylesheetExtensionList1.Append(stylesheetExtension1); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); return(stylesheet1); }
// Generates content of workbookStyles. private void GenerateWorkbookStylesContent(WorkbookStylesPart workbookStyles) { Stylesheet stylesheet1 = new Stylesheet() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "x14ac" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); NumberingFormats numberingFormats1 = new NumberingFormats() { Count = (UInt32Value)1U }; NumberingFormat numberingFormat1 = new NumberingFormat() { NumberFormatId = (UInt32Value)43U, FormatCode = "_(* #,##0.00_);_(* \\(#,##0.00\\);_(* \"-\"??_);_(@_)" }; numberingFormats1.Append(numberingFormat1); Fonts fonts1 = new Fonts() { Count = (UInt32Value)4U, KnownFonts = true }; Font font1 = new Font(); FontSize fontSize1 = new FontSize() { Val = 11D }; Color color1 = new Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme1 = new FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); Font font2 = new Font(); Bold bold1 = new Bold(); FontSize fontSize2 = new FontSize() { Val = 11D }; Color color2 = new Color() { Theme = (UInt32Value)1U }; FontName fontName2 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme2 = new FontScheme() { Val = FontSchemeValues.Minor }; font2.Append(bold1); font2.Append(fontSize2); font2.Append(color2); font2.Append(fontName2); font2.Append(fontFamilyNumbering2); font2.Append(fontScheme2); Font font3 = new Font(); Bold bold2 = new Bold(); Italic italic1 = new Italic(); FontSize fontSize3 = new FontSize() { Val = 11D }; Color color3 = new Color() { Rgb = "FFFF0000" }; FontName fontName3 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering3 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme3 = new FontScheme() { Val = FontSchemeValues.Minor }; font3.Append(bold2); font3.Append(italic1); font3.Append(fontSize3); font3.Append(color3); font3.Append(fontName3); font3.Append(fontFamilyNumbering3); font3.Append(fontScheme3); Font font4 = new Font(); Italic italic2 = new Italic(); FontSize fontSize4 = new FontSize() { Val = 11D }; Color color4 = new Color() { Rgb = "FFFF0000" }; FontName fontName4 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering4 = new FontFamilyNumbering() { Val = 2 }; FontScheme fontScheme4 = new FontScheme() { Val = FontSchemeValues.Minor }; font4.Append(italic2); font4.Append(fontSize4); font4.Append(color4); font4.Append(fontName4); font4.Append(fontFamilyNumbering4); font4.Append(fontScheme4); fonts1.Append(font1); fonts1.Append(font2); fonts1.Append(font3); fonts1.Append(font4); Fills fills1 = new Fills() { Count = (UInt32Value)4U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor1 = new ForegroundColor() { Theme = (UInt32Value)0U, Tint = -4.9989318521683403E-2D }; BackgroundColor backgroundColor1 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill3.Append(foregroundColor1); patternFill3.Append(backgroundColor1); fill3.Append(patternFill3); Fill fill4 = new Fill(); PatternFill patternFill4 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor2 = new ForegroundColor() { Rgb = "FFFFFFCC" }; BackgroundColor backgroundColor2 = new BackgroundColor() { Indexed = (UInt32Value)64U }; patternFill4.Append(foregroundColor2); patternFill4.Append(backgroundColor2); fill4.Append(patternFill4); fills1.Append(fill1); fills1.Append(fill2); fills1.Append(fill3); fills1.Append(fill4); Borders borders1 = new Borders() { Count = (UInt32Value)2U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); Border border2 = new Border(); LeftBorder leftBorder2 = new LeftBorder(); RightBorder rightBorder2 = new RightBorder(); TopBorder topBorder2 = new TopBorder() { Style = BorderStyleValues.Thin }; Color color5 = new Color() { Indexed = (UInt32Value)64U }; topBorder2.Append(color5); BottomBorder bottomBorder2 = new BottomBorder(); DiagonalBorder diagonalBorder2 = new DiagonalBorder(); border2.Append(leftBorder2); border2.Append(rightBorder2); border2.Append(topBorder2); border2.Append(bottomBorder2); border2.Append(diagonalBorder2); borders1.Append(border1); borders1.Append(border2); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)16U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment1 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat3.Append(alignment1); CellFormat cellFormat4 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true }; CellFormat cellFormat5 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment2 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat5.Append(alignment2); CellFormat cellFormat6 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment3 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat6.Append(alignment3); CellFormat cellFormat7 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment4 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat7.Append(alignment4); CellFormat cellFormat8 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment5 = new Alignment() { Horizontal = HorizontalAlignmentValues.Right }; cellFormat8.Append(alignment5); CellFormat cellFormat9 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyAlignment = true }; Alignment alignment6 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat9.Append(alignment6); CellFormat cellFormat10 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyAlignment = true }; Alignment alignment7 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat10.Append(alignment7); CellFormat cellFormat11 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment8 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat11.Append(alignment8); CellFormat cellFormat12 = new CellFormat() { NumberFormatId = (UInt32Value)43U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat13 = new CellFormat() { NumberFormatId = (UInt32Value)9U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment9 = new Alignment() { Horizontal = HorizontalAlignmentValues.Left }; cellFormat13.Append(alignment9); CellFormat cellFormat14 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyAlignment = true }; Alignment alignment10 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat14.Append(alignment10); CellFormat cellFormat15 = new CellFormat() { NumberFormatId = (UInt32Value)37U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment11 = new Alignment() { Horizontal = HorizontalAlignmentValues.Center }; cellFormat15.Append(alignment11); CellFormat cellFormat16 = new CellFormat() { NumberFormatId = (UInt32Value)43U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat17 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); cellFormats1.Append(cellFormat5); cellFormats1.Append(cellFormat6); cellFormats1.Append(cellFormat7); cellFormats1.Append(cellFormat8); cellFormats1.Append(cellFormat9); cellFormats1.Append(cellFormat10); cellFormats1.Append(cellFormat11); cellFormats1.Append(cellFormat12); cellFormats1.Append(cellFormat13); cellFormats1.Append(cellFormat14); cellFormats1.Append(cellFormat15); cellFormats1.Append(cellFormat16); cellFormats1.Append(cellFormat17); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; StylesheetExtensionList stylesheetExtensionList1 = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension() { Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); DocumentFormat.OpenXml.Office2010.Excel.SlicerStyles slicerStyles1 = new DocumentFormat.OpenXml.Office2010.Excel.SlicerStyles() { DefaultSlicerStyle = "SlicerStyleLight1" }; stylesheetExtension1.Append(slicerStyles1); //StylesheetExtension stylesheetExtension2 = new StylesheetExtension(){ Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}" }; //stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); //X15.TimelineStyles timelineStyles1 = new X15.TimelineStyles(){ DefaultTimelineStyle = "TimeSlicerStyleLight1" }; //stylesheetExtension2.Append(timelineStyles1); stylesheetExtensionList1.Append(stylesheetExtension1); //stylesheetExtensionList1.Append(stylesheetExtension2); stylesheet1.Append(numberingFormats1); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); workbookStyles.Stylesheet = stylesheet1; }
private static Stylesheet CreateStylesheet() { Stylesheet stylesheet1 = new Stylesheet(); DocumentFormat.OpenXml.Spreadsheet.Fonts fonts1 = new DocumentFormat.OpenXml.Spreadsheet.Fonts() { Count = (UInt32Value)1U, KnownFonts = true }; DocumentFormat.OpenXml.Spreadsheet.Font font1 = new DocumentFormat.OpenXml.Spreadsheet.Font(); FontSize fontSize1 = new FontSize() { Val = 11 }; Color color1 = new Color() { Theme = (UInt32Value)1U }; FontName fontName1 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering() { Val = 2 }; DocumentFormat.OpenXml.Spreadsheet.FontScheme fontScheme1 = new DocumentFormat.OpenXml.Spreadsheet.FontScheme() { Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); DocumentFormat.OpenXml.Spreadsheet.Font font2 = new DocumentFormat.OpenXml.Spreadsheet.Font(); FontSize fontSize2 = new FontSize() { Val = 14 }; Color color2 = new Color() { Rgb = "FF0070C0" }; FontName fontName2 = new FontName() { Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering() { Val = 2 }; DocumentFormat.OpenXml.Spreadsheet.FontScheme fontScheme2 = new DocumentFormat.OpenXml.Spreadsheet.FontScheme() { Val = FontSchemeValues.Minor }; font2.Append(fontSize1); font1.Append(color2); font1.Append(fontName2); font1.Append(fontFamilyNumbering2); font1.Append(fontScheme2); fonts1.Append(font1); fonts1.Append(font2); CellStyleFormats cellStyleFormats1 = new CellStyleFormats() { Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats() { Count = (UInt32Value)4U }; CellFormat cellFormat2 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U }; CellFormat cellFormat3 = new CellFormat() { NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U }; cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); stylesheet1.Append(fonts1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); return(stylesheet1); }
// Generates content of workbookStyles. private void GenerateWorkbookStylesContent(WorkbookStylesPart workbookStyles) { Stylesheet stylesheet1 = new Stylesheet(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "x14ac" } }; stylesheet1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"); stylesheet1.AddNamespaceDeclaration("x14ac", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); NumberingFormats numberingFormats1 = new NumberingFormats(){ Count = (UInt32Value)1U }; NumberingFormat numberingFormat1 = new NumberingFormat(){ NumberFormatId = (UInt32Value)43U, FormatCode = "_(* #,##0.00_);_(* \\(#,##0.00\\);_(* \"-\"??_);_(@_)" }; numberingFormats1.Append(numberingFormat1); Fonts fonts1 = new Fonts(){ Count = (UInt32Value)4U, KnownFonts = true }; Font font1 = new Font(); FontSize fontSize1 = new FontSize(){ Val = 11D }; Color color1 = new Color(){ Theme = (UInt32Value)1U }; FontName fontName1 = new FontName(){ Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering1 = new FontFamilyNumbering(){ Val = 2 }; FontScheme fontScheme1 = new FontScheme(){ Val = FontSchemeValues.Minor }; font1.Append(fontSize1); font1.Append(color1); font1.Append(fontName1); font1.Append(fontFamilyNumbering1); font1.Append(fontScheme1); Font font2 = new Font(); Bold bold1 = new Bold(); FontSize fontSize2 = new FontSize(){ Val = 11D }; Color color2 = new Color(){ Theme = (UInt32Value)1U }; FontName fontName2 = new FontName(){ Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering2 = new FontFamilyNumbering(){ Val = 2 }; FontScheme fontScheme2 = new FontScheme(){ Val = FontSchemeValues.Minor }; font2.Append(bold1); font2.Append(fontSize2); font2.Append(color2); font2.Append(fontName2); font2.Append(fontFamilyNumbering2); font2.Append(fontScheme2); Font font3 = new Font(); Bold bold2 = new Bold(); Italic italic1 = new Italic(); FontSize fontSize3 = new FontSize(){ Val = 11D }; Color color3 = new Color(){ Rgb = "FFFF0000" }; FontName fontName3 = new FontName(){ Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering3 = new FontFamilyNumbering(){ Val = 2 }; FontScheme fontScheme3 = new FontScheme(){ Val = FontSchemeValues.Minor }; font3.Append(bold2); font3.Append(italic1); font3.Append(fontSize3); font3.Append(color3); font3.Append(fontName3); font3.Append(fontFamilyNumbering3); font3.Append(fontScheme3); Font font4 = new Font(); Italic italic2 = new Italic(); FontSize fontSize4 = new FontSize(){ Val = 11D }; Color color4 = new Color(){ Rgb = "FFFF0000" }; FontName fontName4 = new FontName(){ Val = "Calibri" }; FontFamilyNumbering fontFamilyNumbering4 = new FontFamilyNumbering(){ Val = 2 }; FontScheme fontScheme4 = new FontScheme(){ Val = FontSchemeValues.Minor }; font4.Append(italic2); font4.Append(fontSize4); font4.Append(color4); font4.Append(fontName4); font4.Append(fontFamilyNumbering4); font4.Append(fontScheme4); fonts1.Append(font1); fonts1.Append(font2); fonts1.Append(font3); fonts1.Append(font4); Fills fills1 = new Fills(){ Count = (UInt32Value)4U }; Fill fill1 = new Fill(); PatternFill patternFill1 = new PatternFill(){ PatternType = PatternValues.None }; fill1.Append(patternFill1); Fill fill2 = new Fill(); PatternFill patternFill2 = new PatternFill(){ PatternType = PatternValues.Gray125 }; fill2.Append(patternFill2); Fill fill3 = new Fill(); PatternFill patternFill3 = new PatternFill(){ PatternType = PatternValues.Solid }; ForegroundColor foregroundColor1 = new ForegroundColor(){ Theme = (UInt32Value)0U, Tint = -4.9989318521683403E-2D }; BackgroundColor backgroundColor1 = new BackgroundColor(){ Indexed = (UInt32Value)64U }; patternFill3.Append(foregroundColor1); patternFill3.Append(backgroundColor1); fill3.Append(patternFill3); Fill fill4 = new Fill(); PatternFill patternFill4 = new PatternFill(){ PatternType = PatternValues.Solid }; ForegroundColor foregroundColor2 = new ForegroundColor(){ Rgb = "FFFFFFCC" }; BackgroundColor backgroundColor2 = new BackgroundColor(){ Indexed = (UInt32Value)64U }; patternFill4.Append(foregroundColor2); patternFill4.Append(backgroundColor2); fill4.Append(patternFill4); fills1.Append(fill1); fills1.Append(fill2); fills1.Append(fill3); fills1.Append(fill4); Borders borders1 = new Borders(){ Count = (UInt32Value)2U }; Border border1 = new Border(); LeftBorder leftBorder1 = new LeftBorder(); RightBorder rightBorder1 = new RightBorder(); TopBorder topBorder1 = new TopBorder(); BottomBorder bottomBorder1 = new BottomBorder(); DiagonalBorder diagonalBorder1 = new DiagonalBorder(); border1.Append(leftBorder1); border1.Append(rightBorder1); border1.Append(topBorder1); border1.Append(bottomBorder1); border1.Append(diagonalBorder1); Border border2 = new Border(); LeftBorder leftBorder2 = new LeftBorder(); RightBorder rightBorder2 = new RightBorder(); TopBorder topBorder2 = new TopBorder(){ Style = BorderStyleValues.Thin }; Color color5 = new Color(){ Indexed = (UInt32Value)64U }; topBorder2.Append(color5); BottomBorder bottomBorder2 = new BottomBorder(); DiagonalBorder diagonalBorder2 = new DiagonalBorder(); border2.Append(leftBorder2); border2.Append(rightBorder2); border2.Append(topBorder2); border2.Append(bottomBorder2); border2.Append(diagonalBorder2); borders1.Append(border1); borders1.Append(border2); CellStyleFormats cellStyleFormats1 = new CellStyleFormats(){ Count = (UInt32Value)1U }; CellFormat cellFormat1 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U }; cellStyleFormats1.Append(cellFormat1); CellFormats cellFormats1 = new CellFormats(){ Count = (UInt32Value)16U }; CellFormat cellFormat2 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U }; CellFormat cellFormat3 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment1 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center }; cellFormat3.Append(alignment1); CellFormat cellFormat4 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true }; CellFormat cellFormat5 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment2 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Left }; cellFormat5.Append(alignment2); CellFormat cellFormat6 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)1U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment3 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center }; cellFormat6.Append(alignment3); CellFormat cellFormat7 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment4 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center }; cellFormat7.Append(alignment4); CellFormat cellFormat8 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment5 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Right }; cellFormat8.Append(alignment5); CellFormat cellFormat9 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyAlignment = true }; Alignment alignment6 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Left }; cellFormat9.Append(alignment6); CellFormat cellFormat10 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyAlignment = true }; Alignment alignment7 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center }; cellFormat10.Append(alignment7); CellFormat cellFormat11 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)3U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment8 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center }; cellFormat11.Append(alignment8); CellFormat cellFormat12 = new CellFormat(){ NumberFormatId = (UInt32Value)43U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true }; CellFormat cellFormat13 = new CellFormat(){ NumberFormatId = (UInt32Value)9U, FontId = (UInt32Value)0U, FillId = (UInt32Value)3U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFill = true, ApplyAlignment = true }; Alignment alignment9 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Left }; cellFormat13.Append(alignment9); CellFormat cellFormat14 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)0U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)0U, FormatId = (UInt32Value)0U, ApplyFill = true, ApplyAlignment = true }; Alignment alignment10 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center }; cellFormat14.Append(alignment10); CellFormat cellFormat15 = new CellFormat(){ NumberFormatId = (UInt32Value)37U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true, ApplyAlignment = true }; Alignment alignment11 = new Alignment(){ Horizontal = HorizontalAlignmentValues.Center }; cellFormat15.Append(alignment11); CellFormat cellFormat16 = new CellFormat(){ NumberFormatId = (UInt32Value)43U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyNumberFormat = true, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; CellFormat cellFormat17 = new CellFormat(){ NumberFormatId = (UInt32Value)0U, FontId = (UInt32Value)2U, FillId = (UInt32Value)2U, BorderId = (UInt32Value)1U, FormatId = (UInt32Value)0U, ApplyFont = true, ApplyFill = true, ApplyBorder = true }; cellFormats1.Append(cellFormat2); cellFormats1.Append(cellFormat3); cellFormats1.Append(cellFormat4); cellFormats1.Append(cellFormat5); cellFormats1.Append(cellFormat6); cellFormats1.Append(cellFormat7); cellFormats1.Append(cellFormat8); cellFormats1.Append(cellFormat9); cellFormats1.Append(cellFormat10); cellFormats1.Append(cellFormat11); cellFormats1.Append(cellFormat12); cellFormats1.Append(cellFormat13); cellFormats1.Append(cellFormat14); cellFormats1.Append(cellFormat15); cellFormats1.Append(cellFormat16); cellFormats1.Append(cellFormat17); CellStyles cellStyles1 = new CellStyles(){ Count = (UInt32Value)1U }; CellStyle cellStyle1 = new CellStyle(){ Name = "Normal", FormatId = (UInt32Value)0U, BuiltinId = (UInt32Value)0U }; cellStyles1.Append(cellStyle1); DifferentialFormats differentialFormats1 = new DifferentialFormats(){ Count = (UInt32Value)0U }; TableStyles tableStyles1 = new TableStyles(){ Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleLight16" }; StylesheetExtensionList stylesheetExtensionList1 = new StylesheetExtensionList(); StylesheetExtension stylesheetExtension1 = new StylesheetExtension(){ Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" }; stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); DocumentFormat.OpenXml.Office2010.Excel.SlicerStyles slicerStyles1 = new DocumentFormat.OpenXml.Office2010.Excel.SlicerStyles(){ DefaultSlicerStyle = "SlicerStyleLight1" }; stylesheetExtension1.Append(slicerStyles1); //StylesheetExtension stylesheetExtension2 = new StylesheetExtension(){ Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}" }; //stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); //X15.TimelineStyles timelineStyles1 = new X15.TimelineStyles(){ DefaultTimelineStyle = "TimeSlicerStyleLight1" }; //stylesheetExtension2.Append(timelineStyles1); stylesheetExtensionList1.Append(stylesheetExtension1); //stylesheetExtensionList1.Append(stylesheetExtension2); stylesheet1.Append(numberingFormats1); stylesheet1.Append(fonts1); stylesheet1.Append(fills1); stylesheet1.Append(borders1); stylesheet1.Append(cellStyleFormats1); stylesheet1.Append(cellFormats1); stylesheet1.Append(cellStyles1); stylesheet1.Append(differentialFormats1); stylesheet1.Append(tableStyles1); stylesheet1.Append(stylesheetExtensionList1); workbookStyles.Stylesheet = stylesheet1; }